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
bash1GET 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_id | String | Site ID. Possible value: MLM | Required |
| route_id | String | Route ID | Required |
| facility_id | String | Name of the logistic center from which the dispatch departs. | Required |
| access_token | String | Access token | Required |
| 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
json1{ 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 |
|---|---|---|---|
| id | String | Route ID | |
| cost | Float | Freight cost | |
| 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 | |
| total_items | Int | Total quantity of goods in the shipment | |
| shipments | List | List of shipments | |
| shipments.id | String | Shipment ID | |
| shipments.url | String | URL to get shipment details | |
| shipments.url.shipment_id | String | Dispatch/manifest ID | |
| shipments.quantity | int | Shipment quantity | |
| registration_istmo | String | Indicates 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_location | String | Indicates 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_location | String | Indicates 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.
json1{ 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.
json1{ 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.
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 route data is successfully obtained. |
| 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 route details"...} | When an incorrect route ID is included. |
| 500 | application/json | {"message": "Error when trying to obtain route information"} | When an internal failure in this API occurs. |
