Skip to main content

Common Errors

Error Response Format

The error response format looks like this

{
"type": "validation_error",
"errors": [
{
"code": "required",
"detail": "This field is required.",
"attr": "name"
}
]
}
  • type: can be validation_error, client_error or server_error
  • code: short string describing the error. Can be used by API consumers to customize their behavior.
  • detail: User-friendly text describing the error. Usually in English, but may be localized.
  • attr: the field name when the error applies to a specific field (for example, in a validation_error), and null for non-validation errors when not applicable.

Common Errors

Some errors may appear on most of our endpoints. In the next sections, we describe the most common ones. For more details, please refer to the linked resources in OpenAPI.

401 Unauthorized

These errors are returned with the status code 401 whenever the authentication fails or a request is made to an endpoint without providing the authentication information as part of the request. Here are the 2 possible errors that can be returned.

{
"type": "client_error",
"errors": [
{
"code": "authentication_failed",
"detail": "Incorrect authentication credentials.",
"attr": null
}
]
}
{
"type": "client_error",
"errors": [
{
"code": "not_authenticated",
"detail": "Authentication credentials were not provided.",
"attr": null
}
]
}

405 Method Not Allowed

This is returned when an endpoint is called with an unexpected HTTP method. For example, if updating a user requires a POST request and a PATCH is issued instead, this error is returned. Here's what it looks like:

{
"type": "client_error",
"errors": [
{
"code": "method_not_allowed",
"detail": "Method \"PATCH\" not allowed.",
"attr": null
}
]
}

406 Not Acceptable

This is returned if the Accept header is submitted and contains a value other than application/json. Here's how the response would look:

{
"type": "client_error",
"errors": [
{
"code": "not_acceptable",
"detail": "Could not satisfy the request Accept header.",
"attr": null
}
]
}

415 Unsupported Media Type

This is returned when the request content type is not JSON. Here's how the response would look:

{
"type": "client_error",
"errors": [
{
"code": "unsupported_media_type",
"detail": "Unsupported media type \"application/xml\" in request.",
"attr": null
}
]
}

500 Internal Server Error

This is returned when the API server encounters an unexpected error. Here's how the response would look:

{
"type": "server_error",
"errors": [
{
"code": "error",
"detail": "A server error occurred.",
"attr": null
}
]
}