Query Stock Withdrawal Item Information by Shipment for Carta Porte from Mexico

Introduction

The API for querying Carta Porte item information by stock withdrawal shipment aims to provide item data to carriers involved in transportation who wish to generate the tax document for Mexico (cfdi+carta-porte). Given a shipment ID, this API returns the data (list of products) 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/shipment/{shipment_id}/items/details?access_token={access_token}

Parameters:

Parameter
Type
Description
site_idStringSite ID. Possible value: MLM
shipment_idStringShipment ID
access_tokenStringAccess token

Response

json
1{ 2 "package": { 3 "items": [ 4 { 5 "category": int, 6 "description": "string", 7 "unit_code": "string", 8 "quantity": int, 9 "dimensions": { 10 "height": int, 11 "width": int, 12 "length": int, 13 "weight": int 14 } 15 } 16 ], 17 "total_items": 5 18 }, 19 "return_reverse_logistics_collection": "" 20}

The response is an object. The package field contains an array of items. If fiscal data for a specific entity cannot be found, the error "Shipment id not found" is returned.

Response Parameters:

Parameter
Type
Description
packageObjectShipment packages
package.itemsListList of merchandise in the shipment
package.items.categoryIntSAT attribute to express the product key for the goods or merchandise transported across the various modes of transport
package.items.descriptionStringDescription of the merchandise
package.items.unit_codeStringAttribute to specify the standardized unit of measurement code applicable to the quantity of goods or merchandise transported across the various modes of transport. The unit must correspond to the description of the registered goods or merchandise.
package.items.quantityIntQuantity of merchandise
package.items.dimensionsObjectMerchandise dimension information
package.items.dimensions.heightIntMerchandise height
package.items.dimensions.widthIntMerchandise width
package.items.dimensions.lengthIntMerchandise length
package.items.dimensions.weightIntMerchandise weight in grams
package.total_itemsIntTotal number of merchandise items in the shipment
return_reverse_logistics_collectionStringIndicates the use of any reverse logistics, collection, or return service for the transfer of goods and/or merchandise. Values: "Sí" or "" (empty string)

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.