Invoice Consolidations
Contents
How to get my access token?
To generate your access token, follow the steps shown in how to get my access token
Request Format
The request should have the following format:
POST https://api.mercadolibre.com/consolidations/{consolidatedId}/documents/cbt_invoice
--header 'Authorization: Bearer {accessToken}'A JSON object will be sent in the body with the fields listed below:
| Name | Type | Description |
|---|---|---|
| last_mile_track_number | String | Last mile track number. |
| shipments | Array of integers | Shipment IDs. |
Response Format
An empty body is expected and the document will be downloaded in PDF format.
Status Codes
| Status | HTTP Code | Description |
|---|---|---|
| SUCCESS | 200 | Document will be downloaded. |
| FAILED | 422 | When the download was unsuccessful due to some internal dependency. It is expected to return "error": "invoice_process_error" along with the "message" describing the reason for the error. |
| FAILED | 404 | When the download was unsuccessful because the consolidation code was not found. It is expected to return "error": "invoice_not_found" along with the "message" describing the reason for the error. |
| FAILED | 404 | When the download was unsuccessful because the shipment code was not provided. It is expected to return "error": "shipments_not_found" along with the "message" describing the reason for the error. |
| FAILED | 404 | When the download was unsuccessful because the service code was not found. It is expected to return "error": "service_not_found" along with the "message" describing the reason for the error. |
| FAILED | 401 | When the download was unsuccessful because the carrier code was not found. It is expected to return "error": "carrier_not_found" along with the "message" describing the reason for the error. |
| ERROR | 500 | Any server error |
Examples
Request:
POST https://api.mercadolibre.com/consolidations/{consolidatedId}/documents/cbt_invoice
--header 'Authorization: Bearer xxxxxxxxx'Body:
{
"last_mile_track_number": "LP00000000000000000000",
"shipments": [
123456789,
987654321,
1234567890
]
}Response:
Successful (200 OK)
{
}Failed (Error HTTP 4XX)
{
"error": "invoice_process_error",
"message": "Invoice of last_mile_track_number LP00000000000000000000 and consolidated id MELI00000000000000000000A process with error",
"status": 422
}{
"error": "invoice_not_found",
"message": "Invoice of last_mile_track_number 00001 and consolidated id 00001 not found",
"status": 404
}{
"error": "shipments_not_found",
"message": "shipments not found in request",
"status": 404
}{
"error": "service_not_found",
"message": "service not found in request",
"status": 404
}{
"error": "carrier_not_found",
"message": "carrier not found in request",
"status": 401
}Error (Error HTTP 5XX)
{
"error": "internal_error",
"message": "Internal Server Error",
"status": 500
}