Create Invoice
create_invoiceInvoice a sales order — the order page's Generate invoice. Bills every shipped unit not yet on an invoice (a draft counts), priced as the order lines are. Leaves a draft invoice by default; issue=true also issues it (numbers it, bills the order and sends it to connected accounting), like Save and confirm. The preview lists the lines and the totals after discounts and tax. Two-step: preview=true, then commit with the previewReceipt.
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": {
"salesOrderId": "<salesOrderId>"
},
"name": "create_invoice"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issue | No | false (default) leaves an editable draft; true also issues it (issue_invoice's effect). | |
| preview | No | Step 1 of the required two-step write: set true to validate and receive a structured preview plus a single-use previewReceipt. Nothing is written until the commit call. | |
| clientId | No | Optional client id (GUID) for operator (unpinned) credentials on 3PL tenants. | |
| salesOrderId | Yes | Sales order id (GUID) or number from get_sales_orders. | |
| idempotencyKey | No | Caller-generated idempotency key; required with previewReceipt to commit. | |
| previewReceipt | No | Step 2: the receipt returned by the preview call. Supply with a fresh idempotencyKey to commit. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| issued | No | ||
| number | No | ||
| status | No | ||
| preview | No | ||
| warnings | No | ||
| expiresAt | No | ||
| invoiceId | No | ||
| totalAmount | No | ||
| actionItemId | No | ||
| confirmation | No | ||
| documentKind | No | ||
| salesOrderId | No | ||
| correlationId | No | ||
| approvalResult | No | ||
| idempotencyKey | No | ||
| previewReceipt | No | ||
| approvalRequired | No | ||
| approvalRuleName | No | ||
| idempotentReplay | No | ||
| salesOrderNumber | No |