Guides · Guide
Errors
The error format, every error code, and what to do about each.
The format
Every error has the same shape, with a stable code for your program, a message for a person, a request_id for support and a doc_url that comes back to this page:
json
{
"error": {
"code": "insufficient_scope",
"message": "This token does not have the \"resource.write\" scope.",
"request_id": "req_5c1e9a07b24d6f83a0e1c752",
"doc_url": "https://docs.colossium.cloud/errors#insufficient_scope",
"details": { "required_scope": "resource.write" }
}
}- Branch on `code`, never on
message. Messages can be reworded. Codes will not change inv1. - `details` is present only when it helps, for example the scope that was needed or the fields that were wrong.
- Log `code`, `request_id` and the status. Never log headers or bodies that may hold a token or personal data.
Errors from a token that is refused add WWW-Authenticate: Bearer realm="colossium" to a 401.
Every code
| Code | Status | Meaning |
|---|---|---|
missing_token | 401 | No Authorization header. |
invalid_token | 401 | The token is not valid. |
token_revoked | 401 | The token was revoked. |
token_expired | 401 | The token has expired. |
token_in_url | 400 | The token was sent in the URL. Use the header. |
ip_not_allowed | 403 | The token has an IP allow list and your address is not on it. |
organisation_closed | 403 | The organisation is closed. |
insufficient_scope | 403 | The token lacks the scope the endpoint needs, or the action is not allowed. |
project_not_allowed | 403 | The token is limited to some projects and the endpoint covers the whole organisation. |
invalid_request | 400 | A parameter or the body is not valid. |
idempotency_key_required | 400 | A request needs an Idempotency-Key header. |
not_found | 404 | It does not exist, or the token may not see it. |
conflict | 409 | It already exists, or its state does not allow this. |
quota_exceeded | 409 | A plan limit has been reached. |
rate_limited | 429 | Too many requests. Wait for Retry-After. |
unavailable | 503 | The API cannot check tokens right now. Retry shortly. |
internal_error | 500 | Something went wrong. Quote the request id to support. |
json
{
"error": {
"code": "insufficient_scope",
"message": "This token does not have the \"resource.write\" scope.",
"request_id": "req_5c1e9a07b24d6f83a0e1c752",
"doc_url": "https://docs.colossium.cloud/errors#insufficient_scope",
"details": {
"required_scope": "resource.write"
}
}
}Handling errors well
| Status | Meaning | Your code should |
|---|---|---|
| 400 | The request is wrong | Not retry. Fix the request. Show details.problems to a developer. |
| 401 | The token is not usable | Not retry. Alert someone: the token needs replacing. Do not keep trying: that fills your rate limit and your logs. |
| 403 | The token is valid but not allowed | Not retry. Check the scope, the project and the address. |
| 404 | It is not there, or not yours | Not retry. Treat "not yours" and "not there" as the same. |
| 409 | A conflict or a plan limit | Not retry blindly. Read the code. |
| 429 | Slow down | Wait for Retry-After. |
| 5xx | Our side, or temporary | Retry with backoff if it is safe to. Quote the request id if it persists. |
Security
Error messages never include a token, an internal name or a detail about the platform. If you build your own error page, do the same: do not echo what a caller sent back into an error that others can read.
This page as MarkdownReport a problem with this pageOlympus Group Holdings, Inc.