expired_api_key
The message text is shown in the example below.
| HTTP status | 401 |
type | authentication_error |
| Retry? | No, not unchanged |
| Status | In the public catalog (error-envelope.ts) |
| Extra fields | none |
When it happens
The key had an expiry date and it has passed.
Example
{
"error": {
"type": "authentication_error",
"code": "expired_api_key",
"message": "This API key has passed its expiry date. Create a new one in Settings β API keys.",
"param": null,
"request_id": "req_6f1c2a9e0b7d4c3a8e5f1b2d"
}
}How to fix it
- Create a new key, and put a reminder in place before its expiry.
- For automation, consider workload identity, which needs no stored key at all.
Detect it in code
err = resp.json().get("error", {})
if resp.status_code == 401 and err.get("code") == "expired_api_key":
log.warning("%s (%s)", err["message"], err["request_id"]) # fix the request; do not retry unchangedRelated
Was this page helpful?