API error format and codes
Check the HTTP status and error body when an API request fails. Authentication and authorization failures return 401.
Error envelope
{"code":401,"message":"Not authenticated","result":"error"}
| Field | Meaning |
|---|---|
code | Numeric response code |
result | Error marker where included by the response wrapper |
message | Human-readable explanation |
errors | Validation-dependent details |
error_details | Additional validation details, including bad values where provided |
bad_fields | Resource-authorization-dependent field details |
Optional details vary by operation. Do not assume every error contains every field.
Status codes
| Code | Meaning and action |
|---|---|
| 400 | Invalid arguments or rejected configuration; correct the reported fields |
| 401 | Authentication or permission denied; check credential, context, expiry and grants |
| 404 | Resource or authorized parent is unavailable; check the resource and context |
| 409 | Conflict, including domain or configuration conflicts; inspect the operation's message |
| 412 | Version precondition failed; read, reconcile and retry with the current version |
| 500 | Server error; retry as appropriate and contact your account manager if it persists |
| 503 | Operation temporarily unavailable; inspect the error message before retrying |
These codes are operation-dependent. See versions and concurrency. Do not substitute 403 for the API's 401 authentication response.
TODO(verify): Confirm whether a stable machine-readable error identifier exists beyond numeric code and operation-specific validation details.