Consult Carta Porte Information by Shipment from Mexico
Introduction
The carta-porte shipment data query API is designed to provide fiscal data to carriers involved in transportation who want to generate the fiscal document for Mexico (cfdi+carta-porte). Given a shipment ID, this API returns the corresponding data (product list, origin and destination) for that shipment.
Important: Make sure you already have a valid application and token, and that you are authorized to use this endpoint. OAuth will be used for security.
Request
bash1GET https://api.mercadolibre.com/shipments/{shipment_id}/carta-porte-details/{step_type}?access_token={access_token}&logistic_center=MXAQR1&pipeline=SMD1_A
Parameter | Data Type | Description | Type |
|---|---|---|---|
| shipment_id | String | Shipment ID | Required |
| step_type | String | Name of the desired section. Possible values: first_mile, middle_mile, last_mile | Required |
| access_token | String | Access token | Required |
| logistic_center | String | Name of the logistic center from which the dispatch departs. This query parameter is optional. It must not be used for the first_mile or last_mile legs. For the middle_mile section this parameter is required. | Optional |
| pipeline | String | Name of the HU pipeline present in the dispatch. This query parameter is optional. It must not be used for the first_mile or last_mile legs. For the middle_mile section this parameter is required. | Optional |
Response
json1{ 2 "recipient": { 3 "rfc": "string", 4 "full_name": "string" 5 }, 6 "origin": { 7 "fiscal_information": { 8 "full_name": "string", 9 "rfc": "string", 10 "fiscal_residence": "string" 11 }, 12 "address": { 13 "address_line": "string", 14 "street_name": "string", 15 "street_number": "string", 16 "intersection": "string", 17 "zip_code": "string", 18 "city": { "id": "string", "name": "string" }, 19 "state": { "id": "string", "name": "string" }, 20 "country": { "id": "string", "name": "string" }, 21 "neighborhood": { "id": "string", "name": "string" }, 22 "municipality": { "id": "string", "name": "string" } 23 } 24 }, 25 "destination": { 26 "fiscal_information": { 27 "full_name": "string", 28 "rfc": "string", 29 "fiscal_residence": "string" 30 }, 31 "address": { 32 "address_line": "string", 33 "street_name": "string", 34 "street_number": "string", 35 "intersection": "string", 36 "zip_code": "string", 37 "city": { "id": "string", "name": "string" }, 38 "state": { "id": "string", "name": "string" }, 39 "country": { "id": "string", "name": "string" }, 40 "neighborhood": { "id": "string", "name": "string" }, 41 "municipality": { "id": "string", "name": "string" } 42 } 43 }, 44 "package": { 45 "items": [ 46 { 47 "category": int, 48 "description": "string", 49 "unit_code": "string", 50 "quantity": int, 51 "dangerous_material": "string", 52 "dangerous_material_key": "string", 53 "package_key": "string", 54 "package_description": "string", 55 "dimensions": { 56 "height": int, 57 "width": int, 58 "length": int, 59 "weight": int 60 } 61 } 62 ], 63 "total_items": int 64 }, 65 "return_reverse_logistics_collection": "" 66}
The response is an array by entity/type. If the fiscal data for a specific entity cannot be found, the error "Shipment id not found" is returned, as shown in the example above.
Parameter | Data Type | Description | Type |
|---|---|---|---|
| recipient | Object | Recipient data | |
| recipient.rfc | String | Recipient's RFC (Tax ID) | |
| recipient.full_name | String | Recipient's full name | |
| origin | Object | Shipment origin | |
| origin.fiscal_information | Object | Origin fiscal information | |
| origin.fiscal_information.full_name | String | Name of origin responsible party | |
| origin.fiscal_information.fiscal_residence | String | Conditional attribute to register the country code of fiscal residence for the federal freight transport operator, per the c_Pais catalog published on the SAT portal, based on ISO 3166-1. | |
| origin.fiscal_information.rfc | String | RFC of origin responsible party | |
| origin.address | Object | Origin location | |
| origin.address.address_line | String | Field composed of the street_name and street_number fields for the origin | |
| origin.address.street_name | String | Origin street name. | |
| origin.address.street_number | String | Origin street number. | |
| origin.address.intersection | String | Cross street. | |
| origin.address.zip_code | String | Origin zip code | |
| origin.address.city | Object | Origin city | |
| origin.address.city.id | String | Unique identifier assigned by Mercado Libre to the city | |
| origin.address.city.name | String | City name | |
| origin.address.state | Object | Origin state, department or province | |
| origin.address.state.id | String | Unique identifier assigned by Mercado Libre to the state in ISO 3166 format. | |
| origin.address.state.name | String | State name | |
| origin.address.country | Object | Origin country | |
| origin.address.country.id | String | Unique identifier assigned by Mercado Libre to the country in ISO 3166 format | |
| origin.address.country.name | String | Country name | |
| origin.address.neighborhood | Object | Origin neighborhood | |
| origin.address.neighborhood.id | String | Unique neighborhood identifier | |
| origin.address.neighborhood.name | String | Neighborhood name | |
| origin.address.municipality | Object | Origin municipality | |
| origin.address.municipality.id | String | Unique identifier assigned by Mercado Libre to the municipality | |
| origin.address.municipality.name | String | Municipality name | |
| destination | Object | Shipment destination | |
| destination.fiscal_information | Object | Destination fiscal information | |
| destination.fiscal_information.full_name | String | Name of destination responsible party | |
| destination.fiscal_information.rfc | String | RFC of destination responsible party | |
| destination.fiscal_information.fiscal_residence | String | Conditional attribute to register the country code of fiscal residence for the federal freight transport operator, per the c_Pais catalog published on the SAT portal, based on ISO 3166-1. | |
| destination.address | Object | Destination location | |
| destination.address.address_line | String | Field composed of the street_name and street_number fields for the destination | |
| destination.address.street_name | String | Destination street name. | |
| destination.address.street_number | String | Destination street number. | |
| destination.address.intersection | String | Cross street. | |
| destination.address.zip_code | String | Destination zip code | |
| destination.address.city | Object | Destination city | |
| destination.address.city.id | String | Unique identifier assigned by Mercado Libre to the city | |
| destination.address.city.name | String | City name | |
| destination.address.state | Object | Destination state, department or province | |
| destination.address.state.id | String | Unique identifier assigned by Mercado Libre to the state in ISO 3166 format. | |
| destination.address.state.name | String | State name | |
| destination.address.country | Object | Destination country | |
| destination.address.country.id | String | Unique identifier assigned by Mercado Libre to the country in ISO 3166 format | |
| destination.address.country.name | String | Country name | |
| destination.address.neighborhood | Object | Destination neighborhood | |
| destination.address.neighborhood.id | String | Unique neighborhood identifier | |
| destination.address.neighborhood.name | String | Neighborhood name | |
| destination.address.municipality | Object | Destination municipality | |
| destination.address.municipality.id | String | Unique identifier assigned by Mercado Libre to the municipality | |
| destination.address.municipality.name | String | Municipality name | |
| package | Object | Shipment packages | |
| package.items | List | List of goods in the shipment | |
| package.items.category | Int | Attribute corresponding in SAT to express the product key for goods or merchandise transported in various means of transport. | |
| package.items.description | String | Description of the merchandise | |
| package.items.unit_code | String | Attribute to specify the standardized unit of measure key applicable to the quantity of goods or merchandise transported in various means of transport. The unit must correspond to the description of the registered goods or merchandise. | |
| package.items.quantity | Int | Merchandise quantity | |
| package.items.dangerous_material | String | Indicates if the product is hazardous material. Value "1" for hazardous material and "0" for non-hazardous. | |
| package.items.dangerous_material_key | String | Hazardous material code. Empty field when not hazardous. | |
| package.items.package_key | String | Package key. | |
| package.items.package_description | String | Package description. | |
| package.items.dimensions | Object | Information about merchandise dimensions | |
| package.items.dimensions.height | Int | Height of the merchandise | |
| package.items.dimensions.width | Int | Width of the merchandise | |
| package.items.dimensions.length | Int | Length of the merchandise | |
| package.items.dimensions.weight | Int | Weight of the merchandise in grams | |
| package.total_items | String | Total quantity of goods in the shipment | |
| return_reverse_logistics_collection | String | Indicates the use of reverse logistics, collection, or return services for transporting goods and/or merchandise. Values: Yes or "" (empty string) |
HTTP Status Code Examples
If an error occurs, the API will return an HTTP status other than 200 with the error, message and cause, and the content-type will be application/json.
400 (bad_request)
A 400 error occurs when the shipment is cancelled.
json1{ 2 "message": "This shipment is cancelled", 3 "error": "bad_request", 4 "status": 400, 5 "cause": [] 6}
403 (NOT_OK)
A 403 error occurs due to lack of access to this API.
json1{ 2 "message": "Access revoked, consult staff to check your permissions", 3 "error": "unexpected_error", 4 "status": 403, 5 "cause": ["error_getshipment"] 6}
404 (NOT_OK)
A 404 error occurs when an incorrect shipment ID is provided.
json1{ 2 "message": "An error occurred while trying to get shipment details", 3 "error": "shipment_not_found", 4 "status": 404, 5 "cause": ["error_getshipment"] 6}
500 (INTERNAL_ERROR)
A 500 error occurs when an internal failure in this API occurs.
json1{ 2 "message": "Error when trying to obtain shipment information", 3 "error": "internal_server_error", 4 "status": 500, 5 "cause": ["INTERNAL_ERROR"] 6}
HTTP Status Code Summary
HTTP Code | Content-Type | Response Body | Description |
|---|---|---|---|
| 200 | application/json | JSON (example above) | When shipment data is successfully obtained. |
| 400 | application/json | {"message": "This shipment is cancelled"...} | When the shipment is cancelled. |
| 400 | application/json | {"message": "Shipment not allowed"...} | When the carrier has submitted a shipment for which it has no action in any process. |
| 403 | application/json | {"message": "Access revoked, consult staff to check your permissions"} | When access to this API is missing. |
| 404 | application/json | {"message": "An error occurred while trying to get shipment details"...} | When an incorrect shipment ID is provided. |
| 500 | application/json | {"message": "Error when trying to obtain shipment information"} | When an internal failure in this API occurs. |
