Create a draft invoice
Creates a draft, with the same rules as creating an invoice in the Envoi app. Nothing is numbered, booked
or sent until you call POST /v1/invoices/{id}/send.
Name the customer by clientId (a client in this account) or inline in client, not both. An inline
client is matched against the register (by organisation number, then email) and added to it when it is not
there, as in the app. dueDate is required. A line may name its VAT by
vatCode (a SAF-T sales code) or vatRate, or both if they agree; with neither, the account’s default VAT rate applies.
Authorizations
OAuth 2.0 client credentials. The token request also needs the audience form field (the Account ID), which OAuth tooling does not always send; see POST /v1/oauth/token.
Headers
Required on every POST, at most 255 characters. Use a new UUID for each logical operation. The first request with a key runs, and its answer (any status below 500) is stored for 7 days. A retry with the same key, method, path and body gets the stored answer again with Idempotency-Replayed: true, and nothing runs twice. The same key with a different body or path is 422 idempotency-key-reused; the same key while the first request is still running is 409 idempotency-key-in-progress. A 5xx answer is not stored, so the same key may be retried. A key belongs to the API client's grant (one environment).
255Body
The draft.
A new draft invoice. Send it with POST /v1/invoices/{id}/send.
The due date. Required.
The invoice lines. Required; at least one.
1A client in this account's register. Give this or client, not both.
A client given inline on a new invoice (when no clientId is sent).
Your reference, for example an order number.
A note printed on the invoice.
Response
The draft invoice.
An invoice or credit note.
The invoice's id.
invoice or credit_note.
draft, sent, viewed, paid, overdue, reminded, collection_warning, credited or bounced.
The invoice date.
The due date.
Your reference, for example an order number; empty when none.
The client on an invoice: the name and address the invoice is made out to.
Always NOK in v1.
Total without VAT.
Total VAT.
Total with VAT.
How much has been paid.
How much is still owed.
The invoice lines.
The payments recorded on it.
When it was created (UTC).
When it last changed (UTC).
The issued credit notes against the invoice; outstandingAmount is net of it.
The invoice number, or null on a draft (it gets one when it is sent).
The KID (payment reference), or null when there is none (always on a draft).
The date it was paid in full, or null.
A note printed on the invoice, or null.