Skip to main content
POST

Authorizations

Authorization
string
header
required

API key authentication. Send your raw API key as the Authorization header value with NO scheme prefix — Authorization: YOUR-API-KEY. Do NOT prefix it with Bearer or ApiKey, and do not use an X-API-Key header; those are not accepted.

Headers

If-Match
string<uuid>
required

The invoice's current headJournalId — the optimistic-concurrency watermark every single-invoice write after creation must send. Read it off any invoice read or write response and echo it verbatim (a bare uuid; an entity-tag dressing of it — "uuid" or W/"uuid" — is also accepted). Missing or malformed is a 400 (IF_MATCH_REQUIRED / IF_MATCH_INVALID); a stale value is a 409 IF_MATCH_CONFLICT whose body carries the current invoice. An idempotent actionId replay short-circuits BEFORE the watermark is evaluated.

Path Parameters

companyId
string<uuid>
required

Company identifier

invoiceId
string<uuid>
required

Invoice identifier

Body

application/json
actionId
string<uuid>
required

Client-minted idempotency key — becomes the FIRST created mark's journal id (sibling marks mint their own). An identical retry replays the original outcome (the created paymentIds included); reuse with a different payload is 409 ACTION_ID_REUSED

paymentDate
string<date>
required

The payment date, stamped on every created mark (ISO YYYY-MM-DD); must not be in the future

author
string

Optional display label for the source system's author (e.g. the integrator-side user). Stamped as the journal record's display attribution; the acting principal stays the External API service user, so a label can never impersonate an in-app user. Ignored on idempotent replays

Required string length: 1 - 255
payBalanceDue
enum<boolean>

Settle the WHOLE document: one mark per open line item at that line's full remaining, both directions at once, so the gesture's net cash equals balanceDueCents. Only the literal true is accepted. Mutually exclusive with allocations — send exactly one of the two

Available options:
true
allocations
object[]

Explicit per-line marks — exactly the line items named, for exactly the cents named; nothing is spread onto an unnamed line. Mutually exclusive with payBalanceDue — send exactly one of the two. Each lineItemId may appear at most once

Minimum array length: 1
memo
string

Free-text memo, stamped on every created mark

erodeReserves
boolean

REQUIRED on a reserved-category invoice — whether the created marks erode the linked event's reserves; must be OMITTED on an operating-category invoice. No headroom bound applies: the remaining reserve is a signed balance and may cross zero

Response

The refreshed invoice state plus the created MARK rows: paymentIds are the server-minted removal handles in mark order, and createdPayments the full mark rows they name (each also present in the refreshed payments)

The response of every single-invoice write — refreshed read state, not an ack: the emitted journal id(s), THE invoice row (identical shape to the reads — one invoice representation everywhere; its headJournalId is the next If-Match), and the invoice's live payments. An idempotent actionId replay returns this same shape rebuilt from the original outcome, server-minted values included.

journalIds
string<uuid>[]
required

Every journal id the write emitted — the anchor action's id (the actionId you supplied) first, then any engine-minted siblings (a multi-mark payment's additional marks) and any companion the horizon rule composed (e.g. the reserve unwind of a pre-horizon eroding payment's removal, or a delete's payment sweep)

Minimum array length: 1
invoice
object
required

THE invoice representation — the same shape everywhere an endpoint returns an invoice (listing rows, the detail read, and every write's refreshed-row response). headJournalId is the invoice's current journal head — the optimistic-concurrency token subsequent writes echo back as If-Match.

payments
object[]
required

The invoice's live payment marks after the write, newest first

paymentIds
string<uuid>[]
required

The created marks' server-minted ids, in mark order (the request's allocations order, or line-item order under payBalanceDue) — each the handle for DELETE …/payments/{paymentId}

createdPayments
object[]
required

The created mark rows, in mark order