---
title: "Update inventory by SKU and warehouse"
method: PUT
path: "/api/logistics/pvt/inventory/skus/{skuId}/warehouses/{warehouseId}"
tags: ["Inventory"]
---

# Update inventory by SKU and warehouse

`PUT /api/logistics/pvt/inventory/skus/{skuId}/warehouses/{warehouseId}`

## Request

- Base URL: `https://apiexamples.vtexcommercestable.com.br`
- URL: `https://apiexamples.vtexcommercestable.com.br/api/logistics/pvt/inventory/skus/{skuId}/warehouses/{warehouseId}`
- Auth: one of:
  - API key in header `X-VTEX-API-AppKey` and API key in header `X-VTEX-API-AppToken`
  - API key in header `VtexIdclientAutCookie`

Updates [inventory](https://help.vtex.com/en/tutorial/inventory-management--tutorials_139) quantity and [lead time](https://help.vtex.com/en/tutorial/lead-time-shipping-time-at-sku-level--16yv5Mkj6bTyWR1hCN2f4B) for a given SKU in a warehouse.

>ℹ️ If you wish to configure lead time exclusively, use the [Update inventory lead time by SKU and warehouse](https://developers.vtex.com/docs/api-reference/logistics-api#patch-/api/logistics/pvt/inventory/skus/-skuId-/warehouses/-warehouseId-/lead-time) endpoint, and if the quantity only, use the [Update inventory quantity by SKU and warehouse](https://developers.vtex.com/docs/api-reference/logistics-api#patch-/api/logistics/pvt/inventory/skus/-skuId-/warehouses/-warehouseId-/quantity) endpoint. 

This endpoint allows you to: 

- **Define a quantity:** Indicate a specific number of items of a SKU from a warehouse, and it will decrease whenever an item is sold. When the last item is sold, the SKU will run out of stock. 

- **Set an unlimited inventory:** Always have items of a SKU from a warehouse considered available for sale. When this configuration is active, the SKU never goes out of stock. 

- **Configure lead time:** Set the [lead time](https://help.vtex.com/en/tutorial/lead-time-shipping-time-at-sku-level--16yv5Mkj6bTyWR1hCN2f4B) for a given SKU from a warehouse, and this period will be added to the order total shipping time. This configuration is optional and by default it is set to `0` days. 

Successful requests receive a `200 OK` status code with `true` in the response body, and unsuccessful requests receive a `400 Bad Request` error code. 

>❗ Requests made with an incomplete response body can be successful and receive a `200 OK` message. However, sending the request body without the `leadTime` field sets the SKU [lead time](https://help.vtex.com/en/tutorial/lead-time-shipping-time-at-sku-level--16yv5Mkj6bTyWR1hCN2f4B) to `0`. The same is valid for the `quantity` field, which, if not sent, makes the SKU count equal to `0`. 

## Permissions

Any user or [API key](https://developers.vtex.com/docs/guides/api-authentication-using-api-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint:

| **Product** | **Category** | **Resource** |
| --------------- | ----------------- | ----------------- |
| Logistics | Logistics access | **Logistics full access** |
| Logistics | Logistics access | **Logistics inventory full access** |

You can [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) with that resource or use one of the following [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy):

| **Role** | **Resource** | 
| --------------- | ----------------- | 
| Logistics - Full access | Logistics full access |
| OMS - Full access | Logistics full access |
| Logistics - Full access | Logistics inventory full access |
| OMS - Full access | Logistics inventory full access |

>❗ Assigning a [predefined role](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) to users or application keys usually grants permission to multiple [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3). If some of these permissions are not necessary, consider creating a custom role instead. For more information regarding security, see [Best practices for using application keys](https://help.vtex.com/en/tutorial/best-practices-api-keys--7b6nD1VMHa49aI5brlOvJm). To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication.

## Path parameters

- `skuId` string, required
- `warehouseId` string, required

## Headers

- `Content-Type` string, required
- `Accept` string, required

## Request body

- object
  - `quantity` integer, required: Quantity of SKU units you wish to update the [inventory](https://help.vtex.com/tutorial/inventory-management--tutorials_139) in the given [warehouse](https://help.vtex.com/en/tutorial/warehouse--6oIxvsVDTtGpO7y6zwhGpb). Note that: - Sending it as `null` sets the quantity to `0`. - Not sending it sets the quantity to `0`. - Sending `unlimitedQuantity` as `true` overrules the `quantity`.
  - `unlimitedQuantity` boolean, required: When set as `true`, you make the SKU from the given warehouse permanently available for sales. No matter how many units are sold, the default quantity of `1000000` units does not decrease, and the store never runs out of stock. When set as `false`, every sold unit will decrease your inventory quantity. Note that: - Sending this field as `null` sets the value to `false`. - Not sending this field sets the value to `false`. - Sending this field as `true` overrules the `quantity` field.
  - `dateUtcOnBalanceSystem` string: Defines the date and time of the warehouse when the SKU was updated. This can be useful for liberating handling order [reservations](https://help.vtex.com/en/tutorial/how-the-reservation-works--tutorials_92), for example. The format is [ISO 8601 time zone offset format](https://learn.microsoft.com/en-us/rest/api/storageservices/formatting-datetime-values), as in `YYYY-MM-DDThh:mm:ss.ssZ`. When the value is `null` or empty, the default will be the date and time of the request being made.
  - `leadTime` string, required: Defines the [lead time](https://help.vtex.com/en/tutorial/lead-time-shipping-time-at-sku-level--16yv5Mkj6bTyWR1hCN2f4B), which is an optional time configuration you can make for a SKU in a warehouse. It can be handling time, fabrication or how long it takes for the item to be available to be shipped to customers. The lead time is a part of the total shipping time and will be considered for shipping date calculation. The format is `dd.hh:mm:ss` (days.hours:minutes:seconds). Note that: - Sending this field as `null` sets the value to `0`. - Not sending this field sets the value to `0`.

## Response `200`

OK

## Other responses

- `400`: Bad Request
- `423`: Locked

## Changes

- **2024-11-12** `3e9180b6a9a0`: 1 info
  - added the non-success response with the status `423`

[Operation history](https://skmtc.dev/vtex/apis/logistics-api/changes/api/logistics/pvt/inventory/skus/:skuId/warehouses/:warehouseId/put.md)

---

[API](https://skmtc.dev/vtex/apis/logistics-api.md) - [All operations](https://skmtc.dev/vtex/apis/logistics-api/llms.txt) - [OpenAPI document](https://skmtc.dev/vtex/apis/logistics-api/revisions/dcb84d05d999?raw)
