Documentation Mercado Libre
Check out all the necessary information about APIs Mercado Libre.
Documentation
Start testing
Send access token via header
For enhanced security, we recommend sending your access token via header when making API calls. This prevents your token from appearing in server logs or browser history.
Example:
curl -H 'Authorization: Bearer $ACCESS_TOKEN' \
https://api.mercadolibre.com/users/me
Create a global test user
Create a test user for Global Selling (Cross-Border Trade) operations. You must specify both the site_id (always "CBT") and the country_id ("US" for United States or "CN" for China).
Request (US Origin):
curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" https://api.mercadolibre.com/users/global_selling_test_user -d
{
"site_id": "CBT",
"country_id": "US"
}
Request (China Origin):
curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" https://api.mercadolibre.com/users/global_selling_test_user -d
{
"site_id": "CBT",
"country_id": "CN"
}
Response:
{
"id": 2608734521,
"nickname": "TESTGSELL2608734521",
"password": "qatest9132",
"site_status": "active",
"email": "test_user_gs_2608734521@testuser.com"
}
On the response you get the following fields:
- id: The unique identifier of the created test user.
- nickname: The username assigned to the test user.
- password: The password for the test user account. Store this securely; it cannot be recovered.
- site_status: The current status of the user. Returns
"active"upon successful creation. - email: The email address assigned to the test user.
Create a marketplace test user
In addition, you can create marketplace test users, in order to be able to do end-to-end tests, buying and selling between these.
Supported marketplaces: MLA (Argentina), MLB (Brazil), MLC (Chile), MCO (Colombia), MLM (Mexico), MPE (Peru).
Example:
curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" https://api.mercadolibre.com/users/test_user -d
{
"site_id": "MLM"
}
Response:
{
"id": 2608891234,
"nickname": "TESTXYZ2608891234",
"password": "qatest4521",
"site_status": "active",
"email": "test_user_2608891234@testuser.com"
}
On the response you get the following fields:
- id: The unique identifier of the created test user.
- nickname: The username assigned to the test user.
- password: The password for the test user account. Store this securely; it cannot be recovered.
- site_status: The current status of the user. Returns
"active"upon successful creation. - email: The email address assigned to the test user.
Possible errors
The following errors may occur when creating test users:
Global Test User errors (POST /users/global_selling_test_user):
| Status | Error | Message | Solution |
|---|---|---|---|
| 400 | bad_request | country_id is required | Include country_id with value "US" or "CN". |
| 400 | bad_request | site_id is required | Include site_id parameter in the request body. |
| 400 | bad_request | invalid site_id | Use "CBT" as site_id. Must be uppercase. |
| 400 | bad_request | site_id cannot be null | Provide a valid string value, not null. |
| 400 | bad_request | site_id cannot be empty | Provide a non-empty string value. |
| 400 | bad_request | invalid site_id type | Ensure site_id is a string, not a number. |
| 400 | bad_request | Malformed JSON | Verify the request body contains valid JSON syntax. |
| 400 | bad_request | Invalid request body | Include a valid JSON body in the request. |
| 403 | forbidden | Invalid client.id | Verify your access token is valid and not expired. |
Marketplace Test User errors (POST /users/test_user):
| Status | Error | Message | Solution |
|---|---|---|---|
| 400 | bad_request | site_id is required | Include site_id parameter in the request body. |
| 400 | bad_request | invalid site_id | Use a valid site_id (MLA, MLB, MLC, MCO, MLM, MPE). Must be uppercase. |
| 400 | bad_request | invalid clientID format | Verify your access token format is correct. |
Considerations
When working with test users, you need to take into account the following considerations:
- Once you have created the test user for a global seller, you have to access global-selling to configure the marketplace account's.
- You can create up to 10 test users with your Mercado Libre account and these cannot be eliminated by the user, nor by Mercado Libre.
- Test users won't be active for too long, but once they expire, you can create new ones.
- Test items must be titled "Test item - Do not offer" (Test Item - Please DO NOT BID) to clearly identify them as test listings.
- List under the "Others" category as much as possible.
- Never publish with "gold" or "gold_premium" listing types to prevent your test items from appearing on the homepage.
- Test users can simulate operations only with listings from other test users: they can only buy, sell, ask questions, etc., in test list, created by test accounts.
- Test users showing no activity (buy, ask, publish, etc.) during 60 days are immediately removed.
- Test items are removed regularly.
- The email's validation code for test users will be equal to the last digits of the user ID and can have 4 or 6 digits. For example, for user ID 653764425, the code could be 764425.
- All site_id and country_id values are case-sensitive and must be in UPPERCASE.
Buy and sell between test users
Remember that tests on the platform and all transactions must be done with test users. In addition, personal accounts should not contain ads. If you want to simulate purchases between test users, you could use our test cards. Remember that testing on the platform and all transactions must be done between test users. In addition, personal accounts must not contain listings for this purpose.
Next: Application and permissions.