admin_key_required

The message text is shown in the example below.

⚠️
Preview — this feature is being built; the design below is the spec. Not in the public error catalog: planned for preview endpoints.
HTTP status403
typepermission_error
Retry?No, not unchanged
StatusPreview
Extra fieldsnone

When it happens

An inference key was used on an /v1/organizations/* endpoint.

Example

{
  "error": {
    "type": "permission_error",
    "code": "admin_key_required",
    "message": "This endpoint needs an Admin API key.",
    "param": null,
    "request_id": "req_6f1c2a9e0b7d4c3a8e5f1b2d"
  }
}

How to fix it

Detect it in code

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