Error Handling, Idempotency, and Pagination
Error Envelope
Every error response uses a consistent JSON envelope: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-Keyreturns the original status code and JSON body without re-executing the write. - Reusing an
Idempotency-Keyfor a different payload or endpoint fails with409 idempotency_key_reused. - Interactive session routes (
/v1/auth/register,/v1/auth/login,/v1/auth/logout) do not requireIdempotency-Keybecause 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, unknownkid, or wrong tenantgrant_revoked_or_unknown(deny)grant_expired(deny)scope_mismatch(deny) —actionorresourcemismatchrecipient_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:1to100(default50)cursor: opaque cursor returned innextCursorfrom the previous response
nextCursor is omitted, you have reached the end of the collection.