Overview
The Inventory Module manages inventory tracking across multiple stock locations. It handles inventory items, stock levels per location, and inventory reservations for orders and carts. Key Features:- Inventory item management
- Multi-location stock levels
- Inventory reservations
- Available quantity calculations
- Backorder support
- Stock adjustments and tracking
When to Use
Use the Inventory Module when you need to:- Track inventory across multiple warehouses
- Reserve inventory for orders and carts
- Check product availability
- Manage stock levels per location
- Support backorders
- Adjust inventory quantities
- Track incoming and stocked quantities
Data Models
InventoryItem
Represents a trackable inventory item (usually linked to product variants).string
required
Unique inventory item identifier
string
Stock keeping unit identifier
string
Country of origin (two-letter ISO code)
string
Harmonized System code for customs
string
Manufacturer item number
string
Item material composition
number
Item weight
number
Item length
number
Item height
number
Item width
boolean
Whether item requires shipping
object
Additional custom data
InventoryLevel
Tracks stock quantity for an inventory item at a specific location.string
required
Unique inventory level identifier
string
required
ID of the inventory item
string
required
ID of the stock location
BigNumber
required
Quantity physically stocked at location
BigNumber
required
Quantity reserved (calculated from reservations)
BigNumber
required
Quantity expected to arrive
BigNumber
Available quantity (calculated: stocked - reserved)
object
Additional custom data
ReservationItem
Reserves inventory for orders, carts, or other purposes.string
required
Unique reservation identifier
string
required
ID of the inventory item
string
required
ID of the stock location
BigNumber
required
Reserved quantity
string
ID of the associated line item
string
Reservation description or reason
string
User ID who created the reservation
object
Additional custom data
Service Interface
The Inventory Module service is available at@medusajs/medusa/inventory.
Create Inventory Item
Create a new inventory item.CreateInventoryItemDTO | CreateInventoryItemDTO[]
required
InventoryItemDTO | InventoryItemDTO[]
The created inventory item(s)
Create Inventory Level
Set stock quantity at a location.CreateInventoryLevelDTO | CreateInventoryLevelDTO[]
required
Update Inventory Level
Adjust stock quantities.UpdateInventoryLevelDTO
required
Retrieve Inventory Level
Get inventory level for item at location.string
required
ID of the inventory item
string
required
ID of the stock location
InventoryLevelDTO
The inventory level with available quantity
Create Reservation
Reserve inventory for an order or cart.CreateReservationItemDTO | CreateReservationItemDTO[]
required
ReservationItemDTO | ReservationItemDTO[]
The created reservation(s)
Update Reservation
Modify reservation quantity.Delete Reservation
Release reserved inventory.Confirm Inventory
Check if sufficient inventory is available.string
required
ID of the inventory item
string[]
required
IDs of stock locations to check
number
required
Required quantity
boolean
Whether sufficient inventory is available
Retrieve Available Quantity
Get available quantity across locations.Retrieve Stocked Quantity
Get total stocked quantity across locations.Retrieve Reserved Quantity
Get total reserved quantity.Integration Examples
With Product Module
Create inventory for product variants.With Cart Module
Check availability and reserve inventory.With Order Module
Adjust inventory on order completion.With Stock Location Module
Manage inventory across multiple locations.With Fulfillment Module
Reserve inventory for fulfillment.Best Practices
-
Reserved Quantity: The
reserved_quantityfield is calculated automatically from reservation items. Never update it directly - always create/delete reservations. -
Inventory Adjustments: Use
adjustInventoryfor relative changes (add/subtract),updateInventoryLevelsfor absolute values. -
Reservation Lifecycle:
- Create reservation when adding to cart
- Update reservation when cart quantity changes
- Delete reservation when:
- Cart is completed (order created)
- Cart item is removed
- Cart expires
- Multi-Location: When checking availability, always specify which locations to check. This is crucial for multi-warehouse scenarios.
-
Backorders: Set appropriate thresholds for when to allow backorders. Check
available_quantityand compare withincoming_quantity. - Bulk Operations: Use array input for bulk operations to improve performance when creating multiple inventory items or levels.
Related Modules
- Product Module - Link inventory to product variants
- Stock Location Module - Manage warehouse locations
- Cart Module - Reserve inventory for carts
- Order Module - Adjust inventory on orders
- Fulfillment Module - Reserve for fulfillments