Documentación Mercado Libre
Descubre toda la información que debes conocer sobre las APIs de Mercado Libre.Documentación
Stock Management in Full and Flex coexistence
Now sellers can manage the stock in their warehouse and the stock in Full separately, to have a better experience that helps them make more sales and have fewer cancellations.
It is important to consider that in order to use this resource, you must have Flex and Fulfillment shipping methods active, in addition to having items in Full stock.
This feature, for now, should only be used for listings that have Full and Flex coexistence enabled. Before using this feature, validate that the listing has the logistic_type fulfillment and the tag self_service_in, as these two fields indicate that the listing is in coexistence of both logistics.
Notifications
Soon, we will make available the stock_locations topic notifications for when the stock_locations of the user_product are modified, either by increasing or decreasing the quantity field
Obtaining the stock of an item
To check the item stock, you must first get the user_product_id. To do this, query the field using the /items feature. If the item has variations, you must get the user_product_id from the variations array.
Request:
curl -X GET -h 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/user-products/$USER_PRODUCT_ID/stock
Example:
curl -X GET -h 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/user-products/MLAU12345678/stock
Response:
{
"locations":
[
{
"type": "meli_facility",
"quantity": 5
}
{
"type": "selling_address",
"quantity": 9
}
],
"id": "MLAU12345678",
"user_id": 1376088286
}
Response fields:
- Type: allows differentiating the item's locations.
- selling_address: available stock in the seller's warehouse (Flex).
- meli_facility: stock managed by Fulfillment.
When querying the endpoint, it will return a header called "x-version" which will have an integer value (of type long) that will represent the entity's version.
This header must be sent when modifying entities, if it is not sent, a bad request status code: 400 will be returned, and if the version sent is no longer the last one in the entity to be modified, a conflict status code: 409 will be returned.
In case of a response with status code 409, you must perform another GET to the entity to be modified, to get the updated version of the x-version header.
Modify the item stock
To start selling, you must enter the stock of the item in selling_address. It is not allowed to change the stock from Full.
The seller account must have Flex enabled and the item must have Full stock.
Request:
curl -X PUT -h 'Authorization: Bearer $ACCESS_TOKEN' -h 'x-version:$HEADER -h 'Content-Type: application/json'
https://api.mercadolibre.com/user-products/$USER_PRODUCT_ID/stock/type/selling_address -d
{
"quantity": XX
}
Example:
curl -X PUT -h 'Authorization: Bearer $ACCESS_TOKEN' -h 'x-version:$HEADER -h 'Content-Type: application/json'
https://api.mercadolibre.com/user-products/MLAU12345678/stock/type/selling_address -d
{
"quantity": 10
}
Response:
204 OK