Errors
In this guide, we will talk about what happens when something goes wrong while you work with the API. Let's look at some status codes and error types you might encounter.
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).
typeauth API will reponse always with JSON body, that contains the key success
, if the key is true
, this means request has been correctly processed and probably something is wrong with your request. if key success
is false
then API had not been succesful to process the API.
Status codes
Here is a list of the different categories of status codes returned by the typeauth API. Use these to understand if a request was successful.
- Name
2xx
- Description
A 200 status code indicates a successful response. A 201 status code indicates a successful response and asset created.
- Name
4xx
- Description
A 400 status code indicates a problem with your authorization maybe for malformed JSON A 404 status code indicates the rsource was not found.
- Name
5xx
- Description
A 500 status code indicates a API or Database error.
Error types
Whenever a request is unsuccessful, the typeauth API will return an error response with a 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.
\
- Name
message
- Description
Description of the error.
- Name
success
- Description
True or false where the API request has been processed succesfully.
Error response
{
"success": "true",
"message": "Account or application not found",
"data": []
}
Error response
{
"success": "false",
"message": "Database error",
"data": []
}