Documentação do Mercado Livre

Confira todas as informações necessárias sobre as APIs Mercado Livre.
circulos azuis em degrade

Documentação do

Última atualização em 11/01/2024

Stock Management in Full and Flex coexistence

Important:
The new endpoint is available only for sellers of Chile.
Activation on new sites will be communicated in advance.
MLA: the activation will be in parts:
23/1: Sellers with last number of cust_id 0
30/1: Sellers with last number of cust_id 1, 2 or 3
6/2: Rest total

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.

Note:
The rate limit for this resource is 100 RPM.

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.
  • Quantity: quantity of items available for sale.

  • 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