Draft a sales invoice
invoice_draftMake or change a sales invoice draft. customer: the code of a customer; or new_customer: {code, name, line1, postcode, city, country, vat_number, email, language (en or de), buyer_reference, payment_terms_days} to create or update one with the draft. lines: [{description, quantity, unit_price, tax_code, account (optional: else the revenue account this tax code went to before, or the chart's), unit (UN/ECE code, default C62), item_code, order_line (the position in the customer's order, BT-132; an Austrian federal order number asks it on every line), discount (an amount off the line) or discount_percent (10 for 10 %)}]; amounts are text with a dot. amounts_are: exclusive (the default: unit prices without VAT), inclusive (unit prices with VAT; each rate's gross is kept to the cent) or no_tax (every line on the code for no VAT). A line with item_code (a product code, or any part of its code or name that fits one product) and quantity alone is enough: description, unit_price, tax_code and account come from the product, its price and its defaults; a customer whose VAT treatment charges none (not registered, export, reverse charge) keeps that treatment, and vat_reason says why in one line. A product not on the list yet: A product not on file yet is added to the product list with name, tax_code, account and unit_price, and then drafted by its item_code. The same idempotency_key again replaces the draft while it is a draft; invoice_id names a draft to change. Dates are YYYY-MM-DD and optional: the invoice date is the day of issue unless given. series: one of the company's invoice series; in its online series (template online_series) the invoice takes the shop's order number from order_reference (order 1042 is WEB-1042). currency: EUR, USD and so on for an invoice in another currency than the books' (a draft keeps the one it began in); it is booked at the day's rate and prints its VAT in the books' currency too. fx_rate: one unit of that currency in the books' (0.8591); the units to one of the books' (1.1640) is read too where the rate on file sets the two apart, not near parity or without one; rate_read in the answer says the rate as read. from_last=true with customer and no lines starts the draft from that customer's last invoice: its lines, references, notes, currency, series and payment terms, dated anew (the dates and lines given win). Round 794 (Xero's draft): a draft saves with what there is: no customer yet, no lines yet, or lines without a description, price, tax_code or account; the answer's missing names every gap in one list, and the issue asks for all of them. A draft is deleted with the invoice actions' what=delete. Past invoices (round 811): past: {invoice_no, document_id} for an invoice issued before the books came to Octobooks: invoice_no as printed on it (INV-003), document_id its file uploaded with kind sales_invoice, issue_date its date; the issue books it on that date with that number and file, draws no new PDF and sends nothing, and the series runs on after the highest number. server_name: the connector's name in this Claude for the panel page that comes with a draft while there is no panel (default Octobooks MCP). ai_checks: the checks the AI made of the draft through its own channels (mail, drive, warehouse system), shown on the panel's invoice sheet under Checked by: [{name, source, result}], name one of unit_price, warehouse, delivery, po, vat_rate, vat_number, email (discounts and special agreements), source the place looked at in one line (Warehouse log 21 Nov), result agrees, differs or not_checked; merged by name. With invoice_id and no lines it records the checks alone. Nothing in the books changes here.
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": {
"idempotency_key": "<idempotency_key>"
},
"name": "invoice_draft"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| past | No | ||
| lines | No | ||
| notes | No | ||
| series | No | ||
| company | No | ||
| fx_rate | No | ||
| project | No | ||
| currency | No | ||
| customer | No | ||
| due_date | No | ||
| language | No | ||
| ai_checks | No | ||
| from_last | No | ||
| ship_from | No | ||
| invoice_id | No | ||
| issue_date | No | ||
| amounts_are | No | ||
| server_name | No | ||
| skonto_days | No | ||
| supply_date | No | ||
| new_customer | No | ||
| skonto_percent | No | ||
| buyer_reference | No | ||
| idempotency_key | Yes | ||
| order_reference | No | ||
| delivery_address | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||