create_ar_invoice
Create an outgoing (sales) invoice as a draft — nothing is booked yet (accountant role).
A draft changes no ledger balance, gets no invoice number and appears in no VAT
return; it exists so it can be edited. Posting happens later, at
POST …/ar/invoices/{invoice_id}/issue.
Body: issue_date (required), counterparty_id (the customer — required
before it can be issued), currency/language, due_date (filled from the
customer's payment terms when omitted), doc_type (invoice, the default — a
credit_note draft can never be issued: credit an issued invoice with
POST …/ar/invoices/{invoice_id}/credit-note instead), and lines: each line
carries quantity, unit_price, a revenue account_code and a
vat_code_id (the id from GET …/gl/vat-codes; a line without one declares no
VAT). Totals, per-line net/VAT/gross and discounts are computed server-side — do
not send them.
Returns the created invoice with its lines and computed totals. Check
GET …/ar/invoices/{invoice_id}/readiness for what still blocks issuing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | No | ||
| notes | No | ||
| currency | No | CHF | |
| doc_type | No | invoice | |
| due_date | No | ||
| language | No | ||
| company_id | Yes | ||
| issue_date | Yes | ||
| legal_text | No | ||
| footer_text | No | ||
| counterparty_id | No | ||
| payment_terms_id | No | ||
| issuer_profile_id | No | ||
| service_period_end | No | ||
| credited_invoice_id | No | ||
| service_period_start | No | ||
| invoice_discount_kind | No | none | |
| invoice_discount_value | No | 0 |