
Create an incidental invoice via API
An incidental invoice is a manual, one-off charge that sits outside the regular billing run (advances, periodic invoices, end notes).
Creating an invoice is a two-step process:
Create — stores the invoice in status
created(draft).Approve — finalises the invoice, assigns an invoice number, and starts downstream payment processing.
Until you approve, the invoice is not billable and has no official invoice number.
Integration flow
Recommended order:
Resolve
customerId.Resolve
contractIdandcontractNumberwhen the charge belongs to a contract.Resolve
companyBankAccountId.Resolve
taxCodeId(and optionallybillingItemId/serviceLocationId) for each line.Create the invoice — save the returned
id.Approve the invoice — poll until
statusisapprovedandinvoiceNumis set.(Optional) Send the invoice to the customer.
Step 1 — Look up the customer
POST api/md/Customers/filterContent-Type: application/json{"flexSearch": "Janssen","nameContains": "Janssen"}
Step 2 — Look up the contract (optional)
Linking a contract is optional but recommended when the charge relates to an active supply agreement.
When you provide contractId, the platform copies property groups from the billing relation automatically.
POST /api/md/Contracts/filter?quickFilter=allContent-Type: application/json {"customerId": "{customerId}","excludeTerminatedContracts": true}
Step 3 — Look up reference data
Company bank account (companyBankAccountId)
GET /api/cfg/BankAccountsUse the id of the bank account configured for the organization.
When you bill via a property group (no contract), you can also read companyBankAccountId from:
GET /api/bill/PropertyGroupBillingConfigurations/{propertyGroupId}Tax code (lines[].taxCodeId)
GET /api/cfg/TaxCodesEach line must reference a valid taxCodeId.
VAT is calculated from the tax rate that applies to the line's startDateTime and endDateTime, unless you set disableVATCalculation to true.
Billing item (lines[].billingItemId, optional)
GET /api/cfg/BillingItemsOptional. When provided, the platform can derive utility and consumption metadata from the billing item configuration.
Service location (lines[].serviceLocationId, optional)
POST /api/md/ServiceLocations/filter?quickFilter=allContent-Type: application/json{"customerId": "{customerId}"}
Alternatively, use serviceLocationId values from the contract's serviceLocations list.
Step 4 — Create the invoice
POST /api/bill/InvoicesContent-Type: application/json
Store data.id — you need it for approval and sending.
Step 5 — Approve the invoice
Approval finalises the invoice.
When invoiceNum was empty at creation, the platform assigns an official invoice number as part of this step.
POST /api/bill/Invoices/{invoiceId}/approveContent-Type: application/json{"invoiceDate": "2026-06-30T00:00:00+02:00"}
Approval is asynchronous
The approve call returns immediately, but finalisation (especially invoice number assignment) may take a few seconds. After calling approve:
Poll
GET /api/bill/Invoices/{invoiceId}.Wait until
statusisapprovedandinvoiceNumis no longer empty.
While processing you may briefly see status as approvalinprogress. Retry with a short interval (for example every 2–3 seconds) until the invoice reaches approved or an error appears in errors.
You can also subscribe to the invoice approved webhook. Check the "Webhooks" page for more information about the setup.