Query Stock Withdrawal Information by Dispatch/Manifest for Carta Porte from Mexico
Introduction
The API for querying Carta Porte stock withdrawal information by dispatch aims to provide route data, shipments, fiscal data, and shipment details to carriers involved in transportation who wish to generate the tax document for Mexico (cfdi+carta-porte). Given a dispatch/manifest ID, this API returns the corresponding data (origin, destination, list of shipments) for it.
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}/withdrawal/dispatch/{dispatch_id}?access_token={access_token}
Parameters:
Parameter | Type | Description |
|---|---|---|
| site_id | String | Site ID. Possible value: MLM |
| dispatch_id | String | Dispatch/manifest ID |
| access_token | String | Access token |
Where can I find these parameters in the shipping document?
Response
json1{ 2 "id": "12345678", 3 "recipient": { 4 "full_name": "string", 5 "rfc": "string" 6 }, 7 "origin": { 8 "fiscal_information": { 9 "full_name": "string", 10 "rfc": "string", 11 "fiscal_residence": "string" 12 }, 13 "address": { 14 "address_line": "string", 15 "street_name": "string", 16 "street_number": "string", 17 "intersection": "string", 18 "zip_code": "string", 19 "city": { "id": "string", "name": "string" }, 20 "state": { "id": "string", "name": "string" }, 21 "country": { "id": "string", "name": "string" }, 22 "neighborhood": { "id": "string", "name": "string" }, 23 "municipality": { "id": "string", "name": "string" } 24 } 25 }, 26 "shipments": [{ 27 "id": "shipment_id", 28 "url": "/shipping/fiscal/MLM/withdrawal/shipment/{shipment_id}/items/details" 29 }], 30 "registration_istmo": "", 31 "origin_pole_location": "", 32 "destination_pole_location": "" 33}
The response is an object. Each entity/type may contain an array of items. If fiscal data for a specific entity cannot be found, the error "Route id not found" is returned.
Response Parameters:
Parameter | Type | Description |
|---|---|---|
| id | String | Route ID |
| cost | Float | Freight cost |
| recipient | Object | Recipient data |
| recipient.rfc | String | Recipient RFC |
| recipient.full_name | String | Recipient name |
| origin | Object | Shipment origin |
| origin.fiscal_information | Object | Origin fiscal information |
| origin.fiscal_information.full_name | String | Name of the origin responsible party |
| origin.fiscal_information.fiscal_residence | String | Conditional attribute to record the country key of fiscal residence for the federal cargo transport operator, per the c_Pais catalog on the SAT portal, based on ISO 3166-1. |
| origin.fiscal_information.rfc | String | RFC of the origin responsible party |
| origin.address | Object | Origin location |
| origin.address.address_line | String | Compound field made up of the street_name and street_number fields of the origin |
| origin.address.street_name | String | Origin street name |
| origin.address.street_number | String | Origin street number |
| origin.address.intersection | String | Secondary 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 |
| shipments | List | List of shipments |
| shipments.id | String | Shipment ID |
| shipments.url | String | URL to obtain shipment details |
| shipments.url.shipment_id | String | Dispatch/manifest ID |
| registration_istmo | String | Indicates whether the transfer of goods and/or merchandise takes place within the Isthmus of Tehuantepec Development Zones. Values: "Sí" or "" (empty string) |
| origin_pole_location | String | Indicates where the transfer of goods and/or merchandise starts within the Isthmus of Tehuantepec Development Zones. Values: (01 to 06) |
| destination_pole_location | String | Indicates the region where the transfer of goods and/or merchandise ends within the Isthmus of Tehuantepec Development Zones. Values: (01 to 06) |
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 occurs in this API.
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) | Route data retrieved successfully. |
| 403 | application/json | {"message": "Access revoked, consult staff to check your permissions"} | Lack of access to this API. |
| 404 | application/json | {"message": "An error occurred while trying to get route details"...} | Incorrect route ID included. |
| 500 | application/json | {"message": "Error when trying to obtain route information"} | Internal failure in this API. |
