Issuing an invoice in Base
addInvoice issues an invoice for an order using a chosen numbering series.
| Parameter | Type | Description |
|---|---|---|
order_id | int | Order ID. |
series_id | int | Numbering series ID — list available series with getSeries. |
vat_rate | text | Optional. "DEFAULT" (per numbering series), "ITEM" (rate from the order line item), "EXPT"/"ZW" (VAT exempt), "NP", "OO" (reverse charge), or a specific number 0–100. |
invoice_id, which you then use for downloading the file (getInvoiceFile) or listing invoices (getInvoices).
Replacing it with an invoice from an external system
If you issue invoices in your own ERP (and don’t want to duplicate numbering in both Base and your system), useaddOrderInvoiceFile — it replaces the standard Base invoice with your own PDF (or XML, for countries where that’s allowed, e.g. Brazil).
| Parameter | Type | Description |
|---|---|---|
invoice_id | int | Base invoice ID (must already exist — e.g. created via addInvoice). |
file | text | PDF (or XML) in base64, with a required "data:" prefix. |
external_invoice_number | varchar(30) | Invoice number from your system — overwrites the number assigned by Base. |
Recommended flow
- Your ERP issues an invoice (number, PDF).
- In Base, create an invoice for the order via
addInvoice(you just need a validseries_id— the specific number/rate doesn’t matter much since you’ll overwrite it shortly). - Call
addOrderInvoiceFilewith theinvoice_idfrom step 2, attach the PDF from your ERP, and setexternal_invoice_numberto the real number from your system. - Forwarding the invoice further to the marketplace (if the integration supports it) is typically tied to a specific order status — configured per integration, similar to tracking numbers. Timing (batches, not instant) is described in Automation and webhooks.