Error handling
Use the HTTP status code to decide what to do next. The response can also include details that help diagnose the failure.
Common status codes
| Status | Meaning | What to do |
|---|---|---|
| 400 | Invalid request or parameters | Check the request body, query fields, and encoding. |
| 401 | Authentication failed | Check the access token and obtain a new one if needed. |
| 403 | Access denied | Check the account's permissions and access to the requested resource. |
| 404 | Resource not found | Check the identifier and resource path. |
| 409 / 422 | Conflict or validation failure | Review the response details and request data. |
| 429 | Rate limit exceeded | Reduce request frequency and retry with exponential backoff. |
| 500 | Server error | Retry where appropriate or contact support with request details. |
Error details
Some API errors include a code and message. The API gateway and individual endpoints can return different response shapes, so handle missing fields safely.
For a rate-limited request, the error code is
Optimus-Err-0020and the message isRate limit exceeded.
Retrying requests
When you receive a 429, reduce request frequency and retry with exponential backoff. For server errors, retry only when appropriate for the operation; avoid unintentionally repeating a write request.
See Rate limits for categories and response headers.
