unauthorized
  1. Docs
  2. Errors
  3. unauthorized

unauthorized

The x-api-key header is missing or not a valid key.

Response

Every failure uses this envelope. credits_charged is 0. The message below is the default text for this code. Live messages can change, so branch on error.code.

SampleHTTP 401
1{2  "ok": false,3  "error": {4    "code": "unauthorized",5    "message": "The x-api-key header is missing or not a valid key.",6    "retryable": false7  },8  "credits_charged": 0,9  "request_id": "req_0123456789abcdef01234567"10}

error.retryable is false. The same request fails the same way.

What to do

  • Send the key in x-api-key. See authentication.
  • Do not retry until the header is a live key.

The response header x-request-id matches request_id. The full list is on errors.