Error handling
Turn API failures into predictable recovery paths.
Errors are part of an integration contract. Handle them by category, preserve safe diagnostics, and give users a clear recovery path.
Recovery model
| Response family | Typical action |
|---|---|
2xx | Continue with validated response data. |
4xx | Correct the request, credentials, or user input before retrying. |
5xx | Retry only when the operation is safe and use backoff. |
Implementation checklist
Parse the documented error body when an endpoint provides one.
Show a human-readable message without leaking internal details.
Log safe context so support can trace the failure.
Exact status codes live with endpoints
The table is a recovery pattern, not a replacement for endpoint documentation. Check API reference for exact status codes and error response fields.