Create invoice
create_invoiceCreates a new invoice from the given recipient, line items and discounts. Use it for a new invoice written from scratch; for a repeat of earlier work use create_invoice_from_previous. By default it creates a draft, which is free and can still be edited or deleted; a finalized invoice cannot be deleted. With isDraft=false it creates a finalized invoice and spends credits. Finalizing uses one free invoice if any remain, otherwise it deducts the per-invoice price from the credit balance. It fails when the balance is too low, and the charge is not refunded. invoiceDate and dueDate are written in the sender's date format, the dateFormat field of get_sender_settings (for example DD.MM.YYYY). A date that cannot be read as day, month and year in that format is rejected. The check goes no further: a date written in another format with the same separator is read in the expected order (03/04/2026 is 3 April in DD/MM/YYYY and 4 March in MM/DD/YYYY), a day past the end of its month rolls into the next one (31.02.2026 becomes 3 March), and a two-digit year is read as 19xx (26 is 1926). Left out, they default to today and today plus the payment terms; currency, VAT rate and style default from the sender settings, which must already exist. Line item prices take unitPrice (decimal, e.g. 110.00) or unitPriceCents (integer, e.g. 11000); VAT rates are basis points (1900 = 19%). Side effect: the recipient gets a customer record if none exists under that company name, created from the recipient details of the invoice, and the invoice is linked to it. An existing customer record is not changed. It does not email anyone. Each call creates another invoice, so repeating a call that succeeded leaves a duplicate.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dueDate | No | Due date in the sender's date format (dateFormat from get_sender_settings). Defaults to today + payment terms if omitted. | |
| isDraft | No | Create as draft (free, default) or final (charges credits) | |
| currency | No | Currency code (e.g. EUR, USD). Defaults to sender settings currency if omitted. | |
| discounts | No | Invoice-level discounts | |
| lineItems | No | Invoice line items | |
| vatRateBps | No | Default VAT rate in basis points (e.g. 1900 = 19%). Defaults to sender settings if omitted. | |
| invoiceDate | No | Invoice date in the sender's date format (dateFormat from get_sender_settings, e.g. 31.12.2026 for DD.MM.YYYY). Defaults to today if omitted. | |
| invoiceNote | No | Note/footer text for the invoice | |
| invoiceStyle | No | Invoice PDF style. Defaults to sender settings if omitted. | |
| invoiceNumber | No | Invoice number | |
| recipientCity | No | Recipient city | |
| shippingCents | No | Shipping cost in minor units | |
| buyerReference | No | Buyer reference / PO number | |
| recipientEmail | No | Recipient email | |
| recipientState | No | Recipient state/province | |
| recipientVatId | No | Recipient VAT ID | |
| recipientStreet | No | Recipient street address | |
| recipientCountry | No | Recipient country ISO code (e.g. DE, US) | |
| recipientPostalCode | No | Recipient postal code | |
| recipientCompanyName | No | Recipient company name | |
| recipientAddressLine2 | No | Recipient address line 2 |