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

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

# adjustInventory - Inventory Module Reference

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

This method is used to adjust the inventory level's stocked quantity. 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 adjustInventory (
  inventoryItemId: string,
  locationId: string,
  adjustment: number
) {
  const inventoryModule = await initializeInventoryModule({})

  const inventoryLevel = await inventoryModule.adjustInventory(
    inventoryItemId,
    locationId,
    adjustment
  )

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

## Parameters

<ParameterTypes parameters={[
  {
    "name": "inventoryItemId",
    "type": "`string`",
    "description": "The ID of the associated inventory item.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "locationId",
    "type": "`string`",
    "description": "The ID of the associated location.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "adjustment",
    "type": "`number`",
    "description": "A positive or negative number used to adjust the inventory level's stocked quantity.",
    "optional": false,
    "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 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": []
      }
    ]
  }
]} />
