Basics
Error format
Every error response has the same shape, so you can handle all of them the same way.
When a request fails, the API answers with the matching HTTP status code and a body of this shape:
{
"type": "validation_error",
"errors": [
{
"code": "required",
"detail": "This field is required.",
"attr": "email"
}
]
}
Fields
| Field | Description |
|---|---|
type | The error category: validation_error, client_error or server_error. |
errors | A list of one or more errors. |
errors[].code | A stable error code, e.g. required or not_authenticated. |
errors[].detail | A human-readable description. |
errors[].attr | The request field that caused the error, or null when the error concerns the whole request. |
Categories
type | Returned when |
|---|---|
validation_error | The request body failed validation (HTTP 400). One item in errors per problem. |
client_error | Any other request error, e.g. missing credentials (401) or a resource that does not exist (404). |
server_error | An error on Flexy's side (HTTP 5xx). |
For example, a request without a token returns:
{
"type": "client_error",
"errors": [
{
"code": "not_authenticated",
"detail": "Authentication credentials were not provided.",
"attr": null
}
]
}