Understanding Error Responses
In the world of APIs, bumps in the road can happen. That's why we've built a clear system to let you know what's up if things don't go as planned. Here's the lowdown on understanding error responses from our API:
Error Response Format
Whenever our API encounters an issue, it responds with a structured error object. Here's what's inside:
Error response format
{
"status": "error",
"error": {
"type": "<type of error>",
"code": <HTTP status code>,
"message": "<error message>",
"request_id": "<unique request identifier>"
}
}
- type: The category of the error (like input_validation_error or authorization_error).
- code: The HTTP status code associated with the error.
- message: A human-readable explanation of what went wrong.
- request_id: A unique identifier for your request, handy for troubleshooting with our support team.
Common Error Types
Here’s a quick guide to the types of errors you might encounter:
- Input Validation Error (input_validation_error): Something’s off with the data you sent us. Check your request payload.
- Authorization Error (authorization_error): Issues with authentication. Are your credentials correct?
- Forbidden Error (forbidden_error): You're trying to access something you shouldn't. Tsk tsk!
- Bad Request (bad_request): The server couldn't understand your request. Something’s missing or formatted wrongly.
- Internal Server Error (internal_server_error): Our bad! Something’s gone haywire on our end.
What to Do When You Get an Error
- Read the Message: Often, the error message tells you exactly what's wrong.
- Check Your Request: Especially if it’s an input validation error.
- Log Your Request ID: This helps us zoom in on your issue if you need to contact support.
- Reach Out If Stuck: Our team is always ready to assist – just shoot us a message with the request ID.
Errors are a part of the journey, but with these guidelines, they won’t be roadblocks. Happy coding!