Errors
Status codes, error codes, and what to do about each.
Errors share one shape:
{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "`kg` is invalid: Too small: expected number to be >=1.",
"param": "kg"
}
}
param names the request field at fault, when there is one. Every response has a Request-Id header: quote it when you contact support.
| Status | Code | Retry? | What to do |
|---|---|---|---|
| 400 | invalid_json |
No | Send a JSON object, at most 10 KB. |
| 400 | idempotency_key_missing / idempotency_key_invalid |
No | Send a valid Idempotency-Key. |
| 401 | invalid_api_key |
No | Check the key; it may be revoked. |
| 402 | insufficient_balance |
After a top-up | The error has balance_cents and required_cents. |
| 403 | api_access_inactive |
No | The account isn’t approved, or it is suspended. Contact support. |
| 403 | insufficient_permissions |
No | Use a key with purchase access. |
| 404 | resource_missing / not_found |
No | Check the offset ID or the path. |
| 409 | idempotency_key_reused |
No | Use a new key for a new purchase. |
| 422 | validation_error |
No | Fix the field in param. |
| 422 | amount_too_small |
No | The amount buys less than 1 kg at your rate. |
| 429 | rate_limited |
Yes | Wait for the Retry-After seconds. |
| 500 | api_error |
Yes | Retry with the same Idempotency-Key. |