API reference
Add an invoice
/ api/ v1/ invoicesAdds a payable or a receivable, checked by the rules of the console's invoice form, and recorded in the ledger as create_invoice with via: "api" and the key's id. It is added as the key's issuer's: if the agent holds it, the issuer cannot approve it, unless they are the workspace's only approver.
The agent decides a payable as one typed in, with every guardrail and the workspace's limits, usually within a minute. The API never approves or pays. A counterpartyId the workspace does not hold, including another workspace's, answers 400.
Send a workspace API key with read and write access as Authorization: Bearer …. A read-only key gets 403.
Parameters
Idempotency-Keystringoptionalin: headerMakes a retry safe: up to 255 printable ASCII characters, unique to the record being added, such as its id in your own system. A repeat with the same key and the same body within 24 hours gets the first answer back, with
Idempotent-Replayed: true, and adds nothing. The same key with a different body answers409.
Request body
Example{
"counterpartyId": "6b361405-cfda-4400-a286-364b561911ce",
"amount": "0.10",
"dueDate": "2026-10-03",
"poReference": "PO-API-1",
"goodsReceived": true
}directionstring · optionalpayable, a bill the business pays, which is the default, orreceivable, one it is owed.One of
payablereceivablecounterpartyIdstringThe counterparty's
id, fromGET /api/v1/counterpartiesor from the answer that added it.amountstring | numberWhat it bills, in
currency, with at most 6 decimal places. A decimal string such as"1250.50"keeps it exact; a number is read the same way.currencystring · optionalUSDC, the default, orEURC.One of
USDCEURCdueDatestringThe day it is due, as
YYYY-MM-DD.memostring · optionalWhat it is for, up to 280 characters.
poReferencestring · optionalThe purchase order it bills against, up to 100 characters.
goodsReceivedboolean · optionalWhether what it bills for has arrived. Defaults to
false. Without it, or withoutpoReference, the agent asks for the missing detail instead of paying.earlyPayDiscountobject · optionalA discount for paying by
deadline. The agent weighs it against what the cash would earn in the reserve untildueDate.2 fields in earlyPayDiscount
percentstring | numberThe percent off, greater than 0 and less than 100, with at most 2 decimal places.
deadlinestringThe last day it applies, as
YYYY-MM-DD, on or beforedueDate.
Try it
Try it is off for operations that add records: run the sample with your own key.
Code samples
curl "https://www.vestiarion.xyz/api/v1/invoices" \
-X POST \
-H "Authorization: Bearer $VESTIARION_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: billing-inv-2026-0042" \
-d '{"counterpartyId":"6b361405-cfda-4400-a286-364b561911ce","amount":"0.10","dueDate":"2026-10-03","poReference":"PO-API-1","goodsReceived":true}'Response
Example{
"data": {
"id": "1f96fd0b-71de-41bf-b088-779655ea6df4",
"direction": "payable",
"status": "pending",
"amount": 0.1,
"currency": "USDC",
"memo": null,
"poReference": "PO-API-1",
"goodsReceived": true,
"dueDate": "2026-10-03T12:00:00+00:00",
"scheduledFor": null,
"earlyPayDiscount": null,
"decidedAt": null,
"settledAt": null,
"escalatedAt": null,
"agentReasoning": null,
"txHash": null,
"paidAmount": null,
"counterparty": {
"id": "6b361405-cfda-4400-a286-364b561911ce",
"name": "API Test Vendor",
"riskLevel": "clear"
},
"createdAt": "2026-10-03T10:16:16.374931+00:00"
}
}dataobjectAn invoice in the payable or receivable book, with the agent's reasoning.
19 fields in data
idstringdirectionstringOne of
payablereceivablestatusstringamountnumbercurrencystringUSDC or EURC: what
amountis in, and what a payable is paid in. A EURC payable is checked against the counterparty's USDC limit at a quoted rate.memostring · nullablepoReferencestring · nullablegoodsReceivedbooleandueDatestringscheduledForstring · nullableISO timestamp the agent has committed to pay this on, once scheduled; else null.
earlyPayDiscountobject · nullableThe early-payment discount this invoice carries, if any: the percent off and the deadline's ISO timestamp.
2 fields in earlyPayDiscount
percentnumberdeadlinestring
decidedAtstring · nullablesettledAtstring · nullableescalatedAtstring · nullableagentReasoningstring · nullableWhy the agent ruled as it did, verbatim from the decision.
txHashstring · nullableAn on-chain hash once the payment settled, else null: on Arc testnet, or for a payout from a Gateway balance the mint on the payee's chain.
paidAmountnumber · nullableWhat actually left once this invoice was paid; null otherwise, even while a submitted transfer already carries an amount.
counterpartyobject · nullable3 fields in counterparty
idstringnamestringriskLevelstring
createdAtstring
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | An invalid limit or cursor, a filter value outside its allowed values, or a request body that does not validate. The message names the parameter or the field, and lists the accepted values. |
| 401 | unauthorized | No key, or a malformed, unknown or revoked one: "A valid API key is required." |
| 403 | forbidden | The key's scopes do not cover this route: "This key cannot do that." Or, on a write, the person who created the key can no longer add records: "This key's issuer can no longer add records in this workspace." |
| 409 | conflict | The Idempotency-Key was already used for a different request, or the first request with it is still being handled. |
| 429 | rate_limited | Too many requests; wait as long as Retry-After says before trying again. |
| 500 | internal | An unexpected server error. Implementation details are not exposed. |