API error

unauthorized

HTTP 401 · no credit is used for a request that ends in an error.

No API key was sent, or the key is not valid: unknown, revoked, expired or replaced by a roll.

What to do

Send a current key as Authorization: Bearer <key> (or X-Api-Key). Create a new key in the dashboard if needed.

Retry

No: fix the request. When and how often to retry any error: retrying safely.

The answer

{
  "error": {
    "code": "unauthorized",
    "message": "A valid API key or session is required.",
    "request_id": "req_7Hq2LmX9cV4bN8tR1zK6wD"
  }
}

No API key sent:

{
  "error": {
    "code": "unauthorized",
    "message": "Send your API key in the Authorization header: Bearer <key>.",
    "request_id": "req_7Hq2LmX9cV4bN8tR1zK6wD"
  }
}

API key not valid:

{
  "error": {
    "code": "unauthorized",
    "message": "The API key is not valid.",
    "request_id": "req_7Hq2LmX9cV4bN8tR1zK6wD"
  }
}

Branch on code, which is stable; message is for people and may change. Keep request_id in your logs.

Headers that come with it:

  • X-Request-Id: Our ID for the request (same as request_id in bodies).
  • WWW-Authenticate: The authentication scheme and the OAuth protected resource metadata (RFC 9728; /mcp answers with WwwAuthenticateMcp). When a key or access token was sent and refused, the challenge also carries error="invalid_token", as in the example.

Endpoints that can answer it

More

Updated · Maintained by: Email Validation LLC

Need help? Contact support, or ask the help chat. Something wrong or missing on this page? Tell us