Errors
The shape of every error answer, and how to handle it.
When a request fails, the answer is an RFC 9457 problem with a stable code, the requestId and a docUrl that links to the code's entry on the errors page.
{
"type": "https://traki.io/developers/errors#key_missing",
"title": "Unauthorized",
"status": 401,
"detail": "Send your key in the Authorization header: \"Authorization: Bearer traki_…\".",
"code": "key_missing",
"requestId": "2b1f0c3e-6a1d-4a5e-9f0e-6c1d2b7a8e41",
"docUrl": "https://traki.io/developers/errors#key_missing"
}Status codes
| Status | Meaning |
|---|---|
| 200, 201, 204 | It worked |
| 400 | The request is malformed |
| 401 | No key, or the key is unknown, revoked or expired |
| 403 | The key is valid but lacks the scope or the plan, or opens another part |
| 404 | No such route, or no such record in your account |
| 409 | A conflict: a stale version, or the same idempotency key still running |
| 422 | The fields are well formed but not acceptable |
| 429 | Too many requests |
| 5xx | TRAKI's fault. Safe to retry, with the same Idempotency-Key for a change |
Handling errors well
- Branch on
code, not ondetail. The wording ofdetailcan change; the codes do not. - Log
requestIdwith every failure. Support finds the request with it. - Retry 429 after
Retry-After, and 5xx with a growing wait. Do not retry other 4xx answers unchanged: they will fail the same way. - A record in another account answers 404, never 403. The API does not say whether it exists.
The errors page lists every code with what to do.