Skip to main content

Invoices API

Auto-generated from the OpenAPI spec. Run node docs-site/scripts/fetch-openapi.js to regenerate.

POST /api/v1/invoices

Create Invoice Endpoint

Generate an invoice for a completed payment or a product sale.

subtotal/tax/total are always computed server-side — a client-supplied amount is never trusted. Rejects with 409 INVOICE_ALREADY_EXISTS if an invoice was already generated for this (source_type, source_id) pair.

Request body

FieldRequiredTypeDescription
source_typeYesstring
source_idYesinteger
tax_rateNonumber

Responses

  • 201 — Successful Response
  • 422 — Validation Error

GET /api/v1/invoices

List Invoices

List invoices, newest first. Manager-only.

Parameters

NameInRequiredTypeDescription
client_idqueryNo
start_datequeryNo
end_datequeryNo

Responses

  • 200 — Successful Response
  • 422 — Validation Error

GET /api/v1/invoices/{invoice_id}

Get Invoice

Get an invoice by ID, including its seller/buyer snapshots. Manager-only.

Parameters

NameInRequiredTypeDescription
invoice_idpathYesinteger

Responses

  • 200 — Successful Response
  • 422 — Validation Error

GET /api/v1/invoices/{invoice_id}/pdf

Download Invoice Pdf

Download the generated PDF for an invoice. Manager-only.

The stored pdf_path is never trusted directly: it is re-sanitized and confirmed (via os.path.commonpath) to resolve inside INVOICES_DIR before ever touching the filesystem — path-traversal defence in depth, same technique as app/routers/photos.py, per docs/SECURITY_GUIDELINES.md.

Parameters

NameInRequiredTypeDescription
invoice_idpathYesinteger

Responses

  • 200 — Successful Response
  • 422 — Validation Error