Environment:
Skip to main content
This documentation is in BETA version, for any information contact us at api@sibill.it

Errors

This page explains how to handle errors that may occur when using the Sibill APIs. The APIs use the HTTP status code convention to indicate the result of a request. Status codes can be categorized as follows:

  • 2xx codes: indicate the request was successful
  • 4xx codes: indicate a client error
  • 5xx codes: indicate a server error

Every error includes a payload that describes what happened. Below is a list of the HTTP status codes used by the APIs:

HTTP CodeMeaningDescription
200OKEverything worked as expected.
201CreatedThe resource was successfully created.
400Bad RequestThe request is not acceptable, often due to a missing required parameter.
401UnauthorizedNo valid API key was provided.
402Request FailedThe parameters were valid but the request failed.
403ForbiddenThe API key does not have permission to perform the request.
404Not FoundThe requested resource does not exist.
422Unprocessable EntityThe request was understood but cannot be processed due to semantic errors.
500, 502, 503, 504Server ErrorsA problem occurred while Sibill was handling the request.

🙅‍♂️ Authentication errors

When using token-based authentication, you may receive an error if the token is invalid or was not provided.

HTTP/1.1 401 Unauthorized
Content-Type: application/json

{
"errors":[
{
"code":"unauthorized",
"detail":"Authentication failed.",
"title":"Unauthorized"
}
]
}

If the token is valid but does not have the necessary permissions to perform the request, you will receive a 403 error.

HTTP/1.1 403 Forbidden
Content-Type: application/json

{
"errors":[
{
"code":"forbidden",
"detail":"Forbidden.",
"title":"Forbidden"
}
]
}

To quickly check whether the token is valid, you have access to the endpoints, or if there is a network issue, you can try the following command:

curl --request GET \
--url {{BASE_URL}}/api/v1/companies \
--header "Authorization: Bearer {{TOKEN}}"

Errors caused by validation issues will include a source object containing the list of fields that generated the error.

HTTP/1.1 400 Bad Request
Content-Type: application/json

{
"errors":[
{
"code":"bad_request",
"detail":"Invalid integer. Got: string",
"title":"Invalid value",
"source":{
"pointer":"/page_size"
}
}
]
}

🖥️ Sibill server errors

Other errors that are not caused by authentication or client request issues, but by internal server problems, generate a response with an error object describing the issue.

HTTP/1.1 500 Internal Server Error
Content-Type: application/json

{
"errors":[
{
"code":"internal_server_error",
"detail":"An unexpected error occurred.",
"title":"Internal Server Error"
}
]
}