Documentación Mercado Libre

Descubre toda la información que debes conocer sobre las APIs de Mercado Libre.
circulos azuis em degrade

Documentación

Última actualización 20/12/2024

Multi-Origin Stock

Important:
The initiative will be in production starting October 2024, beginning with Mexico. To perform testing, you must request the setup of your test users in Mexico (MLM) using this form. Such activations will be performed on Fridays (every 15 days).

The goal of Multi-Origin Stock is to represent a seller with multiple locations or stores.

The ultimate purpose, along with the Prices by Variation initiative, is to enable a seller's products to have stock distributed across their various locations.

The concept of seller_warehouse is introduced to represent a seller who has more than one store or point of sale.

Each seller will maintain a single logistics, which means that although a seller has several locations, all will operate under the same logistics configured in their account, such as Mercado Envios Coleta (crossdocking).

It is important to note that the Multi-Origin Stock flow does not apply to Mercado Envios 1.

In this documentation, you will find important information for each of the flows that will be impacted by this initiative, starting with:

  • Management of sellers.
  • Publication of items with multi-origin stock.
  • Stock management by warehouse.

Identify Multi-Warehouse Seller

Note:

Not all sellers will have the functionality activated in their account. Seller activation will be controlled and subject to criteria defined by Mercado Libre, such as the type of logistics they operate, the addresses they ship from, among others.

To identify that the user has the functionality activated in their account, we will use the tag "warehouse_management" on /users.

Request:

curl -X GET https://api.mercadolibre.com/users/$USER_ID -H 'Authorization: Bearer $ACCESS_TOKEN'

Example:

curl -X GET https://api.mercadolibre.com/users/1008002397 -H 'Authorization: Bearer $ACCESS_TOKEN'

Response:

{
  "id": 1008002397,
  "nickname": "TETE9326760",
  "registration_date": "2021-10-27T14:48:55.000-04:00",
  "first_name": "Test",
  "last_name": "Test",
  "gender": "",
  "country_id": "MX",
  ...
  "tags": [
    "normal",
    "user_product_seller",
    "warehouse_management",
    "mshops"
  ],
  ...
}

Warehouse Management

Note:

The ability to create locations for the same seller_id is only available from each seller's account through the Mercado Libre panel, in Sales -> Sales preferences -> My warehouses.

Search for user deposits (stores)

To identify the deposits created by each user, you must use the following endpoint:

Request:

curl -X GET https://api.mercadolibre.com/users/$USER_ID/stores/search?tags=stock_location -H 'Authorization: Bearer $ACCESS_TOKEN'

Example:

curl -X GET https://api.mercadolibre.com/users/1008002397/stores/search?tags=stock_location -H 'Authorization: Bearer $ACCESS_TOKEN'

Response:


{
    "paging": {
        "limit": 50,
        "total": 2
    },
    "results": [
        {
            "id": "100",
            "user_id": "200",
            "description": "my store",
            "status": "active",
            "location": {
                "address_id": 501,
                "address_line": "Calle 31 Pte 260",
                "street_name": "Calle 31 Pte",
                "street_number": 260,
                "latitude": 21.1637963,
                "longitude": -86.8737132,
                "city": "Cancún/Benito Juárez",
                "state": "Quintana Roo",
                "country": "Mexico",
                "zip_code": "77518"
            },
            "tags": ["stock_location"],
            "network_node_id": "123451"
        },
        {
            "id": "101",
            "user_id": "200",
            "description": "my store 2",
            "status": "active",
            "location": {
                "address_id": 502,
                "address_line": "Calle 30 Pte 300",
                "street_name": "Calle 30 Pte",
                "street_number": 300,
                "latitude": 21.1637963,
                "longitude": -86.8737132,
                "city": "Cancún/Benito Juárez",
                "state": "Quintana Roo",
                "country": "Mexico",
                "zip_code": "77518"
            },
            "tags": ["stock_location"],
            "network_node_id": "571615"
        }
    ]
}

Creation of Multi-Warehouse Items

The new structure of the Item, with its User Product and Stock Locations, will be in the following format:


Where the User Product will group all items that match, based on the UP rules, but now it will also have the entity Stock_Location to group the stock of the items, allowing the identification of the available quantity in each warehouse (store).


For the creation of new items with stock assigned to the warehouses, both traditional and catalog ones in sellers with the tag "warehouse_management", you must use the following resource:

Note:

Refer to the documentation on publishing a product to understand the complete structure of publishing an Item.

Call:

curl POST --'https://api.mercadolibre.com/items/multiwarehouse' -H 'Content-Type: application/json' -H 'Authorization: Bearer $ACCESS_TOKEN' -d 
    {
        "title": "Tomato Can Item",
        "category_id": "MLB455668",
        "price": 1000,
        "listing_type_id": "gold_special",
        "currency_id": "ARS",
        ...
        "channels": [
            "marketplace"
        ],
        "stock_locations": [
        {
            "store_id": "123456",
            "network_node_id": "123451",
            "quantity": 10
        }
        ...
    ] 
    }

Response:

{
    "id": "MLM2198240631",
    "site_id": "MLM",
    "title": "Tomato Can Item",
    "seller_id": 123456789,
    "category_id": "MLM191212",
    "user_product_id": "MLMU123456789",
    "price": 1000,
    "base_price": 1000,
    ...
    "channels": [
        "marketplace"
    ],
    "stock_locations": [
        {
            "store_id": "123456",
            "quantity": 10,
            "network_node_id": "MXP123451"
        }
    ]
 } 
    

Response Status Codes:

Code Message Description Recommendation
201 OK Item created -
400 The fields [stock_locations] are required for requested call Field stock_locations not found in the request Include at least one of the seller's stores to create the item
400 Store does not belong to seller: 000 The store ID does not belong to the specified user Check the seller's stores
400 Store not found: 000 The store ID does not exist Check the seller's stores
400 The fields [available_quantity] are invalid for requested call The field available_quantity is not allowed for this user Once the user has the warehouse_management tag, they can no longer publish with available_quantity; they must include stock_locations

Considerations:

  • Both store_id and network_node_id will be in the response of the search for the seller's stores.
  • After publishing, it will no longer be possible to find stock_location in the Item request; instead, you should start using the stock query resource of user_product.
  • You must save the user_product_id from the response, which will be used later for stock management.

Consult Stock Details of Warehouses (User Products)

To consult the stock of the warehouses, use the following endpoint indicating the user_product_id of the created Item.

Call:

curl -X GET https://api.mercadolibre.com/user-products/$USER_PRODUCT_ID/stock -H 'Authorization: Bearer $ACCESS_TOKEN'

Example:

curl -X GET https://api.mercadolibre.com/user-products/MLMU123456789/stock -H 'Authorization: Bearer $ACCESS_TOKEN'

Response:

{
    "locations": [
        {
            "type": "seller_warehouse",
            "network_node_id": "123451",
            "store_id": "9876543",
            "quantity": 15
        },
        {
            "type": "seller_warehouse",
            "network_node_id": "571615",
            "store_id": "9876553",
            "quantity": 25
        }
    ],
    "user_id": 1234,
    "id": "MLMU123456789"
 }
 
 

Stock Management by Location

Note:

In the previous step, when consulting the stock, the header "x-version" will be returned, which will have an integer value (long type) that represents the current stock version. This header must be sent when performing a PUT on /stock/. If it is not sent, it will return a 400 bad request error.


To modify the stock of each warehouse, you must previously have the user_product_id, store_id, and network_node_id.

The following PUT will change the current stock of each warehouse (store). If the store has stock 0, the quantity from the PUT will be assigned.

Call:

curl -X PUT https://api.mercadolibre.com/user-products/$USER_PRODUCT_ID/stock/type/seller_warehouse -H 'x-version: $HEADER' -H 'Content-Type: application/json' -H 'Authorization: Bearer $ACCESS_TOKEN'

Example:

curl -X PUT https://api.mercadolibre.com/user-products/MLMU123456789/stock/type/seller_warehouse -H 'x-version: 1' -H 'Content-Type: application/json' -H 'Authorization: Bearer $ACCESS_TOKEN' -d '
    {
    "locations": [
       {
        "store_id": "123456",
        "network_node_id": "MXP123451", // the field network_node_id is optional and not validated in the request
          "quantity": 10
       },
       { 
        "store_id": "123457",
          "network_node_id": "MXP571615",
          "quantity": 5
       },
       { 
        "store_id": "123458",
          "network_node_id": "MXP725258",
          "quantity": 20
       }
    ]
    }

Response:

{
    "user_id": 123456789,
    "product_release_date": null,
    "id": "MLMU123456789",
    "locations": [
        {
            "store_id": "123456",
            "network_node_id": "MXP123451",
            "type": "seller_warehouse",
            "quantity": 10
        },
        {
            "store_id": "123457",
            "network_node_id": "MXP571615",
            "type": "seller_warehouse",
            "quantity": 5
        },
        {
            "store_id": "123458",
            "network_node_id": "MXP725258",
            "type": "seller_warehouse",
            "quantity": 20
        }
    ]
 }
 

Response Status Codes:

Code Message Description Recommendation
200 OK Successful update -
400 Missing X-Version header Header "x-version" not provided You must provide the "x-version" header
409 Version mismatch The "x-version" header provided is incorrect Perform a GET on /user-product to obtain the updated "x-version" header
400 Store does not belong to seller: 000 The store ID does not belong to the specified user Check the seller's stores
400 Store not found: 000 The store ID does not exist Check the seller's stores
400 Store is not configured to be a stock location The store is not configured for multi-origin Indicate that the seller check the specified store through the Mercado Libre panel
400 Store cannot be null or empty Store field not provided Include at least one of the seller's stores to update UP stock


Note:
For post-sale, consult the Orders and/or Shipping documentation to understand orders with stores by the field "node_id".

Next documentation: Distributed Stock