Create Sales Invoice
POST/api/sales-invoices
Create a sales invoice for a sales order — as a draft, or issued straight away with issue: true (issuing also needs the sales_invoices.issue permission).
orders:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Body
sales_order_id(integer, required)source(required):shipments(bill the listedfulfillment_ids),lines(bill the listedlines),remaining(everything still billable),deposit(a deposit invoice billed up front; needsdeposit_amountordeposit_percent)fulfillment_ids[](integers, required when source=shipments)lines[]: product lines{sales_order_line_id, quantity}(quantity ≥ 0, ≤ what is billable) and fee lines{financial_line_id, amount}(≤ the fee's uninvoiced amount)deposit_amount(number > 0, for source=deposit): the deposit in the order's currency, at most the order's uninvoiced totaldeposit_percent(number, greater than 0 and at most 100, for source=deposit): the deposit as a percentage of the order's uninvoiced total; used instead ofdeposit_amountinvoice_date(Y-m-d, optional; must be in an open accounting period)payment_term_id(optional; defaults to the order's term)due_date(Y-m-d, optional manual override, not before invoice_date)notes,terms_text(printed on the PDF, optional)issue(boolean, default false)invoice_ahead(boolean, default false): bill units a per-shipment order has not shipped yet; needs thesales_invoices.invoice_aheadpermission
Over-billing is refused per line, e.g. "Quantity 40 exceeds 36 shipped and uninvoiced for ZS-HBK-RED." An empty invoice is refused with "Add at least one line with a quantity." Invoice numbers are assigned when the invoice is issued.
Deposits: a deposit invoice (kind deposit) carries one line, Deposit 30% on SO-10482 (or Deposit on SO-10482 for a fixed amount). Once it is issued, every later invoice on the order gets a negative Less deposit line that deducts it, until the deposit is used up. Deposits are available on orders invoiced per shipment or manually — not on per-order or consolidated orders (see supports_deposit on Get Sales Order Invoice Preview).
Requires the orders:write scope and the sales_invoices.create permission.
Request
Responses
- 201
- 401
- 403
- 422
- 429
Created
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Unprocessable Content
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.