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-IdorAuthorization - 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 operationblacklisted— owner account blockedplan_chain_denied— chain not on the plan allowlistchain_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
| Code | Fix |
|---|---|
| unauthorized | Check headers, env vars, and project status |
| revoked_secret | Deploy the new secret after rotation |
| plan_chain_denied | Upgrade plan or pick an allowed chain id |
| chain_disabled | Enable the chain in Console › Networks |
Full catalog: Error codes catalog.