unauthorized error
unauthorized is returned with HTTP 401. Retryable: no. Sending the same request again returns the same error. Nothing is charged for this error.
What it means
The API key is missing, malformed, revoked or unknown.
Most likely cause
The request has no Authorization header, the key has a typo or a stray space or newline, the key was revoked in the dashboard, or the environment variable that holds it is empty in the process that sends the request.
How to fix it
Send a valid key in the Authorization header as "Bearer <key>". If the key was revoked, create a new one and retry.
Example
A request without a key is rejected with HTTP 401 and a WWW-Authenticate: Bearer header.
curl -i https://YOUR_API_HOST/v1/account
An error response is one JSON envelope. Branch on code, never on the message text. The message and fix of a real response can be more specific than the defaults shown here.
{
"error": {
"code": "unauthorized",
"message": "The API key is missing, malformed, revoked or unknown.",
"fix": "Send a valid key in the Authorization header as \"Bearer <key>\". If the key was revoked, create a new one and retry.",
"docs_url": "https://lookvalid.com/docs/errors/unauthorized",
"retryable": false,
"request_id": "req_3fK9pQ2xVb7LmN4sTz8WcA"
}
}
See also
- All error codes with the response envelope.
- Authentication.
- Quote the
request_idwhen you write to hello@lookvalid.com.