Skip to content
Docs

Authentication

Unauthorized and forbidden

401 means bad or missing credentials; 403 means authenticated but not allowed.

Overview

Auth failures look similar in HTTP clients but mean different fixes. Branch on error.code, not only the status number.

Unauthorized (401)

The request did not present valid project credentials. Typical causes:

  • Missing X-Gray-Project-Id or Authorization
  • Malformed proj_ / gray_sk_ shape
  • Wrong secret for that project, or inactive project
  • revoked_secret — secret rotated or revoked (also HTTP 401)
json
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing credentials.",
    "retryable": false
  }
}

Forbidden (403)

Credentials were accepted, but policy blocks the call. Examples:

  • forbidden — org/project policy denies the operation
  • blacklisted — owner account blocked
  • plan_chain_denied — chain not on the plan allowlist
  • chain_disabled — chain turned off in Console › Networks
json
{
  "error": {
    "code": "plan_chain_denied",
    "message": "Chain is not available on this plan.",
    "retryable": false
  }
}

What to change

CodeFix
unauthorizedCheck headers, env vars, and project status
revoked_secretDeploy the new secret after rotation
plan_chain_deniedUpgrade plan or pick an allowed chain id
chain_disabledEnable the chain in Console › Networks

Full catalog: Error codes catalog.