Skip to main content
When a request fails, the API returns a non-2xx HTTP status and a JSON body wrapping a single error object. The API does not use the RFC 9457 application/problem+json shape — it returns the envelope below with Content-Type: application/json.

Error envelope

The documentation_url is emitted for the authentication and request-level error codes (the Status codes table below). Some specialized surfaces — feature-gated endpoints and the events replay endpoint — return their own error shapes documented under Feature-gated and endpoint-specific errors. In every case, branch on code, never on the HTTP status or message alone.

Status codes

Each row’s code is also a section anchor on this page, so https://docs.alterscope.org/errors/<code> deep-links here.

Rate-limit responses

A 429 from the per-minute limiter additionally sets:
The error.code is rate_limit_exceeded. Wait for the Retry-After period (seconds) before retrying. The X-RateLimit-Limit / X-RateLimit-Remaining / X-RateLimit-Reset headers are returned on every response, not just 429s, so you can pace yourself before you hit the limit. See Rate limits for per-tier limits.

Feature-gated and endpoint-specific errors

A few endpoints enforce plan tiers, monthly quotas, or a tier-scoped data window. These return codes specific to the endpoint. They are not general status codes — only the listed endpoints emit them.

Plan-gated and quota codes

These appear on the exit Monte Carlo (/v2/liquidity/{id}/exit-monte-carlo) and simulator (/v2/simulator/...) endpoints.
The plan-gated and quota codes use UPPER_SNAKE_CASE and carry context in details (for example details.required_plans, details.limit, details.upgrade_url). They do not set documentation_url. Tier names are always one of Free / Analyst / Team / Enterprise / Custom — see Rate limits for per-tier limits.

Events replay errors

The events replay endpoint (GET /v2/events/replay) enforces a tier-scoped replay window. Its error body is a flat shape — {"error": "<CODE>", "message": "…", "details": { … }} — rather than the nested error.code envelope above. Branch on the top-level error string.

Idempotency in-flight (409)

Endpoints protected by idempotency accept an X-Idempotency-Key header. If a request with the same key is still being processed by another worker, the API responds with 409 Conflict and a Retry-After: 1 header. The body is a flat {"error": "duplicate request in flight; retry after a brief delay"}.
  • A replay of a completed request (same key, within the cache window) returns the original cached response with an X-Idempotency-Replayed: true header — not a 409.
  • An in-flight duplicate returns the 409 above. Wait the Retry-After interval, then retry with the same key.
See Idempotency for the full contract.

Retry guidance

  • 429 — back off for the Retry-After interval, then retry. For idempotent writes, reuse the same X-Idempotency-Key.
  • 500 and other 5xx (including 503 unavailable / risk_dependency_unavailable) — retry with exponential backoff and a capped number of attempts.
  • 400, 401, 403, 404 — do not retry blindly; fix the request, key, scope, or path first.
  • 409 — for an idempotency in-flight conflict, retry after the short Retry-After. For a resource conflict, reconcile state before retrying.
Always log request_id (or the X-Request-ID header) so support can trace a specific failed call.