Book a purchase invoice
Book a purchase invoice in the accounting package (Exact: inkoopboeking), optionally with the invoice PDF attached. This is a permanent change to the books. Look up supplierId with search-contacts (role 'supplier'), ledger accounts with search-ledger-accounts, and journalCode with list-reference-data (kind 'journals', journalType 'purchase'). VAT needs no lookup: give each line a taxCategory and AskLedger picks the ledger's VAT code:
- nl_high: Dutch supplier, 21% VAT on the invoice
- nl_low: Dutch supplier, 9% VAT on the invoice (e.g. food, books, some repairs)
- nl_reverse_charge: Dutch supplier, no VAT charged with "BTW verlegd" / "reverse charge" on the invoice (e.g. subcontracting, staffing)
- eu_acquisition_high: supplier in another EU country, no VAT charged (reverse charge / intra-community), goods or services normally at 21% in NL
- eu_acquisition_low: supplier in another EU country, no VAT charged, goods or services normally at 9% in NL
- non_eu_import: supplier outside the EU (e.g. US software, UK after Brexit), no Dutch VAT charged
- none: no VAT applies or the VAT is not deductible (exempt services such as insurance, bank fees, healthcare; foreign VAT you cannot reclaim): the whole amount is cost
- zero_rated: Dutch VAT at 0% (e.g. international transport), only the base amount is reported Mixed rates on one invoice: one line per category. The package refuses a second booking with the same supplier and invoiceNumber (error code duplicate). The user must confirm before it is booked. If the result has created=false and a confirmation object, nothing was created yet: show confirmation.summary to the user verbatim and ask whether to create the booking. Only after the user explicitly says yes in the chat, call create-purchase-entry again with exactly the same arguments plus confirmationToken. Never confirm on the user's behalf and never reuse a token for other arguments.
A write: over REST only LedgerSuite products with askledger:purchase-write can call it, after their user approved the write in the product (no confirmation is asked). Other callers get 403 confirmation_required and use the MCP tool, which asks the user to confirm. Purchase entries: 409 duplicate when the package already has the booking (same supplier and invoice number); nothing was booked then. Send an Idempotency-Key to make retries safe.
Requires the ledger:write scope (Wijzigen in Exact). Same operation as the MCP tool create-purchase-entry.
bearerAuthorizationBearer <token>A company group API key (al_live_…, created at /dashboard/api), an OAuth access token from the same authorization flow MCP clients use, or (other LedgerSuite products, /administrations routes only) a LedgerSuite client_credentials token.
ledgerId*stringLedger (administration) id, from list-ledgers
1 <= lengthIdempotency-Key?stringUnique per write (e.g. your own id for it), at most 255 characters. A retry with the same key and body gets the first response again (header Idempotent-Replayed: true) instead of a second write; the same key with another body answers 422 idempotency_key_reused, and a retry while the first request still runs 409 idempotency_in_progress. Kept for 7 days.
length <= 255application/json- body
supplierId*stringSupplier contact id (con_…) from search-contacts, or the remoteId create-supplier just returned
1 <= lengthjournalCode*stringPurchase journal code
1 <= lengthinvoiceDate*stringInvoice date (YYYY-MM-DD)
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$datedueDate?stringDue date (YYYY-MM-DD); defaults from the payment term
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$dateinvoiceNumber?stringThe supplier's invoice number (Exact: Uw ref.)
1 <= length <= 255description?stringBooking description
length <= 255paymentTermCode?stringPayment term code; defaults from the supplier
1 <= lengthcurrency?stringISO 4217 currency; the ledger's base currency when omitted
^[A-Z]{3}$lines*array<>Booking lines
1 <= items <= 100document?The invoice (PDF), attached to the booking in the package
OK
application/json- response
created*booleanmessage*stringconfirmation*|nullentry*|nullcurl -X POST "https://example.com/ledgers/string/purchase-entries" \ -H "Content-Type: application/json" \ -d '{ "supplierId": "string", "journalCode": "string", "invoiceDate": "2019-08-24", "lines": [ { "ledgerAccount": "string", "amount": 0, "taxCategory": "nl_high" } ] }'{ "created": true, "message": "string", "confirmation": { "token": "string", "summary": "string", "expiresInSeconds": 0 }, "entry": { "ledgerId": "string", "remoteId": "string", "entryNumber": 0, "supplierName": "string", "invoiceNumber": "string", "currency": "string", "amountInclVat": 0, "documentId": "string" }}