Africa API

Errors

HTTP status codes, response shapes, and handling guidance.

Status Codes You Should Handle

StatusMeaningTypical Cause
200SuccessRequest completed normally
304Not ModifiedIf-None-Match matched current ETag
400Bad RequestInvalid query parameter (example: unsupported sort field)
404Not FoundCountry code does not exist
422Validation ErrorInvalid parameter type/range
500Server ErrorUnexpected backend failure

Error Shapes

400 / 404

{
  "detail": "country not found: xx"
}

422

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

Client Best Practices

  1. Treat 304 as success and use cached data.
  2. Retry 5xx with jittered backoff.
  3. Do not retry 4xx blindly.
  4. Log detail and request id context for debugging.

On this page