Skip to main content

HTTP API reference

Invoices

List, fetch, patch, and delete saved invoice rows and structured `parsed_data` for your account.

Endpoints in this topic

GET/api/invoices

Paginated list of stored invoices for the authenticated user.

Request
GET — query: page (≥1, default 1), limit (1–200, default 20), kind=expense|revenue, from / to (YYYY-MM-DD on parsed document date), q (search, max 200 chars; counterparty / invoice # / raw text).
Response
{
  invoices[], page, limit, total, totalPages
}

Each invoice: id, createdAt, invoiceKind, provider,
  invoiceNumber, documentDate, total, currency, fileUrl, mimeType.

GET/api/invoices/[id]

Fetch one invoice by id (path param).

Request
Path segment [id] = invoice UUID.
Response
{
  invoice: {
    id, createdAt, invoiceKind, provider, invoiceNumber,
    documentDate, total, currency, fileUrl, mimeType, rawText?
  }
}

PATCH/api/invoices/[id]

Update invoice_kind and/or parsed_data fields.

Request
Content-Type: application/json

{
  "invoice_kind": "expense" | "revenue",
  "parsed_data": { partial InvoiceExtract }
}
(both fields optional; parsed_data merges into existing parsed_data then re-validates)
Response
{
  invoice: { …same shape as GET /api/invoices/[id] … }
}

DELETE/api/invoices/[id]

Delete a stored invoice.

Request
Path segment [id] = invoice UUID.
Response
200 { ok: true }. 404 with error JSON if the row is missing.