---
displayed_sidebar: inventoryReference
slug: /references/inventory/updateInventoryLevel
sidebar_label: updateInventoryLevel
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# updateInventoryLevel - Inventory Module Reference

This documentation provides a reference to the `updateInventoryLevel` method. This belongs to the Inventory Module.

This method is used to update an inventory level. The inventory level is identified by the IDs of its associated inventory item and location.

## Example

```ts
import { 
  initialize as initializeInventoryModule,
} from "@medusajs/inventory"

async function updateInventoryLevel (
  inventoryItemId: string,
  locationId: string,
  stockedQuantity: number
) {
  const inventoryModule = await initializeInventoryModule({})

  const inventoryLevel = await inventoryModule.updateInventoryLevels(
    inventoryItemId,
    locationId,
    {
      stocked_quantity: stockedQuantity
    }
  )

  // do something with the inventory level or return it
}
```

## Parameters

<ParameterTypes parameters={[
  {
    "name": "inventoryItemId",
    "type": "`string`",
    "description": "The ID of the inventory item.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "locationId",
    "type": "`string`",
    "description": "The ID of the location.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "update",
    "type": "[UpdateInventoryLevelInput](../../inventory/interfaces/inventory.UpdateInventoryLevelInput.mdx)",
    "description": "The attributes to update in the location level.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "incoming_quantity",
        "type": "`number`",
        "description": "The incoming quantity of the associated inventory item in the associated location.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "stocked_quantity",
        "type": "`number`",
        "description": "The stocked quantity of the associated inventory item in the associated location.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "context",
    "type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
    "description": "A context used to share resources, such as transaction manager, between the application and the module.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "manager",
        "type": "`EntityManager`",
        "description": "An instance of an entity manager.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "transactionManager",
        "type": "`EntityManager`",
        "description": "An instance of a transaction manager.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />

## Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "The updated inventory level's details.",
    "expandable": false,
    "children": [
      {
        "name": "created_at",
        "type": "`string` \\| `Date`",
        "description": "The date with timezone at which the resource was created.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "deleted_at",
        "type": "`string` \\| `Date` \\| `null`",
        "description": "The date with timezone at which the resource was deleted.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "id",
        "type": "`string`",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "incoming_quantity",
        "type": "`number`",
        "description": "the incoming stock quantity of an inventory item at the given location ID",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "inventory_item_id",
        "type": "`string`",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "location_id",
        "type": "`string`",
        "description": "the item location ID",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "metadata",
        "type": "`Record<string, unknown>` \\| `null`",
        "description": "An optional key-value map with additional details",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "reserved_quantity",
        "type": "`number`",
        "description": "the reserved stock quantity of an inventory item at the given location ID",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "stocked_quantity",
        "type": "`number`",
        "description": "the total stock quantity of an inventory item at the given location ID",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "updated_at",
        "type": "`string` \\| `Date`",
        "description": "The date with timezone at which the resource was updated.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />
