Dashboard

Error Codes

Every error response carries the same envelope:

{
  "success": false,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "The provided API key is invalid or has been revoked.",
    "status": 401
  }
}

Match on error.code programmatically — error.message is for humans and may change between releases.

Authentication errors

CodeStatusMeaningFix
API_KEY_REQUIRED401No x-ansdev-key headerAdd the header to the request
INVALID_API_KEY401Key not found in our storeCheck for typos; revoke and rotate if leaked
API_KEY_EXPIRED401Key passed its expiresAtCreate a new key
INSUFFICIENT_SCOPE403Key lacks the required scopeRecreate the key with the right scope

Rate limiting

CodeStatusMeaning
RATE_LIMIT_EXCEEDED429Daily quota hit for this key

Example payload:

{
  "success": false,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Daily playback-token quota exceeded.",
    "status": 429,
    "retryAfter": 14400
  }
}

retryAfter is seconds until the next reset (also exposed as the Retry-After header).

Resource errors

CodeStatusMeaningFix
VIDEO_NOT_FOUND404Unknown videoId, or not owned by this keyVerify ID; confirm key holder owns it
PLAYBACK_TOKEN_EXPIRED401Token older than 5 minutesGenerate a fresh token server-side
PLAYBACK_TOKEN_INVALID401Token signature or videoId mismatchDon't reuse tokens across videos

Request errors

CodeStatusMeaning
BAD_REQUEST400Body failed schema validation
UNSUPPORTED_MEDIA_TYPE415Missing or wrong Content-Type
PAYLOAD_TOO_LARGE413Body exceeded the per-route limit

Example validation error:

{
  "success": false,
  "error": {
    "code": "BAD_REQUEST",
    "message": "body/name must be a non-empty string",
    "status": 400
  }
}

Server errors

CodeStatusMeaningWhat to do
INTERNAL_ERROR500Unexpected failureRetry with exponential backoff; report if persistent
SERVICE_UNAVAILABLE503Upstream service cold start or scalingRetry after a short delay
BAD_GATEWAY502Edge → origin failureRetry; if frequent, check status page

💡 Retry logic

Retry idempotent requests (GET, DELETE, PATCH) on 5xx and 429. Never auto-retry POST requests that create resources — wait for operator confirmation or use an idempotency key in your request body.

Troubleshooting checklist

  1. Is the header spelled right? x-ansdev-key (lowercase, hyphens).
  2. Is the key revoked? Check Dashboard → API Keys — revoked keys show as inactive.
  3. Does the key have the scope? A video:read key cannot access endpoints that require higher scopes.
  4. Are you using the right base URL? https://api.ansdev.cloud/v1, not api.ansdev.cloud (no /v1) — older docs showed the bare host.
  5. CORS errors in browser? Generate playback tokens server-side and pass the short-lived token to the Player SDK.