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

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

# listInventoryLevels - Inventory Module Reference

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

This method is used to retrieve a paginated list of inventory levels along with the total count of available inventory levels satisfying the provided filters.

## Example

To retrieve a list of inventory levels using their IDs:

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

async function retrieveInventoryLevels (inventoryItemIds: string[]) {
  const inventoryModule = await initializeInventoryModule({})

  const [inventoryLevels, count] = await inventoryModule.listInventoryLevels({
    inventory_item_id: inventoryItemIds
  })

  // do something with the inventory levels or return them
}
```

To specify relations that should be retrieved within the inventory levels:

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

async function retrieveInventoryLevels (inventoryItemIds: string[]) {
  const inventoryModule = await initializeInventoryModule({})

  const [inventoryLevels, count] = await inventoryModule.listInventoryLevels({
    inventory_item_id: inventoryItemIds
  }, {
    relations: ["inventory_item"]
  })

  // do something with the inventory levels or return them
}
```

By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:

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

async function retrieveInventoryLevels (inventoryItemIds: string[], skip: number, take: number) {
  const inventoryModule = await initializeInventoryModule({})

  const [inventoryLevels, count] = await inventoryModule.listInventoryLevels({
    inventory_item_id: inventoryItemIds
  }, {
    relations: ["inventory_item"],
    skip,
    take
  })

  // do something with the inventory levels or return them
}
```

## Parameters

<ParameterTypes parameters={[
  {
    "name": "selector",
    "type": "[FilterableInventoryLevelProps](../../inventory/interfaces/inventory.FilterableInventoryLevelProps.mdx)",
    "description": "The filters to apply on the retrieved inventory levels.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "incoming_quantity",
        "type": "`number` \\| [NumericalComparisonOperator](../../inventory/interfaces/inventory.NumericalComparisonOperator.mdx)",
        "description": "Filters to apply on inventory levels' `incoming_quantity` attribute.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "inventory_item_id",
        "type": "`string` \\| `string`[]",
        "description": "Filter inventory levels by the ID of their associated inventory item.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "location_id",
        "type": "`string` \\| `string`[]",
        "description": "Filter inventory levels by the ID of their associated inventory location.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "reserved_quantity",
        "type": "`number` \\| [NumericalComparisonOperator](../../inventory/interfaces/inventory.NumericalComparisonOperator.mdx)",
        "description": "Filters to apply on inventory levels' `reserved_quantity` attribute.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "stocked_quantity",
        "type": "`number` \\| [NumericalComparisonOperator](../../inventory/interfaces/inventory.NumericalComparisonOperator.mdx)",
        "description": "Filters to apply on inventory levels' `stocked_quantity` attribute.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "config",
    "type": "[FindConfig](../../inventory/interfaces/inventory.FindConfig.mdx)&#60;[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)&#62;",
    "description": "The configurations determining how the inventory levels are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a inventory level.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "order",
        "type": "`object`",
        "description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "relations",
        "type": "`string`[]",
        "description": "An array of strings, each being relation names of the entity to retrieve in the result.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "select",
        "type": "(`string` \\| keyof `Entity`)[]",
        "description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "skip",
        "type": "`null` \\| `number`",
        "description": "A number indicating the number of records to skip before retrieving the results.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "take",
        "type": "`null` \\| `number`",
        "description": "A number indicating the number of records to return in the result.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "withDeleted",
        "type": "`boolean`",
        "description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
        "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)[], number]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "The list of inventory levels along with the total count.",
    "expandable": false,
    "children": [
      {
        "name": "InventoryLevelDTO[]",
        "type": "[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)[]",
        "optional": false,
        "defaultValue": "",
        "description": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "number",
        "type": "`number`",
        "optional": true,
        "defaultValue": "",
        "description": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />
