Create an invoice, or update the one with the same externalId (or displayId) in the channel

type charge or refund (amounts are magnitudes either way). order and customer by { id } or { externalId } in the channel; a line names the order line it bills (orderLineId, externalLineId, product) or is a custom line. Totals are recomputed: a mismatch is 422 totals_mismatch with the computed values; a charge invoice may not exceed its order. onDuplicate (default update): update applies the sent fields (outcome unchanged when nothing differs), skip answers the stored invoice, error is 409. A money change on an invoice that carries payments is 409 state_conflict. Unknown fields are refused (400).

Scope: invoices:write, channel:write or admin. A permission group made before the Channel API scopes existed grants it as invoices:manage.

Idempotency: send Idempotency-Key; a retry with the same key replays the first answer.

Rate limit: write class, 1,200 requests per minute per tenant by default (read class 6,000). Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; a refusal is 429 rate_limited with Retry-After.

Body Params
string
^(?:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}|[0-9a-fA-F]{24})$

Sales channel id: a uuid, or a legacy 24-hex id.

string
length between 1 and 255

The integration's own id for the document, unique within its channel.

string
length between 1 and 100

The channel's invoice number: the invoice's displayId.

string
length between 1 and 500
date-time

ISO-8601, UTC.

enum
required
order
object
customer
object
billTo
object
items
array of objects
length ≤ 1000
items
totals
object
required

Magnitudes (a refund sends positive amounts). A refund component (shipping, salesTax, dutyTax, vat) the refund charges instead of returning is negative; a charge invoice sends no negative amount (400 validation_failed). Recomputed by the server: subtotal from the lines (when there are lines), total from subtotal + shipping + salesTax + dutyTax + vat - discount. A mismatch is 422 totals_mismatch with the computed values.

discounts
array of objects
length ≤ 50
discounts
taxLines
array of objects
length ≤ 50
taxLines
^[0-9]{4}-[0-9]{2}-[0-9]{2}$

YYYY-MM-DD (anchored at 12:00 UTC) or an ISO-8601 timestamp.


A date: stored at 12:00 UTC.

string
length between 1 and 100
tags
array of strings
length ≤ 50
tags
metadata
object

Keys 1 to 100 characters, values up to 1000.

string
length ≤ 10000
integer
0 to 4

Line allocation rounding in places of hundredths of the currency unit; default 0.

enum

What a POST does when the document already exists. Default 'update' (D7).

Headers
string
length between 7 and 50

Any string of 7 to 50 characters that identifies this request (an order number, a webhook id). A retry with the same key and the same body answers the first result with Idempotent-Replayed: true; the same key with a different body is 422 idempotency_key_reused; a concurrent request with the same key is 409 in_progress with Retry-After. Recommended on every write.

Responses

Language
Credentials
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json