Errors
Stable string codes you can branch on. HTTP status carries the severity; code carries the contract.
Error envelope
{
"code": "validation.invalid_value",
"message": "place_of_supply must be a valid GST state code.",
"field": "place_of_supply",
"details": { "received": "INKA" }
}
Errors are flat — no nested error wrapper. Branch on code, show message to humans, use field + details for form validation.
Errors raised by a route also carry a request_id (the same value as the X-Request-Id response header), which support asks for. The two middleware layers that run before a route, idempotency and rate limiting, answer with just code and message: those bodies have no request_id, so for them log the response headers and the time of the call instead.
Auth errors
| Code | HTTP | Meaning |
|---|
auth.missing_token | 401 | No Authorization header. |
auth.invalid_token | 401 | Token unknown or malformed. |
auth.revoked_token | 401 | Token was explicitly revoked. |
auth.expired_token | 401 | Token past its expires_at. |
auth.insufficient_scope | 403 | Token lacks the required scope. |
auth.org_mismatch | 403 | ?organization_id disagrees with single-org token. |
auth.missing_organization_id | 400 | Multi-org token needs ?organization_id. |
auth.no_membership | 403 | User has no active membership in that org. |
Validation errors
| Code | HTTP | Meaning |
|---|
validation.required_field | 400 | A required field is missing. |
validation.invalid_value | 400 | Wrong type or out of range. Also returned when an allocation exceeds the payment's unapplied balance or the target's outstanding balance — see Allocating payments. details carries the numbers to retry with. |
validation.failed | 422 | Body or query parameters failed schema. |
validation.duplicate_resource | 409 | The anti-duplicate guard refused a create (invoice or payment with the same contact, date, amount and reference). details names the existing record. Change the reference, or retry with the same Idempotency-Key to get the original response. |
Resource errors
| Code | HTTP | Meaning |
|---|
not_found.resource | 404 | Resource doesn't exist in this org. |
conflict.idempotency_key_reused | 409 | The fallback code for a 409 raised with a plain text message and no code of its own. Despite the name it does not prove a key was reused: read message for the actual conflict. A reused Idempotency-Key with a different body replays the original response instead. |
period.locked | 409 | The document date falls in a closed accounting period, so nothing was written. A soft-closed period also refuses API tokens: only an Owner or Admin signed in to the app can post into it. details carries the period (id, short_code, name, status), the date and soft_closed. Reopen the period in the app, or date the entry in an open period. |
bill.delete_refused | 409 | The bill cannot be deleted. details.reason is posted, has_payments, asset_linked, stock_consumed (with details.blockers[]) or cancelled: a cancelled bill is kept on record and cannot be deleted. See Bills. |
rate_limit.exceeded | 429 | Per-token rate limit hit. Retry-After header set. No request_id in the body. |
Idempotency errors
See Idempotency. The first is raised by the route; the other two by the idempotency middleware, so their bodies carry no request_id.
| Code | HTTP | Meaning |
|---|
idempotency.key_required | 400 | The endpoint moves money or creates a document and needs an Idempotency-Key header. Send a unique key per logical operation and the same key on every retry. |
idempotency.invalid_key | 400 | The key is longer than 200 characters or has characters other than letters, digits, -, _ and :. |
idempotency.in_flight | 409 | Another request with this key is still running. Wait for Retry-After (2 seconds) and retry with the same key. |
Period and credit/debit note void errors
A void posts a reversal and never deletes the original entry, so these refusals leave the books exactly as they were.
| Code | HTTP | Meaning |
|---|
period.locked | 409 | Also returned when the void's reversal date falls in a closed period. Pass a void_date in an open period. |
note.gst_period_filed | 409 | The note's GSTR-1 (GSTR-3B, for its period or a later one, for a vendor-side note) is recorded as filed, so it was reported and cannot be voided, whatever you send. Customer side, issue the counter-document instead: a debit note against the original invoice for a credit note (s.34(3)), a credit note for a debit note (s.34(1)), or amend it in Table 9C of a later GSTR-1. Vendor side, record the supplier's counter-note in the current period and adjust ITC in GSTR-3B Table 4. details.reason_code is GSTR1_FILED or GSTR3B_FILED. |
note.gst_lock_override_required | 409 | The return is past its due date (GSTR-1: the 11th, QRMP the 13th; GSTR-3B for a vendor-side note: the 20th, QRMP the 22nd) but not recorded as filed. Retry with unlock: true, unlock_reason (10 or more characters) and confirm_not_reported: true. Only a token whose user is an Owner or Admin may do this; the override is audited. Without it, issue the counter-document. |
note.invoice_balance_insufficient | 409 | Debit note void: a receipt has already consumed the invoice balance the note added. details carries invoice_balance, note_total and shortfall. Unallocate the receipt from the invoice, or issue a credit note. |
note.stock_consumed | 409 | Credit note void: the goods it took back into stock have already been sold or adjusted. details.blockers[] lists each item with item_id, location, returned, on_hand and shortfall. Reverse those movements first, or issue a debit note. |
validation.invalid_value | 422 / 409 | On a note void: void_date earlier than the note's own date is a 422 with field: void_date; a note that has been applied is a 409. |
Server errors
| Code | HTTP | Meaning |
|---|
server.internal_error | 500 | Unexpected failure. Retry; if it persists, send support the X-Request-Id (the body carries the same request_id). A sandbox token (aibk_pat_test_) also gets the exception class and the tail of the traceback in details. |