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`.
GET — query: from, to (YYYY-MM-DD; default ≈ last 90 days UTC if omitted).
{
period, revenue, expenses, profit, profitMargin, caveats
}
caveats: mixedCurrency, reportingCurrency, fxAsOf,
excludedMissingCurrency, optional fxError.
revenue/expenses: total, currency, invoiceCount, excludedNoAmount.GET/api/bi/trends
Month buckets with revenue, expenses, optional profit when single-currency.
GET — query: from, to (same defaults as /api/bi/summary).
{
period,
trends: [{ month, revenue, expenses, profit }]
}
profit is null when mixed-currency in the window.GET/api/bi/distribution
Top clients (revenue) and top vendors (expenses) for a date range.
GET — query: from, to, limit (1–50, default 10) for each of topClients and topVendors.
{
period,
topClients: [{ name, total, invoiceCount }],
topVendors: [{ name, total, invoiceCount }]
}