Error Handling
Effective error handling ensures smooth integration and provides clarity when issues arise. Below is a list of common HTTP status codes, their descriptions, and guidance on resolving them:
Error Code | Slug | Type | Meaning |
---|---|---|---|
400 | bad_request | Bad Request | The request is malformed or contains invalid parameters. |
401 | unauthorized | Unauthorized | Invalid or missing API key. Ensure your authentication credentials are correct. |
403 | forbidden | Forbidden | You do not have the necessary permissions to access the requested resource. |
404 | not_found | Not Found | The specified resource or URL path could not be found. |
405 | method_not_allowed | Method Not Allowed | The HTTP method used is not valid for this endpoint. |
406 | not_acceptable | Not Acceptable | The requested response format is not supported. |
410 | gone | Gone | The requested resource has been removed and is no longer available. |
422 | validation_failed | Unprocessable Entity | The request contains invalid data or violates input validation rules. |
429 | too_many_requests | Too Many Requests | You have exceeded the rate limit. Slow down your requests. |
500 | server_error | Internal Server Error | An unexpected issue occurred on our server. Please try again later. |
503 | service_unavailable | Service Unavailable | The server is temporarily offline for maintenance. Please try again later. |
In the event of a 422 error, the error object will include the field name as a property. This property will contain an array of error messages as its value. Here's an example:
// Response Validation Failed
{
"status": false,
"message": "Forbidden parameter! (and 2 more errors)",
"errors": {
"parameter": [
"Forbidden parameter!"
]
}
}
// Response Authentication Failed
{
"status": false,
"message": "Token is expired."
}