{
  "$schema": "https://unlockedcrm.ai/api/errors.json",
  "service": "unLocked CRM API",
  "base_url": "https://gzigyepfasiumngxilai.supabase.co/functions/v1",
  "media_type": "application/json",
  "html_errors": false,
  "envelope_example": {
    "error": {
      "code": "permission_denied",
      "message": "Permission denied for this resource or action.",
      "status": 403,
      "retryable": false,
      "resolution": "Request the scope named in error.required_scope and retry.",
      "required_scope": "write:leads",
      "request_id": "req_01J9ZC7Q2X5T",
      "docs_url": "https://unlockedcrm.ai/api#errors"
    }
  },
  "fields": {
    "code": "Stable machine-readable error code \u2014 branch on this.",
    "message": "Human-readable description; may change.",
    "status": "HTTP status repeated in the body.",
    "retryable": "Whether re-sending may succeed after a delay.",
    "resolution": "Actionable hint for fixing the error.",
    "required_scope": "Missing OAuth/API-key scope on 403.",
    "retry_after_seconds": "Delay before retrying on 429/503.",
    "details": "Array of {field, issue} for validation failures.",
    "request_id": "Correlation id for support.",
    "docs_url": "Documentation link for the code."
  },
  "codes": [
    {
      "code": "invalid_request",
      "http_status": 400,
      "meaning": "Request was malformed, missing a required parameter, or referenced an unknown resource.",
      "resolution": "Check the `resource` query parameter and required body fields, then retry.",
      "retryable": false
    },
    {
      "code": "validation_failed",
      "http_status": 422,
      "meaning": "One or more field values failed validation.",
      "resolution": "Read `error.details[]` for the offending fields and correct them before retrying.",
      "retryable": false
    },
    {
      "code": "unauthenticated",
      "http_status": 401,
      "meaning": "Missing, malformed, or expired credentials.",
      "resolution": "Send a valid `x-api-key` header or `Authorization: Bearer <jwt>` and retry.",
      "retryable": false
    },
    {
      "code": "permission_denied",
      "http_status": 403,
      "meaning": "The credentials are valid but lack the scope required for this operation.",
      "resolution": "Request the scope named in `error.required_scope` (see the scopes table) and retry.",
      "retryable": false
    },
    {
      "code": "not_found",
      "http_status": 404,
      "meaning": "The record or endpoint does not exist, or is outside the caller's workspace.",
      "resolution": "Verify the `id` and workspace, then retry. Do not retry with the same id.",
      "retryable": false
    },
    {
      "code": "conflict",
      "http_status": 409,
      "meaning": "The write conflicts with existing state (duplicate key, concurrent update).",
      "resolution": "Fetch the current record, merge, and retry once.",
      "retryable": false
    },
    {
      "code": "rate_limited",
      "http_status": 429,
      "meaning": "Rate limit exceeded (100 requests/minute per key).",
      "resolution": "Wait the number of seconds in the `Retry-After` header, then retry with backoff.",
      "retryable": true
    },
    {
      "code": "upstream_error",
      "http_status": 502,
      "meaning": "A downstream carrier or provider API failed.",
      "resolution": "Retryable. Retry with exponential backoff; if it persists, contact info@unlockedcrm.ai.",
      "retryable": true
    },
    {
      "code": "internal_error",
      "http_status": 500,
      "meaning": "Unexpected server error.",
      "resolution": "Retryable. Retry with exponential backoff and include `error.request_id` in any support request.",
      "retryable": true
    }
  ],
  "openapi": "https://unlockedcrm.ai/openapi.json",
  "docs": "https://unlockedcrm.ai/api.md"
}