Skip to Content
Developers

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

StatusMeaning
200, 201, 204It worked
400The request is malformed
401No key, or the key is unknown, revoked or expired
403The key is valid but lacks the scope or the plan, or opens another part
404No such route, or no such record in your account
409A conflict: a stale version, or the same idempotency key still running
422The fields are well formed but not acceptable
429Too many requests
5xxTRAKI's fault. Safe to retry, with the same Idempotency-Key for a change

Handling errors well

  • Branch on code, not on detail. The wording of detail can change; the codes do not.
  • Log requestId with 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.