Skip to main content

Error Handling, Idempotency, and Pagination

Error Envelope

Every error response uses a consistent JSON envelope:
Clients should branch programmatically on error.code and display error.message for diagnostics only.

Idempotency Semantics

All state-changing resource endpoints (POST /v1/organisations, POST /v1/api-keys, POST /v1/agents, PATCH /v1/agents/:id, wallets, credentials, events, authorizations, verify, revoke, and financial instructions/reconcile) require an Idempotency-Key header.
  • Attexra hashes (method, route, requestBody) and binds it to (scope, key_hash) in PostgreSQL.
  • Retrying the exact same request with the same Idempotency-Key returns the original status code and JSON body without re-executing the write.
  • Reusing an Idempotency-Key for a different payload or endpoint fails with 409 idempotency_key_reused.
  • Interactive session routes (/v1/auth/register, /v1/auth/login, /v1/auth/logout) do not require Idempotency-Key because they manage session cookies.

Deterministic Authorization Reason Codes

POST /v1/authorizations/verify evaluates grants deny-by-default and returns HTTP 200 with an auditable decisionId, outcome (allow, deny, require_approval, or indeterminate), and reasonCode:
  • within_scope (allow)
  • approval_required (require_approval)
  • invalid_grant (deny) — invalid signature, unknown kid, or wrong tenant
  • grant_revoked_or_unknown (deny)
  • grant_expired (deny)
  • scope_mismatch (deny) — action or resource mismatch
  • recipient_mismatch (deny)
  • asset_mismatch (deny)
  • invalid_amount / amount_exceeds_limit (deny)

Cursor Pagination

Collection endpoints (GET /v1/agents, GET /v1/agents/:id/events, GET /v1/events, GET /v1/authorizations, GET /v1/authorizations/decisions, GET /v1/financial/instructions, GET /v1/api-keys) accept:
  • limit: 1 to 100 (default 50)
  • cursor: opaque cursor returned in nextCursor from the previous response
When nextCursor is omitted, you have reached the end of the collection.