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
bash1GET https://api.mercadolibre.com/shipping/fiscal/{site_id}/withdrawal/shipment/{shipment_id}/items/details?access_token={access_token}
Parameters:
Parameter | Type | Description |
|---|---|---|
| site_id | String | Site ID. Possible value: MLM |
| shipment_id | String | Shipment ID |
| access_token | String | Access token |
Response
json1{ 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 |
|---|---|---|
| package | Object | Shipment packages |
| package.items | List | List of merchandise in the shipment |
| package.items.category | Int | SAT attribute to express the product key for the goods or merchandise transported across the various modes of transport |
| package.items.description | String | Description of the merchandise |
| package.items.unit_code | String | Attribute 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.quantity | Int | Quantity of merchandise |
| package.items.dimensions | Object | Merchandise dimension information |
| package.items.dimensions.height | Int | Merchandise height |
| package.items.dimensions.width | Int | Merchandise width |
| package.items.dimensions.length | Int | Merchandise length |
| package.items.dimensions.weight | Int | Merchandise weight in grams |
| package.total_items | Int | Total number of merchandise items in the shipment |
| return_reverse_logistics_collection | String | Indicates 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.
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. |
