Errors
In this guide, we will talk about what happens when something goes wrong while you work with the API.
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.
Before reaching out to support with an error, please be aware most reported errors are, in fact, request errors. Therefore, please carefully check your code before contacting the support.
Status codes
Here is a list of the different categories of status codes returned by the Regia API. Use these to understand if a request was successful.
HTTP 2xx
A 2xx status code indicates a successful response.
HTTP 4xx
A 4xx status code indicates a client error — usually something wrong with the request you sent.
Check the error message for more information on the error and the Reference section of the request for more information on how to fix it.
HTTP 5xx
A 5xx status code indicates a server error — usually something wrong with the server. If you receive a 5xx status code, please try again later or contact support if the issue persists.
Note that all 5xx errors are automatically reported to our team, so you don't need to report them unless it persists for a long time.
Error types
Whenever a request is unsuccessful, the 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 Regia — use these to understand what you have done wrong.
- Name
api_error
- Description
This means that we made an error, which is highly speculative and unlikely.
- Name
invalid_request
- Description
This means that you made an error, which is much more likely.
Error Example
{
"code": "500",
"error": "api_error",
"message": "Something went wrong while processing your request. Please try again later.",
}