Label

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:

GET https://api.mercadolibre.com/shipments/{shipment_id}/documents/cbt_label?response_type={responseType}&label_type={labelType} 

--header 'Authorization: Bearer {accessToken}'

The label_type parameter is optional and allows explicitly requesting the label type:

  • first_mile | last_mile
  • If omitted (or unrecognized), legacy behavior applies and Labels decides the default.

Response Format

An empty body is expected, and the format of the downloaded document will be determined by the value in the "response_type" key.

  • If "pdf" is specified, the document will be downloaded in PDF.
  • If "zpl" is specified and the route is USA-Mexico, the document will be downloaded in ZIP format.
  • If "response_type" is empty, the document will be downloaded in PDF format.

Status Codes

StatusHTTP CodeDescription
SUCCESS200Document will be downloaded.
FAILED4XXWhen the download was not successful, it is expected to return "error" along with the "message" that describes the reason for the error.
ERROR500Any server error


Examples

Request:

GET https://api.mercadolibre.com/shipments/123132434/documents/cbt_label?response_type=pdf&label_type=last_mile 

--header 'Authorization: Bearer xxxxxxxxx'

Response:

Successful (200 OK)

{

}

Failed (Error HTTP 4XX)

{
    "error": "error_get_document",
    "message": "Shipment status is 'delivered'",
    "status": 400 
}
{
    "error": "bad_request",
    "message": "Invalid response type",
    "status": 400
}
{
    "error": "shipment_not_found",
    "message": "Shipment: 3002444733251",
    "status": 404  
}

Error (Error HTTP 5XX)

{
    "error": "internal_error",
    "message": "Internal Server Error",
    "status": 500  
}