Queries and mutations for managing Inventory Entries in the platform.

Queries

Query Inventory Entries

QUERYinventoryEntries
Arguments
where​
String​
sort​
Array of String​
limit​
Int​
offset​
Int​

Get Inventory Entry

QUERYinventoryEntry
Arguments
id​
String​

Queries with specified ID

key​
String​

Queries with specified key

Mutations

Create Inventory Entry

MUTATIONcreateInventoryEntry
Arguments
draft​

Update Inventory Entry

MUTATIONupdateInventoryEntry
Arguments
version​
Long​
actions​
id​
String​

Queries with specified ID

key​
String​

Queries with specified key

Delete Inventory Entry

MUTATIONdeleteInventoryEntry
Arguments
version​
Long​
id​
String​

Queries with specified ID

key​
String​

Queries with specified key

Output types

InventoryEntry

Inventory allows you to track stock quantity per SKU and optionally per supply channel

sku​
String​
ProductVariant sku of the InventoryEntry.
quantityOnStock​
Long​
Overall amount of stock (availableQuantity + reserved). This value is eventually consistent with the internal SKU availability used for reservation logic, with a delay of up to 10 seconds. See Inventory checks and consistency for more information.
availableQuantity​
Long​
Available amount of stock (quantityOnStock - reserved). This value is eventually consistent with the internal SKU availability used for reservation logic, with a delay of up to 10 seconds. See Inventory checks and consistency for more information.
key​
String​

User-defined unique identifier of the InventoryEntry.

restockableInDays​
Int​

How often the InventoryEntry is restocked (in days).

reservationExpirationInMinutes​
Int​
Expiration time of ReserveOnCart reservations associated with this InventoryEntry.
supplyChannel​
Channel that supplies this InventoryEntry.
expectedDelivery​

Date and time of the next restock.

stockLevels​
BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
supplyChannelRef​
Channel that supplies this InventoryEntry.
minCartQuantity​
Long​
Minimum quantity that can be added to a Cart. See Quantity limits.
maxCartQuantity​
Long​
Maximum quantity that can be added to a Cart. See Quantity limits.
custom​

Custom Fields of the InventoryEntry.

id​
String​

Unique identifier of the InventoryEntry.

version​
Long​

Current version of the InventoryEntry.

createdAt​

Date and time (UTC) the InventoryEntry was initially created.

lastModifiedAt​

Date and time (UTC) the InventoryEntry was last updated.

createdBy​

IDs and references that created the InventoryEntry.

lastModifiedBy​

IDs and references that last modified the InventoryEntry.

StockLevels

BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
safetyStock​
Int​
reorderPoint​
Int​

InventoryEntryQueryResult

offset​
Int​
count​
Int​
total​
Long​
exists​
Boolean​
results​
Array of InventoryEntry​

Input types

InventoryEntryDraft

sku​
String​
ProductVariant sku of the InventoryEntry.
key​
String​

User-defined unique identifier for the InventoryEntry.

This field is optional for backwards compatibility reasons, but we strongly recommend setting it. Keys are mandatory for importing InventoryEntries with the Import API and the Merchant Center.
quantityOnStock​
Long​
Overall amount of stock. See Inventory checks and consistency for consistency information.
restockableInDays​
Int​

How often the InventoryEntry is restocked (in days).

expectedDelivery​

Date and time of the next restock.

reservationExpirationInMinutes​
Int​
BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
supplyChannel​
Channel that supplies this InventoryEntry.
custom​

Custom Fields for the InventoryEntry.

minCartQuantity​
Long​
Minimum quantity that can be added to a Cart. See Quantity limits.
maxCartQuantity​
Long​
Maximum quantity that can be added to a Cart. See Quantity limits.
stockLevels​
BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta

StockLevelsDraft

BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
safetyStock​
Int​
reorderPoint​
Int​

InventoryEntryUpdateAction

addQuantity​
changeQuantity​
removeQuantity​
setKey​
setRestockableInDays​
setExpectedDelivery​
setReservationExpirationInMinutes​
BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
setSupplyChannel​
setCustomType​
setCustomField​
setInventoryLimits​
setSafetyStock​
BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
setReorderPoint​
BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta

Update actions

Add Quantity

Incrementally updates the quantityOnStock by the specified amount. This changes the availableQuantity, based on the number of active reservations.
To set an absolute quantity value instead, use the InventoryEntryChangeQuantityAction update action.
quantity​
Long​
Value to add to quantityOnStock.

Change Quantity

Sets the quantityOnStock to an absolute value. This changes the availableQuantity, based on the number of active reservations. To make an incremental change instead, use the InventoryEntryAddQuantityAction update action.
quantity​
Long​
Value to set for quantityOnStock.

Remove Quantity

Removes a specific quantity from quantityOnStock. This changes the availableQuantity, based on the number of active reservations. You can update quantityOnStock to values below zero.
Carts with existing ReserveOnCart reservations will not be invalidated by this update action and can still be ordered.
quantity​
Long​
Value to remove from quantityOnStock.

Set Key

key​
String​

Set Restockable In Days

restockableInDays​
Int​

Value to set. If omitted, any existing value is removed.

Set Expected Delivery

expectedDelivery​

Value to set. If omitted, any existing value is removed.

Set Reservation Expiration In Minutes

BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
reservationExpirationInMinutes​
Int​

Value to set, must be a positive integer. If omitted, any existing value is removed.

Set Supply Channel

If an entry with the same sku and supplyChannel already exists, an DuplicateField error is returned.
supplyChannel​

Value to set. If omitted, any existing value is removed.

Set Custom Type

typeId​
String​
typeKey​
String​
fields​
Array of CustomFieldInput​

Set Custom Field

name​
String​
Name of the Custom Field.
value​
String​
If value is absent or null, this field will be removed if it exists. Removing a field that does not exist returns an InvalidOperation error. If value is provided, it is set for the field defined by name.

Set Inventory Limits

minCartQuantity​
Int​
maxCartQuantity​
Int​

Set Safety Stock

BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
quantity​
Int​

Set Reorder Point

BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
quantity​
Int​