2xx range indicate success, 4xx codes indicate a client error, and 5xx codes indicate a server-side issue.
Status codes
Error response shapes
The exact response shape varies slightly between endpoints. Some endpoints use an
error field, while others use a success + message pattern. Always check the HTTP status code first, then parse the response body.- 400 Bad Request
- 403 Forbidden
- 404 Not Found
- 409 Conflict
- 422 Unprocessable Entity
- 500 Internal Server Error
Best practices
- Check the HTTP status code first. The status code is the most reliable indicator of what happened. Parse the response body only after determining the status.
- Handle both error shapes. Some endpoints return
{"error": "..."}while others return{"success": false, "message": "...", "status": ...}. Your client code should handle both. - Use 422 errors for form validation. The
errorsobject gives you per-field messages you can surface directly to users. - Retry on 500 errors. Internal server errors are transient. Use exponential backoff when retrying.