Consult Carta Porte Information by Middle Mile Route from Mexico

Introduction

The Carta Porte route information query API is designed to provide route, shipment, and fiscal data to carriers involved in transportation who want to generate the fiscal document for Mexico (cfdi+carta-porte). Given a route ID, this API returns the corresponding data (origin, destination, list of shipments, and cost) for that route.

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

bash
1GET https://api.mercadolibre.com/shipping/fiscal/{site_id}/routes/{route_id}/middle-mile/facilities/{facility_id}/details?access_token={access_token}
Parameter
Data Type
Description
Type
site_idStringSite ID. Possible value: MLMRequired
route_idStringRoute IDRequired
facility_idStringName of the logistic center from which the dispatch departs.Required
access_tokenStringAccess tokenRequired
Note: How to get the route ID from the Logistics tool: In the Logistics Monitoring tool, log in with your username and password and search for the ID as shown in the example below.

Response

json
1{ 2 "id": "12345678", 3 "cost": 1234.56, 4 "recipient": { 5 "full_name": "string", 6 "rfc": "string" 7 }, 8 "origin": { 9 "fiscal_information": { 10 "full_name": "string", 11 "rfc": "string", 12 "fiscal_residence": "string" 13 }, 14 "address": { 15 "address_line": "string", 16 "street_name": "string", 17 "street_number": "string", 18 "intersection": "string", 19 "zip_code": "string", 20 "city": { "id": "string", "name": "string" }, 21 "state": { "id": "string", "name": "string" }, 22 "country": { "id": "string", "name": "string" }, 23 "neighborhood": { "id": "string", "name": "string" }, 24 "municipality": { "id": "string", "name": "string" } 25 } 26 }, 27 "destination": { 28 "fiscal_information": { 29 "full_name": "string", 30 "rfc": "string", 31 "fiscal_residence": "string" 32 }, 33 "address": { 34 "address_line": "string", 35 "street_name": "string", 36 "street_number": "string", 37 "intersection": "string", 38 "zip_code": "string", 39 "city": { "id": "string", "name": "string" }, 40 "state": { "id": "string", "name": "string" }, 41 "country": { "id": "string", "name": "string" }, 42 "neighborhood": { "id": "string", "name": "string" }, 43 "municipality": { "id": "string", "name": "string" } 44 } 45 }, 46 "total_items": 1, 47 "shipments": [{ 48 "id": "shipment_id", 49 "url": "/shipments/shipment_id/carta-porte/items/details", 50 "quantity": 1 51 }], 52 "registration_istmo": "", 53 "origin_pole_location": "", 54 "destination_pole_location": "" 55}

The response is an array by entity/type. If the fiscal data for a specific entity cannot be found, the error "Route id not found" is returned, as shown in the example above.

Parameter
Data Type
Description
Type
idStringRoute ID
costFloatFreight cost
recipientObjectRecipient data
recipient.rfcStringRecipient's RFC (Tax ID)
recipient.full_nameStringRecipient's full name
originObjectShipment origin
origin.fiscal_informationObjectOrigin fiscal information
origin.fiscal_information.full_nameStringName of origin responsible party
origin.fiscal_information.fiscal_residenceStringConditional 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.rfcStringRFC of origin responsible party
origin.addressObjectOrigin location
origin.address.address_lineStringField composed of the street_name and street_number fields for the origin
origin.address.street_nameStringOrigin street name.
origin.address.street_numberStringOrigin street number.
origin.address.intersectionStringCross street.
origin.address.zip_codeStringOrigin zip code
origin.address.cityObjectOrigin city
origin.address.city.idStringUnique identifier assigned by Mercado Libre to the city
origin.address.city.nameStringCity name
origin.address.stateObjectOrigin state, department or province
origin.address.state.idStringUnique identifier assigned by Mercado Libre to the state in ISO 3166 format.
origin.address.state.nameStringState name
origin.address.countryObjectOrigin country
origin.address.country.idStringUnique identifier assigned by Mercado Libre to the country in ISO 3166 format
origin.address.country.nameStringCountry name
origin.address.neighborhoodObjectOrigin neighborhood
origin.address.neighborhood.idStringUnique neighborhood identifier
origin.address.neighborhood.nameStringNeighborhood name
origin.address.municipalityObjectOrigin municipality
origin.address.municipality.idStringUnique identifier assigned by Mercado Libre to the municipality
origin.address.municipality.nameStringMunicipality name
destinationObjectShipment destination
destination.fiscal_informationObjectDestination fiscal information
destination.fiscal_information.full_nameStringName of destination responsible party
destination.fiscal_information.rfcStringRFC of destination responsible party
destination.fiscal_information.fiscal_residenceStringConditional 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.addressObjectDestination location
destination.address.address_lineStringField composed of the street_name and street_number fields for the destination
destination.address.street_nameStringDestination street name.
destination.address.street_numberStringDestination street number.
destination.address.intersectionStringCross street.
destination.address.zip_codeStringDestination zip code
destination.address.cityObjectDestination city
destination.address.city.idStringUnique identifier assigned by Mercado Libre to the city
destination.address.city.nameStringCity name
destination.address.stateObjectDestination state, department or province
destination.address.state.idStringUnique identifier assigned by Mercado Libre to the state in ISO 3166 format.
destination.address.state.nameStringState name
destination.address.countryObjectDestination country
destination.address.country.idStringUnique identifier assigned by Mercado Libre to the country in ISO 3166 format
destination.address.country.nameStringCountry name
destination.address.neighborhoodObjectDestination neighborhood
destination.address.neighborhood.idStringUnique neighborhood identifier
destination.address.neighborhood.nameStringNeighborhood name
destination.address.municipalityObjectDestination municipality
destination.address.municipality.idStringUnique identifier assigned by Mercado Libre to the municipality
destination.address.municipality.nameStringMunicipality name
total_itemsIntTotal quantity of goods in the shipment
shipmentsListList of shipments
shipments.idStringShipment ID
shipments.urlStringURL to get shipment details
shipments.url.shipment_idStringDispatch/manifest ID
shipments.quantityintShipment quantity
registration_istmoStringIndicates whether the transfer of goods and/or merchandise takes place within the Development Poles for the Wellbeing of the Isthmus of Tehuantepec. Values: Yes or "" (empty string)
origin_pole_locationStringIndicates where the transfer of goods and/or merchandise begins within the Development Poles for the Wellbeing of the Isthmus of Tehuantepec. Values: (01 to 06)
destination_pole_locationStringIndicates the region where the transfer of goods and/or merchandise ends within the Development Poles for the Wellbeing of the Isthmus of Tehuantepec. Values: (01 to 06)

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.

403 (NOT_OK)

A 403 error occurs due to lack of access to this API.

json
1{ 2 "message": "Access revoked, consult staff to check your permissions", 3 "error": "unexpected_error", 4 "status": 403, 5 "cause": ["error_getroute"] 6}

404 (NOT_OK)

A 404 error occurs when an incorrect route ID is included.

json
1{ 2 "message": "An error occurred while trying to get route details", 3 "error": "route_not_found", 4 "status": 404, 5 "cause": ["error_getroute"] 6}

500 (INTERNAL_ERROR)

A 500 error occurs when an internal failure in this API occurs.

json
1{ 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
200application/jsonJSON (example above)When route data is successfully obtained.
403application/json{"message": "Access revoked, consult staff to check your permissions"}When access to this API is missing.
404application/json{"message": "An error occurred while trying to get route details"...}When an incorrect route ID is included.
500application/json{"message": "Error when trying to obtain route information"}When an internal failure in this API occurs.