Invoices API
Auto-generated from the OpenAPI spec. Run
node docs-site/scripts/fetch-openapi.jsto 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
| Field | Required | Type | Description |
|---|---|---|---|
source_type | Yes | string | |
source_id | Yes | integer | |
tax_rate | No | number |
Responses
- 201 — Successful Response
- 422 — Validation Error
GET /api/v1/invoices
List Invoices
List invoices, newest first. Manager-only.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
client_id | query | No | ||
start_date | query | No | ||
end_date | query | No |
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
| Name | In | Required | Type | Description |
|---|---|---|---|---|
invoice_id | path | Yes | integer |
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
| Name | In | Required | Type | Description |
|---|---|---|---|---|
invoice_id | path | Yes | integer |
Responses
- 200 — Successful Response
- 422 — Validation Error