Consult Carta Porte Information by Route from Mexico
Introduction
The Carta Porte route information query API is designed to provide route and shipment data to logistics 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 (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/routes/{route_id}/carta-porte-details?access_token={access_token}
Parameter | Data Type | Description | Type |
|---|---|---|---|
| route_id | String | Route ID | 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 "registration_istmo": "", 5 "origin_pole_location": "", 6 "destination_pole_location": "", 7 "shipments": [{ 8 "id": "shipment_id", 9 "url": "/shipments/shipment_id/carta-porte-details/step_type" 10 }] 11}
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 | |
| 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) | |
| 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.url.step_type | String | Name of the desired section. Possible values: first_mile, middle_mile, last_mile |
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. |
