Errors
HTTP status codes, response shapes, and handling guidance.
Status Codes You Should Handle
| Status | Meaning | Typical Cause |
|---|---|---|
200 | Success | Request completed normally |
304 | Not Modified | If-None-Match matched current ETag |
400 | Bad Request | Invalid query parameter (example: unsupported sort field) |
404 | Not Found | Country code does not exist |
422 | Validation Error | Invalid parameter type/range |
500 | Server Error | Unexpected 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
- Treat
304as success and use cached data. - Retry
5xxwith jittered backoff. - Do not retry
4xxblindly. - Log
detailand request id context for debugging.