HTTP API reference
Invoices
List, fetch, patch, and delete saved rows per client. Expenses live under /api/expenses; revenue under /api/revenue.
Endpoints in this topic
GET/api/expenses
Paginated expense invoices for a client (client_id query required).
GET — query: client_id (required uuid), page (≥1), limit (1–200), from / to (YYYY-MM-DD), q (search).
{
invoices[], page, limit, total, totalPages
}
Each row: id, createdAt, invoiceKind, provider, invoiceNumber, documentDate, total, currency, fileUrl, mimeType, clientId.GET/api/expenses/[id]
Fetch one expense invoice by id.
Path [id] = expense invoice UUID (must belong to the org).
{ invoice: { id, createdAt, invoiceKind, provider, invoiceNumber, documentDate, total, currency, fileUrl, mimeType, rawText?, clientId } }PATCH/api/expenses/[id]
Merge parsed_data on an expense invoice.
Content-Type: application/json
{ "parsed_data": { partial InvoiceExtract } }
(parsed_data merges into existing parsed_data then re-validates){ invoice: { …same shape as GET /api/expenses/[id]… } }DELETE/api/expenses/[id]
Delete an expense invoice.
Path [id] = expense invoice UUID.
200 { ok: true }. 404 if missing.GET/api/revenue
Paginated revenue invoices for a client (client_id query required).
Same query params as GET /api/expenses; rows are invoice_kind=revenue.
Same paginated list shape as GET /api/expenses.
GET/api/revenue/[id]
Fetch one revenue invoice by id.
Path [id] = revenue invoice UUID.
Same single-invoice shape as GET /api/expenses/[id].
PATCH/api/revenue/[id]
Merge parsed_data on a revenue invoice.
Same JSON body as PATCH /api/expenses/[id].
Same invoice object as PATCH /api/expenses/[id].
DELETE/api/revenue/[id]
Delete a revenue invoice.
Path [id] = revenue invoice UUID.
200 { ok: true }. 404 if missing.