Skip to main content

HTTP API reference

Business metrics (BI)

Period revenue, expenses, profit, and margin (`/api/bi/summary`), monthly trends (`/api/bi/trends`), and top clients/vendors (`/api/bi/distribution`).

Endpoints in this topic

GET/api/bi/summary

Period totals: revenue, expenses, profit, margin. When `profiles.reporting_currency` is set, amounts are converted with published daily reference rates; `caveats` lists `reportingCurrency`, `fxAsOf`, `excludedMissingCurrency`, and optional `fxError`.

Request
GET — query: from, to (YYYY-MM-DD; default ≈ last 90 days UTC if omitted).
Response
{
  period, revenue, expenses, profit, profitMargin, caveats
}

caveats: mixedCurrency, reportingCurrency, fxAsOf,
  excludedMissingCurrency, optional fxError.

revenue/expenses: total, currency, invoiceCount, excludedNoAmount.

GET/api/bi/distribution

Top clients (revenue) and top vendors (expenses) for a date range.

Request
GET — query: from, to, limit (1–50, default 10) for each of topClients and topVendors.
Response
{
  period,
  topClients: [{ name, total, invoiceCount }],
  topVendors: [{ name, total, invoiceCount }]
}
Business metrics (BI) — API reference · BillflowAI