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

bash
1GET https://api.mercadolibre.com/shipping/fiscal/{site_id}/withdrawal/dispatch/{dispatch_id}?access_token={access_token}

Parameters:

Parameter
Type
Description
site_idStringSite ID. Possible value: MLM
dispatch_idStringDispatch/manifest ID
access_tokenStringAccess token

Where can I find these parameters in the shipping document?

Response

json
1{ 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
idStringRoute ID
costFloatFreight cost
recipientObjectRecipient data
recipient.rfcStringRecipient RFC
recipient.full_nameStringRecipient name
originObjectShipment origin
origin.fiscal_informationObjectOrigin fiscal information
origin.fiscal_information.full_nameStringName of the origin responsible party
origin.fiscal_information.fiscal_residenceStringConditional 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.rfcStringRFC of the origin responsible party
origin.addressObjectOrigin location
origin.address.address_lineStringCompound field made up of the street_name and street_number fields of the origin
origin.address.street_nameStringOrigin street name
origin.address.street_numberStringOrigin street number
origin.address.intersectionStringSecondary 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
shipmentsListList of shipments
shipments.idStringShipment ID
shipments.urlStringURL to obtain shipment details
shipments.url.shipment_idStringDispatch/manifest ID
registration_istmoStringIndicates whether the transfer of goods and/or merchandise takes place within the Isthmus of Tehuantepec Development Zones. Values: "Sí" or "" (empty string)
origin_pole_locationStringIndicates where the transfer of goods and/or merchandise starts within the Isthmus of Tehuantepec Development Zones. Values: (01 to 06)
destination_pole_locationStringIndicates 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.

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 occurs in this API.

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)Route data retrieved successfully.
403application/json{"message": "Access revoked, consult staff to check your permissions"}Lack of access to this API.
404application/json{"message": "An error occurred while trying to get route details"...}Incorrect route ID included.
500application/json{"message": "Error when trying to obtain route information"}Internal failure in this API.