Skip to main content

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).

Request
GET — query: client_id (required uuid), page (≥1), limit (1–200), from / to (YYYY-MM-DD), q (search).
Response
{
  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.

Request
Path [id] = expense invoice UUID (must belong to the org).
Response
{ invoice: { id, createdAt, invoiceKind, provider, invoiceNumber, documentDate, total, currency, fileUrl, mimeType, rawText?, clientId } }

PATCH/api/expenses/[id]

Merge parsed_data on an expense invoice.

Request
Content-Type: application/json

{ "parsed_data": { partial InvoiceExtract } }
(parsed_data merges into existing parsed_data then re-validates)
Response
{ invoice: { …same shape as GET /api/expenses/[id]… } }

DELETE/api/expenses/[id]

Delete an expense invoice.

Request
Path [id] = expense invoice UUID.
Response
200 { ok: true }. 404 if missing.

GET/api/revenue

Paginated revenue invoices for a client (client_id query required).

Request
Same query params as GET /api/expenses; rows are invoice_kind=revenue.
Response
Same paginated list shape as GET /api/expenses.

GET/api/revenue/[id]

Fetch one revenue invoice by id.

Request
Path [id] = revenue invoice UUID.
Response
Same single-invoice shape as GET /api/expenses/[id].

PATCH/api/revenue/[id]

Merge parsed_data on a revenue invoice.

Request
Same JSON body as PATCH /api/expenses/[id].
Response
Same invoice object as PATCH /api/expenses/[id].

DELETE/api/revenue/[id]

Delete a revenue invoice.

Request
Path [id] = revenue invoice UUID.
Response
200 { ok: true }. 404 if missing.