ResourcesAPI ReferenceAPI Conventions
API Reference

API Conventions

Response envelope format, pagination, money & time conventions, rate limiting, idempotency keys, and error codes.

API Conventions

These conventions apply uniformly to every endpoint in the server-to-server API (/api/v1).


Response envelope

ScenarioShape
Success — single resource{ "data": { ... } }
Success — paginated list{ "data": [ ... ], "meta": { ... } }
Failure{ "code": "business_code", "message": "human-readable", "data": null }

Pagination

All list endpoints accept the following query parameters:

QueryTypeDefaultBounds
pageint1≥ 1
per_pageint25 (orders & transactions: 50)1–100

meta shape:

{ "current_page": 1, "last_page": 8, "per_page": 25, "total": 192 }

Money & time

  • Money: always a decimal string (e.g. "100.00") paired with a currency code (e.g. "USD"). Never use floating-point arithmetic when processing amounts.
  • Time: UTC, ISO 8601 (e.g. 2026-06-08T01:00:00+00:00).

Rate limiting

Two-axis throttle:

  • Each token has its own per-minute ceiling (rate_limit_per_minute), configured when the token is created.
  • Each IP has a coarser cross-token ceiling (default 600 req/min).

Successful responses carry:

  • X-RateLimit-Limit — the token's per-minute ceiling
  • X-RateLimit-Remaining — remaining requests in the current window

Exceeding the limit returns 429 api.rate_limited with a Retry-After: <seconds> header. Back off exactly by that duration.


Idempotency

All write endpoints accept an optional X-Idempotency-Key header (≤ 200 chars).

ScenarioBehaviour
First request with a given keyExecutes and stores the response
Replay: same key + same body (within 24 h)Returns original result with Idempotent-Replayed: true; no side effects
Same key + different body422 api.idempotency_key_conflict
Key exceeds 200 chars422 api.idempotency_key_invalid
5xx responseNot stored — safe to retry

Strongly recommended: send a unique X-Idempotency-Key on every write (e.g. your own order ID). This prevents double-charge or double-issue when the network retries a request.


Error code reference

HTTPCodeMeaning
401api.unauthenticatedToken missing / invalid / expired / disabled
403api.ip_not_allowedCalling IP not in the token allowlist
403api.insufficient_abilityToken lacks the ability this endpoint requires
403api.workspace_inactiveThe owning workspace is not active
402wallet.insufficient_balanceInsufficient wallet balance (issue / top-up)
404*.not_foundResource not found in this workspace (e.g. card.not_found, order.not_found)
409(state conflict)The resource's current state forbids the action (e.g. double freeze)
422api.idempotency_key_invalidIdempotency key too long
422api.idempotency_key_conflictIdempotency key reused with a different body
422(validation)Request parameters or business rules failed
429api.rate_limitedRate limit exceeded; back off per Retry-After