Reference
Errors
Every error comes back in the same envelope; branch on the code field, not on the message text.
Error envelope
{
"error": {
"code": "not_found",
"message": "Order not found.",
"request_id": "83955522c09ff2d1"
}
}An undefined path also returns a JSON 404 not_found in the same envelope; it never returns an HTML page.
Codes
| HTTP | code | When |
|---|---|---|
| 401 | unauthorized | No token, a malformed token or an invalid token. |
| 403 | insufficient_scope | The token lacks the scope this endpoint requires. |
| 403 | tier_required | The requested feature is not in your plan (e.g. choosing your own username). |
| 403 | forbidden | This operation is not allowed. |
| 404 | not_found | The resource was not found, or it is hidden because it expired. |
| 404 | api_disabled | API access is turned off. |
| 405 | method_not_allowed | This endpoint does not support this HTTP method. The supported methods are in the Allow header. |
| 400 | invalid_request | An invalid field, an unknown field or parameter, or a field that belongs to another type. |
| 402 | insufficient_balance | The balance is not enough for this operation. |
| 409 | conflict | State conflict: a service that cannot be renewed, an idempotent request still being processed, a username already taken. |
| 429 | rate_limited | Rate limit exceeded. |
| 502 / 503 | service_unavailable | The provider or the log store could not be reached; try again. |
| 500 / 502 | internal_error | Unexpected error; contact support with the request_id. |
details
If the error has machine-readable details, they come back in the details field: the faulty field (field), stock (available), minimum quantity (min_required), balance (balance), the highest allowed value (max), the reason for the error (reason) and so on. For example, if the service type is under maintenance, you getreason: maintenance together with service_unavailable.
402 insufficient_balance
{
"error": {
"code": "insufficient_balance",
"message": "Insufficient balance for this operation.",
"request_id": "5f1c0a9e7b2d4c61",
"details": { "field": "balance", "balance": 3.2, "min_required": 12.5 }
}
}request_id
Log the request_id value; the support team can search the server logs with that ID.