Errors
In this guide, we'll discuss what happens when things don't go as planned while you're working with our API. We understand that mistakes can happen, and we want to help you navigate through any errors that might occur. Most of the time, the errors will be a result of actions on your end, rather than issues on our side. Let's explore some of the status codes and error types you might come across during your API integration journey.
You can tell if your request was successful by checking the status code when receiving an API response. If a response comes back unsuccessful, you can use the error type and error message to figure out what has gone wrong and do some rudimentary debugging (before contacting support).
Status codes
Here is a list of the different categories of status codes returned by the Crater API. Use these to understand if a request was successful.
- Name
2xx
- Type
- Field Type
- Description
A 2xx status code indicates a successful response.
- Name
4xx
- Type
- Field Type
- Description
A 4xx status code indicates a client error — this means it's a you problem.
- Name
5xx
- Type
- Field Type
- Description
A 5xx status code indicates a server error — you won't be seeing these.
Error types
Whenever a request is unsuccessful, the Crater API will return an error response with an error type and message. You can use this information to understand better what has gone wrong and how to fix it. Most of the error messages are pretty helpful and actionable.
Here is a list of the two error types supported by the Crater API — use these to understand what you have done wrong.
- Name
api_error
- Type
- Field Type
- Description
This means that we made an error.
- Name
invalid_request
- Type
- Field Type
- Description
This means that you made an error.
Error response
{
"type": "api_error",
"message": "No way this is happening!?",
}