revoked_api_key

The message text is shown in the example below.

HTTP status401
typeauthentication_error
Retry?No, not unchanged
StatusIn the public catalog (error-envelope.ts)
Extra fieldsnone

When it happens

Someone revoked the key, from the Console or with an Admin key.

Example

{
  "error": {
    "type": "authentication_error",
    "code": "revoked_api_key",
    "message": "This API key was revoked. Create a new one in Settings β†’ API keys.",
    "param": null,
    "request_id": "req_6f1c2a9e0b7d4c3a8e5f1b2d"
  }
}

How to fix it

  • Create a new key and replace it in your secrets store.
  • Check the audit feed for api_key.revoked to see who revoked it and why.

Detect it in code

err = resp.json().get("error", {})
if resp.status_code == 401 and err.get("code") == "revoked_api_key":
    log.warning("%s (%s)", err["message"], err["request_id"])  # fix the request; do not retry unchanged
Was this page helpful?