Example of a validation error message response
Getting more detailed error information
To get more detailed information about errors that occur during parcel creation, pass theerrors query parameter to your request. It can be one of errors=verbose or errors=verbose-carrier.
Request method and URL, with errors query parameter
errors query parameter:
Example response structure with the errors query parameter
errors query parameter is used. All parcels in the parcels key will be processed, while the parcels in the failed_parcels key will not be processed. This differs from the default behavior, where if any parcel in the request contains an error, the entire request fails.
errors=verbose
Including the query parameter errors=verbose returns errors that occurred during the validation of the request. These errors only pertain to the provided data in the request (e.g. an invalid country was provided).
Example response using errors=verbose
errors=verbose-carrier
Including the query parameter errors=verbose-carrier returns errors that occurred on the carrier’s side. It is impossible to predict if these errors will happen ahead of time. It makes sense to use this query parameter if request_label_async is set to false and request_label is set to true. In such cases, errors can be recognized by the following structure:
Example response using errors=verbose-carrier
HTTP response codes when using the errors=verbose-carrier query parameter
When creating parcels, the behaviour of errors=verbose-carrier depends on the request data. The following scenarios apply:
Sending one parcel:
- If the parcel is sent successfully, the API will return an
HTTP 200status code and the serialized parcel in the response body. - If the parcel fails to send, the API will return an
HTTP 400status code and a carrier error message.
- If all parcels are sent successfully, the API will return an
HTTP 200status code and the serialized parcels in the response. - If some parcels fail to send, the API will return an
HTTP 200status code and afailed_parcelsfield in the response. Thefailed_parcelsfield is a list of dictionaries, where each dictionary contains the parcel data and the errors that occurred for that parcel. - If all parcels fail to send, the API will return an
HTTP 400status code along with the errors listed in the same way as in the previous scenario.