africaAPI

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
500Server ErrorUnexpected backend failure

Common Error Shapes

400 / 404

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

401

{
  "detail": "Not authenticated"
}

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 only 429 and 5xx responses.
  3. Do not blindly retry 401, 403, 404, or 422.
  4. Log the endpoint, status code, and detail payload.

On this page