Platform

Errors

HTTP status codes, validation failures, and common error shapes returned by Africa API.

Status Codes You Should Handle

StatusMeaningTypical Cause
200SuccessRequest completed normally
304Not ModifiedIf-None-Match matched the current countries list ETag
400Bad RequestInvalid query combination such as year plus start_year
401UnauthorizedMissing or invalid API key
403ForbiddenAuthenticated but not allowed to perform the action
404Not FoundMissing country, indicator, geography, source, exchange, or ticker
422Validation ErrorQuery parameter type or bounds are invalid
429Too Many RequestsPer-minute rate limit or monthly request quota exceeded
500Server ErrorUnexpected backend failure

Common Error Shapes

400 / 404

{
  "detail": "indicator not found: median_income_usd"
}

401

{
  "detail": "missing bearer token"
}

422

{
  "detail": [
    {
      "loc": ["query", "limit"],
      "msg": "Input should be less than or equal to 1000",
      "type": "less_than_equal"
    }
  ]
}

Client Best Practices

  1. Treat 304 as success and reuse the cached countries payload.
  2. Retry transient per-minute 429 and 5xx responses with backoff. A monthly quota 429 needs a quota reset or a plan with more remaining capacity; see Rate limits.
  3. Do not blindly retry 401, 403, 404, or 422.
  4. Log the endpoint, status code, and detail payload.

On this page