When it happens
- No
Authorizationheader. - Only an
X-API-Keyheader. Send the key asAuthorization: Bearer <key>instead. - A key in the query string, under any parameter name (
api_key,access_token,key,token, …). Such keys are rejected even when valid, and removed from our logs. - An unknown or malformed key.
- Your IP address is temporarily blocked: after 20 lookups of unknown keys from one address within a minute, requests from it get this error for 5 minutes, with a
Retry-Afterheader. A valid key that was used successfully within the last minute may still get through.
WWW-Authenticate header; for unknown and malformed keys it includes error="invalid_token". A blocked address’s 401 does not, because its key was not checked: do not discard a key because of it.
What to do
SendAuthorization: Bearer <key> with a current key. Do not retry automatically: a deployment that keeps retrying a wrong key can block every system behind the same egress address. See Authentication.
Example
Headers
Body