Skip to main content
Crivacy Docs

Error Codes

Last updated 2026-04-12

Error response format

All API errors follow a consistent JSON structure:

{
  "error": {
    "code": "invalid_api_key",
    "message": "The provided API key is not valid.",
    "details": {}
  }
}
FieldTypeDescription
error.codestringMachine-readable error code (use this for programmatic handling).
error.messagestringHuman-readable description of the error.
error.detailsobjectAdditional context. Contents vary by error code. May be empty.

Note: Always use the code field for error handling in your application, not the message field. Messages may change without notice; codes are stable.


Authentication errors

missing_api_key

HTTP status401 Unauthorized
DescriptionThe request did not include an x-api-key header.
How to handleAdd your API key to the x-api-key header on every request.
{
  "error": {
    "code": "missing_api_key",
    "message": "An API key is required. Include it in the x-api-key header.",
    "details": {}
  }
}

invalid_api_key

HTTP status401 Unauthorized
DescriptionThe API key does not match any active key. It may be mistyped, revoked, or expired.
How to handleVerify the key is correct and active in Dashboard > API Keys.
{
  "error": {
    "code": "invalid_api_key",
    "message": "The provided API key is not valid.",
    "details": {}
  }
}

insufficient_scope

HTTP status403 Forbidden
DescriptionThe API key is valid but does not have the scope required for this endpoint.
How to handleCreate a new key with the required scope, or update the existing key's scopes in the dashboard.
{
  "error": {
    "code": "insufficient_scope",
    "message": "This API key does not have the 'kyc:create' scope required for this endpoint.",
    "details": {
      "required_scope": "kyc:create",
      "key_scopes": ["kyc:read"]
    }
  }
}

invalid_session

HTTP status401 Unauthorized
DescriptionThe dashboard JWT session is invalid or has been revoked.
How to handleLog in again to obtain a new session token.
{
  "error": {
    "code": "invalid_session",
    "message": "Your session is invalid. Please log in again.",
    "details": {}
  }
}

expired_session

HTTP status401 Unauthorized
DescriptionThe dashboard JWT session has expired.
How to handleUse the refresh token endpoint or log in again.
{
  "error": {
    "code": "expired_session",
    "message": "Your session has expired. Please log in again.",
    "details": {}
  }
}

Validation errors

validation_error

HTTP status400 Bad Request
DescriptionThe request body failed schema validation. The details.issues array contains specific field-level errors.
How to handleFix the fields listed in the issues array and retry.
{
  "error": {
    "code": "validation_error",
    "message": "Request body validation failed.",
    "details": {
      "issues": [
        {
          "path": ["user_ref"],
          "code": "too_big",
          "message": "String must contain at most 128 character(s)",
          "maximum": 128
        },
        {
          "path": ["phase"],
          "code": "invalid_enum_value",
          "message": "Invalid enum value. Expected 'identity' | 'address', received 'id'",
          "options": ["identity", "address"]
        }
      ]
    }
  }
}

invalid_request

HTTP status400 Bad Request
DescriptionThe request is malformed (e.g., invalid JSON, wrong content type).
How to handleEnsure the request body is valid JSON and the Content-Type header is application/json.
{
  "error": {
    "code": "invalid_request",
    "message": "The request body is not valid JSON.",
    "details": {}
  }
}

Rate limiting errors

rate_limited

HTTP status429 Too Many Requests
DescriptionYou have exceeded the per-second rate limit for your tier.
How to handleWait for the number of seconds in retry_after_seconds, then retry. Implement exponential backoff.
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit exceeded. Please retry after the specified interval.",
    "details": {
      "limit": 30,
      "remaining": 0,
      "reset": "2026-04-12T12:00:05Z",
      "retry_after_seconds": 2
    }
  }
}

The response also includes rate limit headers:

X-RateLimit-Limit: 30
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1744459205
Retry-After: 2

quota_exceeded

HTTP status429 Too Many Requests
DescriptionYou have exhausted your monthly API request quota.
How to handleUpgrade your tier in Dashboard > Settings, or wait until your quota resets at the start of the next month.
{
  "error": {
    "code": "quota_exceeded",
    "message": "Monthly API quota exceeded. Upgrade your plan or wait for the next billing cycle.",
    "details": {
      "quota_limit": 100000,
      "quota_used": 100000,
      "reset_at": "2026-05-01T00:00:00Z",
      "retry_after_seconds": 1641600
    }
  }
}

The response also includes quota headers:

X-Quota-Limit: 100000
X-Quota-Remaining: 0
Retry-After: 1641600

Not found errors

not_found

HTTP status404 Not Found
DescriptionThe requested resource does not exist.
How to handleVerify the resource ID and that you are using the correct API key (test vs. live mode resources are isolated).
{
  "error": {
    "code": "not_found",
    "message": "The requested resource was not found.",
    "details": {}
  }
}

session_not_found

HTTP status404 Not Found
DescriptionThe specified KYC session does not exist or does not belong to your firm.
How to handleVerify the session ID. Sessions created with test keys are not visible with live keys and vice versa.
{
  "error": {
    "code": "session_not_found",
    "message": "KYC session 'ses_invalid123' was not found.",
    "details": {
      "session_id": "ses_invalid123"
    }
  }
}

credential_not_found

HTTP status404 Not Found
DescriptionNo credential exists for the specified user reference.
How to handleVerify the user reference. The user may not have completed verification yet, or the credential may belong to a different firm.
{
  "error": {
    "code": "credential_not_found",
    "message": "No credential found for user reference 'user_unknown'.",
    "details": {
      "user_ref": "user_unknown"
    }
  }
}

Server errors

internal_error

HTTP status500 Internal Server Error
DescriptionAn unexpected error occurred on the server.
How to handleRetry with exponential backoff. If the error persists, contact support with the request_id from the response headers.
{
  "error": {
    "code": "internal_error",
    "message": "An unexpected error occurred. Please try again later.",
    "details": {
      "request_id": "req_7k8l9m0n"
    }
  }
}

service_unavailable

HTTP status503 Service Unavailable
DescriptionThe service is temporarily unavailable due to maintenance or overload.
How to handleRetry after the interval specified in the Retry-After header. Check the status page for ongoing incidents.
{
  "error": {
    "code": "service_unavailable",
    "message": "The service is temporarily unavailable. Please try again later.",
    "details": {
      "retry_after_seconds": 60
    }
  }
}

Error code summary table

CodeHTTP StatusCategoryDescription
missing_api_key401AuthNo API key provided
invalid_api_key401AuthAPI key not recognized
insufficient_scope403AuthKey lacks required scope
invalid_session401AuthDashboard session invalid
expired_session401AuthDashboard session expired
validation_error400ValidationRequest body failed schema validation
invalid_request400ValidationMalformed request (bad JSON, wrong content type)
rate_limited429Rate limitingPer-second rate limit exceeded
quota_exceeded429Rate limitingMonthly quota exhausted
not_found404Not foundGeneric resource not found
session_not_found404Not foundKYC session not found
credential_not_found404Not foundCredential not found
internal_error500ServerUnexpected server error
service_unavailable503ServerTemporary service outage

Best practices for error handling

  1. Always check the HTTP status code first. 2xx means success, 4xx means client error (fix your request), 5xx means server error (retry).
  2. Parse the error.code field for programmatic branching, not the message.
  3. Implement exponential backoff for 429 and 5xx errors. Respect the Retry-After header when present.
  4. Log the request_id from 5xx responses. Include it when contacting support.
  5. Handle validation_error gracefully by iterating over details.issues and showing field-level feedback to your users or developers.

Next steps

Error Codes -- Crivacy Docs