Skip to Content
API ReferenceInvoices API

Invoices API

The Invoices API provides full CRUD operations for managing customer invoices, including automatic generation from dossier revenue lines, finalization, and PDF download.

Required Scope: invoices:read, invoices:write, invoices:delete


List Invoices

Retrieve a paginated list of invoices with optional filters.

GET /api/v1/invoices

Query Parameters

ParameterTypeDescription
statusstringFilter by status: draft, finalized, sent, paid
customer_codestringFilter by customer code
invoice_numberstringFilter by invoice number (partial match)
dossier_idintegerFilter by dossier ID
payment_term_groupstringFilter by group: handling, duties, disbursements
invoice_date_fromdateFilter invoices on or after this date (YYYY-MM-DD)
invoice_date_todateFilter invoices on or before this date (YYYY-MM-DD)
searchstringSearch across invoice number, customer code, notes
sortstringSort field: id, invoice_number, invoice_date, due_date, status, total, customer_code, created_at (default: created_at)
directionstringSort direction: asc or desc (default: desc)
pageintegerPage number (default: 1)
per_pageintegerResults per page (default: 25, max: 100)

Example Request

curl https://app.borderbolt.com/api/v1/invoices \ -H "Authorization: Bearer {token}" \ -G \ --data-urlencode "status=sent" \ --data-urlencode "customer_code=CUST001"

Example Response

{ "data": [ { "id": 4001, "invoice_number": "INV-2026-001", "customer_code": "CUST001", "status": "sent", "invoice_date": "2026-03-25", "due_date": "2026-04-24", "subtotal": 2500.00, "vat_amount": 525.00, "total": 3025.00, "currency": "EUR", "created_at": "2026-03-25T10:00:00.000000Z", "finalized_at": "2026-03-25T11:00:00.000000Z", "sent_at": "2026-03-25T12:00:00.000000Z" } ], "meta": { "current_page": 1, "last_page": 4, "per_page": 25, "total": 78 } }

Get Invoice

Retrieve a single invoice with all line items.

GET /api/v1/invoices/{id}
curl https://app.borderbolt.com/api/v1/invoices/4001 \ -H "Authorization: Bearer {token}"

Example Response

{ "data": { "id": 4001, "invoice_number": "INV-2026-001", "customer_code": "CUST001", "status": "sent", "invoice_date": "2026-03-25", "due_date": "2026-04-24", "payment_term_group": "handling", "currency": "EUR", "notes": "Thank you for your business", "lines": [ { "id": 301, "description": "Customs clearance service - March 2026", "quantity": 5, "unit_price": 100.00, "vat_rate": 21.00, "vat_amount": 105.00, "amount": 500.00 } ], "subtotal": 2500.00, "vat_amount": 525.00, "total": 3025.00, "created_at": "2026-03-25T10:00:00.000000Z", "finalized_at": "2026-03-25T11:00:00.000000Z", "sent_at": "2026-03-25T12:00:00.000000Z", "paid_at": null } }

Create Invoice

Create a new invoice in draft status.

POST /api/v1/invoices

Request Body

FieldRequiredTypeDescription
customer_codeYesstringCustomer code
dossier_idNointegerLink to a specific dossier
payment_term_groupNostringhandling, duties, or disbursements (default: handling)
payment_term_daysNointegerPayment term in days (default: 30)
notesNostringInvoice notes/footer

Example Request

curl -X POST https://app.borderbolt.com/api/v1/invoices \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "customer_code": "CUST001", "dossier_id": 3001, "payment_term_group": "handling", "payment_term_days": 30, "notes": "Thank you for your business" }'

Example Response

{ "data": { "id": 4002, "invoice_number": null, "status": "draft", "customer_code": "CUST001", "created_at": "2026-03-25T14:00:00.000000Z" }, "message": "Invoice created successfully" }

HTTP 201 is returned on success.

Draft Invoices: Draft invoices don’t have an invoice number until finalized.


Update Invoice

Update a draft invoice. Only notes, due_date, and payment_term_group can be changed.

PUT /api/v1/invoices/{id}

Request Body

FieldRequiredTypeDescription
notesNostringInvoice notes
due_dateNodateOverride due date (YYYY-MM-DD)
payment_term_groupNostringhandling, duties, disbursements
curl -X PUT https://app.borderbolt.com/api/v1/invoices/4002 \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "notes": "Updated notes", "due_date": "2026-04-30" }'

Only draft invoices can be updated.


Delete Invoice

Delete a draft invoice.

DELETE /api/v1/invoices/{id}
curl -X DELETE https://app.borderbolt.com/api/v1/invoices/4002 \ -H "Authorization: Bearer {token}"

Only draft invoices can be deleted.


Invoice Lines

Add Line

Add a line to a draft invoice.

POST /api/v1/invoices/{id}/lines

Request Body

FieldRequiredTypeDescription
descriptionYesstringLine description (max 255 chars)
quantityYesnumberQuantity (min 0.01)
unit_priceYesnumberUnit price (min 0)
vat_rateNonumberVAT percentage (default: 21.00)
billable_item_idNointegerLink to a billable item
curl -X POST https://app.borderbolt.com/api/v1/invoices/4002/lines \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "description": "Transit handling fee", "quantity": 2, "unit_price": 150.00, "vat_rate": 21.00 }'

HTTP 201 is returned on success.

Update Line

PUT /api/v1/invoices/{id}/lines/{lineId}
curl -X PUT https://app.borderbolt.com/api/v1/invoices/4002/lines/301 \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "unit_price": 160.00 }'

Delete Line

DELETE /api/v1/invoices/{id}/lines/{lineId}
curl -X DELETE https://app.borderbolt.com/api/v1/invoices/4002/lines/301 \ -H "Authorization: Bearer {token}"

Finalize Invoice

Finalize a draft invoice, assigning an invoice number and locking it from further edits.

POST /api/v1/invoices/{id}/finalize
curl -X POST https://app.borderbolt.com/api/v1/invoices/4002/finalize \ -H "Authorization: Bearer {token}"

Example Response

{ "data": { "id": 4002, "invoice_number": "INV-2026-002", "status": "finalized", "subtotal": 600.00, "vat_amount": 126.00, "total": 726.00, "finalized_at": "2026-03-25T15:00:00.000000Z" }, "message": "Invoice finalized successfully" }

Irreversible: Once finalized, invoices cannot be edited or deleted.


Mark as Sent

Mark a finalized invoice as sent to the customer.

POST /api/v1/invoices/{id}/mark-sent
curl -X POST https://app.borderbolt.com/api/v1/invoices/4002/mark-sent \ -H "Authorization: Bearer {token}"

Mark as Paid

Mark a finalized invoice as paid.

POST /api/v1/invoices/{id}/mark-paid

Request Body

FieldRequiredTypeDescription
payment_referenceNostringBank/payment reference (max 255 chars)
curl -X POST https://app.borderbolt.com/api/v1/invoices/4002/mark-paid \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "payment_reference": "BANK-REF-12345" }'

Generate from Dossier

Generate invoices from all pending (uninvoiced) revenue lines in a dossier. May produce multiple invoices if lines span different payment term groups.

POST /api/v1/invoices/generate-for-dossier

Request Body

FieldRequiredTypeDescription
dossier_idYesintegerDossier ID
curl -X POST https://app.borderbolt.com/api/v1/invoices/generate-for-dossier \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "dossier_id": 3001 }'

Example Response

{ "data": [ { "id": 4003, "invoice_number": null, "status": "draft", "customer_code": "CUST001" } ], "message": "1 invoice(s) generated" }

HTTP 201 is returned on success. HTTP 422 is returned if there are no pending lines.


Preview Dossier Generation

Preview what would be included in generated invoices before actually generating them.

POST /api/v1/invoices/preview-for-dossier

Request Body

FieldRequiredTypeDescription
dossier_idYesintegerDossier ID
curl -X POST https://app.borderbolt.com/api/v1/invoices/preview-for-dossier \ -H "Authorization: Bearer {token}" \ -H "Content-Type: application/json" \ -d '{ "dossier_id": 3001 }'

Download PDF

Download a finalized invoice as PDF.

GET /api/v1/invoices/{id}/pdf
curl https://app.borderbolt.com/api/v1/invoices/4001/pdf \ -H "Authorization: Bearer {token}" \ -H "Accept: application/pdf" \ --output INV-2026-001.pdf

Returns a PDF binary (Content-Type: application/pdf).

Only finalized invoices can be downloaded as PDF.


Status Workflow

StatusDescriptionAllowed Next Actions
draftEditable, no invoice numberfinalize, update, delete, add/edit/delete lines
finalizedLocked, invoice number assignedmark-sent, mark-paid, pdf
sentSent to customermark-paid, pdf
paidPayment received

Next Steps

Last updated on