Errors & Validations

Understand the structure of error responses, common validation patterns, and how to interpret and handle different types of API errors.

Working with the API will bring 3 types of errors:

  1. Validation errors
  2. Authentication or authorization errors
  3. Unknown errors

HTTP Status CodeDescription
400 - Bad RequestThis status code implies that the server couldn't understand the request due to invalid syntax, or there is a problem with the provided input. These types of errors are usually coming from validations.
401 - UnauthorizedThis error code signifies that the request requires user authentication or that the current access token has expired.
403 - ForbiddenThis status code means that the user is not allowed to access a specific resource or action
404 - Not foundHappens when a resource is not found or the client is not allowed to access it
500 - Internal Server ErrorThis is a generic error message, given when an unexpected condition was encountered by the server and no more specific message is suitable. In other words, it's a "catch-all" for server-side errors.

References That Can't Be Loaded

Responses contain the ids of related entities, e.g. the categoryId of an inquiry. Such an id is returned as stored, even if the referenced entity can't be loaded: fetching it responds with 404 Not Found, because the entity has been deleted or because the client isn't allowed to access it. The API deliberately doesn't tell these two cases apart. This applies to almost all references in the API.

📘

Handle references that can't be loaded

Treat an id whose entity can't be loaded like a missing value, e.g. don't offer a deleted category for selection.


Validation Errors (400 - Bad Request)

AttributeTypeDescription
typeStringLink to the RFC
titleStringBrief explanation of the error
statusIntegerThe error code
errorsArrayA more detailed explanation of the error

Example response

{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "Credentials": [
      "Email not found or combination of email and password incorrect"
    ]
  }
}