Skip to main content

Error Codes

Every error — whether it comes from the service, request validation, routing, or an unexpected failure — converges to one shape:

{
"error": { "code": "<string>", "message": "<human-readable>", "details": <any|null> },
"meta": { "...factual register, dataset_version, timing_ms..." }
}
  • code — a stable machine string (table below); switch on this, not the HTTP status.
  • message — a human-readable explanation.
  • details — usually null; for validation_error it carries the structured list of field errors (which parameter, what was wrong).

Code table

HTTPcodeWhen
404not_foundUnknown strategy id, or unknown route.
422invalid_parameterA parameter failed a service check — bad format, malformed from/to date, period not in {daily, weekly}, unknown ids, non-positive risk_pct.
422validation_errorFastAPI request validation failed (e.g. wrong query type); details lists the offending fields.
405method_not_allowedWrong HTTP method on a valid path (the API is read-only — GET only).
503service_unavailable/readyz integrity check failed (dataset not fully loaded).
500internal_errorUnexpected server error. No internal detail is leakeddetails is null.
400bad_requestMalformed request.
403forbiddenReserved.

Reserved for the future access gate

These are declared but not emitted today (the API is open and unthrottled — see Access & Authentication and Rate Limits):

HTTPcodeFuture meaning
401unauthorizedMissing/invalid API key, once keys are required.
429rate_limitedOver a per-client rate limit; will arrive with RateLimit-* headers.
note

Because the code is stable across versions, you can write error handling against it now — including the reserved unauthorized / rate_limited codes — and it will keep working when the access gate is enabled.