Documentation Mercado Libre
Check out all the necessary information about APIs Mercado Libre.
Documentation
Dispatch Information
Sellers integrated with the CAINIAO carrier can manage their shipping preferences through the /dispatch_preferences endpoint. This resource allows for the creation or update of the pickup address and the configuration of shipping preferences, enabling the choice between pick-up or drop-off.
Dispatch Preferences
Search dispatch preferences
To obtain the dispatch preferences associated with a seller, use the following request:
Request:
curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/marketplace/shipments/dispatch_preferences/carriers
For merchant who has active CAINIAO
Response:
{
"name": "Cainiao",
"has_pickup": true,
"sites": [
"MLC",
"MLB",
"MCO",
"MLM"
],
"dispatch_info": {
"pickup": true
}
}
For merchant who does not have active CAINIAO
The successful response will be just a "200 - OK" with an empty return.
{}
Set dispatch preferences
The seller can opt for one of the two available dispatch modalities:
- Pick-up
- Drop-off Agency
The modalities are mutually exclusive. Selecting pickup makes it impossible to register drop-off agencies, just as choosing drop-off agency prevents the configuration of a pickup address.
Associate Pick-Up as dispatch preference
For merchant who has active CAINIAO
To configure pickup as the dispatch modality, use the following request:
Request:
curl -X PUT -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/marketplace/shipments/dispatch_preferences/carriers/$CARRIER_NAME \
-d '{
"pickup": true
}'
Example:
curl -X PUT -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/marketplace/shipments/dispatch_preferences/carriers/cainiao \
-d '{
"pickup": true
}'
The successful response will be just a "200 - OK" with an empty return.
{}
Possible errors when associating pick-up as dispatch preference
Below are the common error scenarios when trying to configure pickup for a seller:
For merchant without active CAINIAO
{
"message": "you don't have this carrier configured",
"error": "some fields are invalid or not accepted in this request",
"status": 400,
"cause": null
}
For merchant with active CAINIAO but no registered pickup address
{
"message": "you don't have pick up address registered",
"error": "some fields are invalid or not accepted in this request",
"status": 400,
"cause": null
}
Associate Drop Off Agency as dispatch preference
For merchant with active CAINIAO
To set a drop-off agency as the seller's dispatch preference, use the following request:
Request:
curl -X PUT -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/marketplace/shipments/dispatch_preferences/carriers/$CARRIER_NAME
-d {
"drop_off_agency": "$AGENCY_CODE"
}'
Example:
curl -X PUT -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/marketplace/shipments/dispatch_preferences/carriers/cainiao
-d '{
"drop_off_agency": "TRAN_0001"
}
The successful response will be just a "200 - OK" with an empty return.
{}
Authorized Agency List: China
| Province | City | Warehouse Address | Warehouse Name | Warehouse Code / Drop off agency |
|---|---|---|---|---|
| Jiangxi Province | Nanchang City | 1st Floor, Building 1, No. 199 Chuangxin Third Road, High-tech Development Zone, Nanchang City, Jiangxi Province | Nanchang Changdong Warehouse | TRAN_STORE_31152718 |
| Jiangxi Province | Shangrao City | No. 219 Xinke Avenue, Economic Development Zone, Dongtuan Township, Guangxin District, Shangrao City, Jiangxi | Shangrao Jingkai Warehouse | TRAN_STORE_31177914 |
| Anhui Province | Hefei City | Suning Logistics Park A01, No. 2889 Chuangxin Avenue, Nangang Town, High-tech Zone, Hefei City, Anhui Province | Hefei Gaoxin Warehouse | TRAN_STORE_31153162 |
| Zhejiang Province | Ningbo City | Warehouse No. 7 (Middle Zone), No. 99 Jucai Road, Ningbo City, Zhejiang Province | Ningbo Jiangbei Warehouse | TRAN_STORE_31121528 |
| Zhejiang Province | Wenzhou City | 4PX Logistics (Building A, 1st Floor), No. 400 Wenzhou Daily, 100 meters northeast of the intersection of Binhai Fifth Road and Binhai Fourteenth Road, Longwan District | Wenzhou Longwan 2 Warehouse | TRAN_STORE_31121279 |
| Zhejiang Province | Yiwu City | 1/2 Zone on the 3rd Floor, Warehouse 1, Zhejiang Baowan Yiwu Logistics Park, Intersection of Sihai Avenue and Shugang Expressway, Yiwu City, Zhejiang Province | Yiwu Choujiang Baowan Regional Sorting Center | TRAN_STORE_31405747 |
| Guangdong Province | Dongguan City | Warehouse 3 (Linkpark) in Dongguan Shatian Logistics Park, First Industrial Park, Shatian Town, Dongguan City, Guangdong Province | Dongguan Shatian No. 3 Hub Sorting Center | TRAN_STORE_31405735 |
| Hebei Province | Baoding City | No. 446 Jingbai Street, Baigou Town, Gaobeidian City, Hebei Province | Baoding Baigou Warehouse | TRAN_STORE_31152915 |
| Beijing | Beijing City | 4PX inside the First Industrial Park, No. 9 Hengtong Road, Economic Development Zone, Miyun District, Beijing City | Beijing Shunyi Warehouse | TRAN_STORE_31152916 |
| Sichuan Province | Chengdu City | 4PX at No. 111-112, Shengfeng Logistics Park, No. 3 Yantang Road, Xindu District, Chengdu City, Sichuan Province | Chengdu Xindu Warehouse | TRAN_STORE_31152813 |
| Liaoning Province | Huludao City | 4PX at No. 21 Tiexi Road, Ningyuan Street, Xingcheng City, Huludao City, Liaoning Province | Huludao Xingcheng Warehouse | TRAN_STORE_31153201 |
| Henan Province | Nanyang City | 4PX Express, Unit 1, Building 11, Nanyang Sino-European Industrial Park, Donggang Village Community, Qilin Road, Jinggang Street, Wolong District, Nanyang City, Henan Province | Nanyang Wolong Warehouse | TRAN_STORE_31152060 |
| Hebei Province | Shijiazhuang City | 4PX Express, 5-2-103, Tianshan Technology Industrial Park, No. 319 Xiangjiang Road, Yuhua District, Shijiazhuang City, Hebei Province | Shijiazhuang Gaoxin Warehouse | TRAN_STORE_31152106 |
| Tianjin | Tianjin City | 4PX inside Shenzhoutong Logistics Park, No. 39 Middle Ring South Road, Airport Economic Zone, Dongli District, Tianjin City | Tianjin Dongli Warehouse | TRAN_STORE_31154181 |
| Henan Province | Xuchang City | 4PX Express, Wanli Logistics Park, 100 meters southeast of the intersection of Nanhuandong Road and Wen'an Road, Jian'an District, Xuchang City, Henan Province | Xuchang Jian'an Warehouse | TRAN_STORE_31296697 |
| Henan Province | Zhengzhou City | 4PX Express, East Zone, Warehouse 3, Zhongyuan Logistics Park, Intersection of Xunjiang East Road and Huaxi Street, Economic Development Zone, Zhengzhou City, Henan Province | Zhengzhou Jingkai Warehouse | TRAN_STORE_31152279 |
| Chongqing | Chongqing City | 4PX on the 3rd Floor, Building 2, Chongqing Hongdali Food Co., Ltd., No. 100 Baohuan East Road, Yubei District, Chongqing City | Chongqing Jiulongpo Warehouse | TRAN_STORE_31152943 |
| Hubei Province | Wuhan City | 4PX inside Zhongyuan Logistics Park, intersection of Xincheng Thirteenth Road and Jinshan Avenue, Dongxihu District, Wuhan City, Hubei Province | Wuhan Jiangcheng Warehouse | TRAN_STORE_30500252 |
Authorized Agency List: Hong Kong
| Province | City | Warehouse Address | Warehouse Name | Warehouse Code / Drop off agency |
|---|---|---|---|---|
| New Territories | Yuen Long | 4PX Warehouse B, DD129 LOT 3299RP Ping Ha Road, Ha Tsuen, Lau Fau Shan, Yuen Long, New Territories, Hong Kong SAR (Opposite to Hoi Fai Heavy Container Yard) | Hong Kong First-Mile Yuen Long Warehouse | TRAN_STORE_13423798 |
Possible errors when associating Drop Off Agency as dispatch preference
Invalid Drop Off Agency for merchant with active CAINIAO
Request:
curl -X PUT -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/marketplace/shipments/dispatch_preferences/carriers/cainiao
-d '{
"drop_off_agency": "TRAN_0001"
}
Response:
{
"message": "invalid agency informed for carrier Cainiao ",
"error": "some fields are invalid or not accepted in this request",
"status": 400,
"cause": null
}
}
Drop Off Agency for merchant with invalid carrier
Request:
curl -X PUT -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/marketplace/shipments/dispatch_preferences/carriers/mailamericas
-d '{
"drop_off_agency": "TRAN_STORE_31405735"
}
Response:
{
"message": "invalid agency informed for carrier MailAmericas",
"error": "some fields are invalid or not accepted in this request",
"status": 400,
"cause": null
}
}
Associate pick-up address
To assign or update a pick-up address, you must enter the full address. All fields are mandatory.
Example request:
curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
https://api.mercadolibre.com/marketplace/shipments/dispatch_preferences/pick_up_addresses \
-d '{
"address_line": "中国广东省惠州市惠城区江北云山金世界雅景苑B座14A",
"zip_code": "516003",
"phone": "10101010",
"city": {
"id": "Q04tR0RIdWl6aG91",
"name": "Huizhou"
},
"state": {
"id": "CN-GD",
"name": "Guangdong"
},
"country": {
"id": "CN",
"name": "China"
},
"additional_info": "惠城区"
}'
The successful response will be just a "200 - OK" with an empty return.
{}
Mandatory fields:
| Field | Description |
|---|---|
| address_line | Full address of the pickup location (street and number). For addresses in China, the field must mandatory contain the characters 省 (province) and 市 (city). |
| zip_code | Postal code, must contain exactly 6 digits. |
| city | Object containing the ID and the identifying name of the city. |
| state | Object containing the ID and the identifying name of the state/province. |
| country | Object containing the ID and the identifying name of the country. |
| additional_info | City district. |
Optional fields:
phone: Phone number of the seller's pickup warehouse.
Possible errors when associating the pick-up address
When configuring the pickup address, the following inconsistencies may occur. It is fundamental to understand the cause of each error to perform the appropriate handling and ensure correct integration. Below, we detail the necessary information to identify and solve these problems:
| Error | Status | Message / Cause | Solution |
|---|---|---|---|
| Invalid JSON body | 400 | Invalid body | Ensure the request body is valid JSON. |
| Missing address_line | 400 | missing properties: 'address_line' | Include the address_line field. |
| Missing city | 400 | missing properties: 'city' | Include the city object with id and name. |
| Missing state | 400 | missing properties: 'state' | Include the state object with id and name. |
| Missing country | 400 | missing properties: 'country' | Include the country object with id and name. |
| Invalid address_line format | 400 | address_line: does not match pattern | Ensure address contains 省 (province) and 市 (city) characters. |
| Invalid zip_code format | 400 | zip_code: does not match pattern '^[\d]{6}$' | Provide exactly 6 digits for the postal code. |
| City not in address | 400 | the city specified [CityName] does not appear in the address line | Ensure the city name appears within the address_line text. |
| Unauthorized | 403 | At least one policy returned UNAUTHORIZED. | Verify credentials and access token permissions. |
Get pick-up address
To determine if the merchant has the correct pick-up address, you can make the following request:
Request:
curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/marketplace/shipments/dispatch_preferences/pick_up_addresses
Merchant with registered pick-up address
Response:
[
{
"sites": [
"MLC",
"MLB",
"MCO",
"MLM"
],
"address_id": 1434131662,
"address_line": "广东省东莞市厚街镇赤岭(三屯)福民路86号正通B幢二楼(I0798)",
"zip_code": "523000",
"additional_info": "",
"phone": "15999934561",
"city": {
"id": "Q04tR0REb25nZ3Vhbg",
"name": "Dongguan"
},
"state": {
"id": "CN-GD",
"name": "Guangdong"
},
"country": {
"id": "CN",
"name": "China"
}
}
]
Merchant without registered pick-up address
The successful response will be just a "200 - OK" with an empty return.
{}
GET — Retrieve Return Address
Returns the return address registered for the authenticated merchant.
Request
GET /marketplace/shipments/dispatch_preferences/return_address
Headers:
Authorization: Bearer <token>
Body: none
Full example:
curl -X GET \
'https://cbt-shipping-op-api.melisystems.com/marketplace/shipments/dispatch_preferences/return_address' \
-H 'Authorization: Bearer <token>'
Response
200 OK — Return address found:
{
"address_line": "浙江省 永康市 北湖路18号",
"zip_code": "321300",
"phone": "11111111111",
"additional_info": null,
"city": {
"id": "Q04tWkpZb25na2FuZw",
"name": "永康市"
},
"state": {
"id": "CN-ZJ",
"name": "浙江省"
},
"country": {
"id": "CN",
"name": "中国"
}
}
404 Not Found — No return address registered:
{
"message": "...",
"status": 404
}
403 Forbidden — Invalid token or merchant could not be identified.
500 Internal Server Error
POST — Create or Update Return Address (Upsert)
Creates or updates (upsert) the return address for the authenticated merchant. Upsert semantics: each merchant has exactly one return address; subsequent calls overwrite the previous one.
Request
POST /marketplace/shipments/dispatch_preferences/return_address
Headers:
Authorization: Bearer <token>
Content-Type: application/json
Body:
| Field | Type | Required | Validation | Description |
|---|---|---|---|---|
address_line |
string | yes | minLength: 1, maxLength: 50 | Full address |
zip_code |
string | yes | digits only [0-9]+, maxLength: 20 |
ZIP / postal code |
phone |
string | yes | exactly 11 digits ^[0-9]{11}$ |
Contact phone number |
city |
object | yes | — | City |
city.id |
string | yes | minLength: 1, maxLength: 50 | City ID |
city.name |
string | yes | minLength: 1, maxLength: 50 | City name |
country |
object | yes | — | Country |
country.id |
string | yes | exactly 2 characters | Country code (e.g. CN) |
country.name |
string | yes | minLength: 1, maxLength: 50 | Country name |
state |
object | no | — | State / province (optional) |
state.id |
string | no | minLength: 4, maxLength: 8 | State ID (e.g. CN-ZJ) |
state.name |
string | no | maxLength: 50 | State name |
additional_info |
string | no | maxLength: 10 | Additional address information |
Full body example (all fields):
{
"address_line": "浙江省 永康市 北湖路18号",
"zip_code": "321300",
"phone": "11111111111",
"city": {
"id": "Q04tWkpZb25na2FuZw",
"name": "永康市"
},
"state": {
"id": "CN-ZJ",
"name": "浙江省"
},
"country": {
"id": "CN",
"name": "中国"
},
"additional_info": "2F"
}
Minimal example (required fields only):
{
"address_line": "浙江省 永康市 北湖路18号",
"zip_code": "321300",
"phone": "11111111111",
"city": {
"id": "Q04tWkpZb25na2FuZw",
"name": "永康市"
},
"country": {
"id": "CN",
"name": "中国"
}
}
Full curl example:
curl -X POST \
'https://cbt-shipping-op-api.melisystems.com/marketplace/shipments/dispatch_preferences/return_address' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"address_line": "浙江省 永康市 北湖路18号",
"zip_code": "321300",
"phone": "11111111111",
"city": { "id": "Q04tWkpZb25na2FuZw", "name": "永康市" },
"state": { "id": "CN-ZJ", "name": "浙江省" },
"country": { "id": "CN", "name": "中国" }
}'
Response
200 OK — Return address successfully created or updated:
{
"address_line": "浙江省 永康市 北湖路18号",
"zip_code": "321300",
"phone": "11111111111",
"additional_info": null,
"city": {
"id": "Q04tWkpZb25na2FuZw",
"name": "永康市"
},
"state": {
"id": "CN-ZJ",
"name": "浙江省"
},
"country": {
"id": "CN",
"name": "中国"
}
}
400 Bad Request — Invalid body (schema validation failure):
{
"message": "Invalid body",
"cause": ["<invalid field detail>"],
"status": 400
}
403 Forbidden — Invalid token.
500 Internal Server Error
Response Fields Detail
| Field | Type | Always present | Notes |
|---|---|---|---|
address_line |
string | yes | — |
zip_code |
string | yes | — |
phone |
string | yes | — |
additional_info |
string | null | yes | null when not registered |
city.id |
string | yes | — |
city.name |
string | yes | — |
state.id |
string | yes | — |
state.name |
string | yes | — |
country.id |
string | yes | — |
country.name |
string | yes | — |
Technical notes
- No pagination: each merchant has exactly one return address.
- Idempotency: multiple POSTs with the same data are safe; the last one submitted takes precedence.