FlexyAPI documentation

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

FieldDescription
typeThe error category: validation_error, client_error or server_error.
errorsA list of one or more errors.
errors[].codeA stable error code, e.g. required or not_authenticated.
errors[].detailA human-readable description.
errors[].attrThe request field that caused the error, or null when the error concerns the whole request.

Categories

typeReturned when
validation_errorThe request body failed validation (HTTP 400). One item in errors per problem.
client_errorAny other request error, e.g. missing credentials (401) or a resource that does not exist (404).
server_errorAn 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
    }
  ]
}