Errors

In this guide, we will discuss potential issues that may arise when working with the API. It's natural for mistakes to occur, and while they may often stem from the user side, understanding how to address them is crucial. We will review various status codes and error types you may encounter, providing clarity on how to navigate these situations.

You can tell if your request was successful by checking the status code when receiving an API response. If a response comes back unsuccessful, you can use the error type and error message to figure out what has gone wrong and do some basic debugging (before contacting support).


Status codes

Here is a list of the different categories of status codes returned by the Covertier API. Use these to understand if a request was successful.

  • Name
    2xx
    Description
    A 2xx status code indicates a successful response.
  • Name
    4xx
    Description
    A 4xx status code usually indicates a client error.
  • Name
    5xx
    Description
    A 5xx status code indicates a server error.

Validation errors

Whenever a request contains invalid data, the Covertier API will return an error response with a general error message and an error message for each invalid field. You can use this information to gain a better understanding of the problem.

Example validation error response

POST
/v1/policy/issue
{
    "message": "The package.id field must be an integer. (and 1 more error)",
    "errors": {
        "package.id": [
            "The package.id field must be an integer."
        ],
        "vehicle.trim_id": [
            "The vehicle.trim id field must be an integer."
        ]
    }
}

Was this page helpful?