Skip to main content

Create inventory

Add a stock record for a product in a warehouse or at a supplier.

Mutation​

mutation CreateInventory($input: CreateInventoryInput!) {
inventoryCreate(input: $input) {
id
productId
quantity
warehouseId
location
supplier
costPrice
nextDeliveryDate
notes
warehouse {
id
name
}
}
}

Variables​

{
"input": {
"type": "local",
"productId": 26,
"quantity": 500,
"warehouseId": 1,
"location": "AISLE-4-SHELF-B",
"notes": "Initial stock import from ERP",
"costPrice": 12.50,
"nextDeliveryDate": "2026-04-01T00:00:00.000Z"
}
}

Response​

{
"data": {
"inventoryCreate": {
"id": "98422",
"productId": 26,
"quantity": 500,
"warehouseId": 1,
"location": "AISLE-4-SHELF-B",
"supplier": "INTERN",
"costPrice": 12.50,
"nextDeliveryDate": "2026-04-01T00:00:00.000Z",
"notes": "Initial stock import from ERP",
"warehouse": {
"id": "1",
"name": "Main Warehouse"
}
}
}
}

Supplier inventory​

Use type: "supplier" to record stock held by a supplier rather than in a warehouse. The supplier field defaults to the product's supplier if not provided.

{
"input": {
"type": "supplier",
"productId": 26,
"quantity": 2000,
"supplier": "Ingram Micro",
"nextDeliveryDate": "2026-03-15T00:00:00.000Z",
"notes": "Supplier confirmed availability"
}
}

Inventory types​

TypeBehavior
localStock in a warehouse. Defaults supplier to INTERN.
supplierStock held by an external supplier. Defaults supplier to the product's supplier field.

How it works​

Each inventory record represents a stock quantity for one product in one warehouse (or at one supplier). A product can have multiple inventory records across different warehouses. The total field in the response sums up all inventory for that product. Use location to specify a bin or shelf position within a warehouse. The nextDeliveryDate field is informational and shown to buyers when a product is out of stock.

If your ERP tracks them, also pass allocatedQuantity for stock that is sold but not yet shipped and expectedQuantity for stock that is purchased but not yet received. The record then returns freeQuantity and economicQuantity, which are calculated from these values and cannot be set directly.

See also​