create_sales_document
Creates invoices, quotations, credit notes, order confirmations, delivery notes, or dunnings as drafts, with an option to finalize them when requested.
Instructions
Create an invoice, quotation, credit note or one of their relatives.
Writes to the account. One API call, never retried, so a failure that
might have gone through has to be checked with search_vouchers.
A draft can still be edited or deleted in the web app. finalize
issues it instead and the API cannot take that back. Set it only
when the user asked to issue the document, never on your own
initiative. It needs confirm too.
Each kind wants one thing of its own: shipping_date for an invoice,
order confirmation and delivery note, expiration_date for a
quotation, preceding_sales_voucher_id for a dunning.
Totals are added up by the API from the lines.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"document_type": "<document_type>",
"contact_id": "<contact_id>",
"voucher_date": "<voucher_date>",
"items": "<items>"
},
"name": "create_sales_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | The lines of the document. | |
| title | No | Heading. The account's default is used if unset. | |
| remark | No | Text below the lines. | |
| confirm | No | Required only for finalize. Ignored otherwise. | |
| currency | No | ISO currency code. | EUR |
| finalize | No | Issue it instead of drafting it. Only when the user asked for that. Needs confirm. | |
| tax_type | No | Whether the line prices are before or after tax. 'vatfree' is for a document that carries none. | net |
| contact_id | Yes | Who the document is for, by id from search_contacts. A one-time address is not supported: create the contact. | |
| introduction | No | Text above the lines. | |
| voucher_date | Yes | The date on the document, as YYYY-MM-DD. | |
| document_type | Yes | What to create. A down payment invoice cannot be created through the API at all. | |
| shipping_date | No | When it was delivered or performed, as YYYY-MM-DD. Required for an invoice, order confirmation and delivery note. | |
| expiration_date | No | How long a quotation stands, as YYYY-MM-DD. Required for one. | |
| preceding_sales_voucher_id | No | The finalized document this one follows, for example the quotation an invoice comes from. Required for a dunning. |