Queries and mutations for managing Inventory Entries in the platform.
Queries
Query Inventory Entries
| Arguments | |
|---|---|
whereString | |
sortArray of String | |
limitInt | |
offsetInt | |
Get Inventory Entry
| Arguments | |
|---|---|
idString | Queries with specified ID |
keyString | Queries with specified key |
Mutations
Create Inventory Entry
Update Inventory Entry
| Arguments | |
|---|---|
versionLong | |
actionsArray of InventoryEntryUpdateAction | |
idString | Queries with specified ID |
keyString | Queries with specified key |
Delete Inventory Entry
| Arguments | |
|---|---|
versionLong | |
idString | Queries with specified ID |
keyString | Queries with specified key |
Output types
InventoryEntry
Inventory allows you to track stock quantity per SKU and optionally per supply channel
skuString | ProductVariant sku of the InventoryEntry. |
quantityOnStockLong | 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. |
availableQuantityLong | 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. |
keyString | User-defined unique identifier of the InventoryEntry. |
restockableInDaysInt | How often the InventoryEntry is restocked (in days). |
reservationExpirationInMinutesInt | 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. |
minCartQuantityLong | Minimum quantity that can be added to a Cart. See Quantity limits. |
maxCartQuantityLong | Maximum quantity that can be added to a Cart. See Quantity limits. |
custom | Custom Fields of the InventoryEntry. |
idString | Unique identifier of the InventoryEntry. |
versionLong | 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
safetyStockInt | |
reorderPointInt |
InventoryEntryQueryResult
offsetInt | |
countInt | |
totalLong | |
existsBoolean | |
resultsArray of InventoryEntry |
Input types
InventoryEntryDraft
skuString | ProductVariant sku of the InventoryEntry. |
keyString | 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. |
quantityOnStockLong | Overall amount of stock. See Inventory checks and consistency for consistency information. |
restockableInDaysInt | How often the InventoryEntry is restocked (in days). |
expectedDelivery | Date and time of the next restock. |
reservationExpirationInMinutesInt | 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. |
minCartQuantityLong | Minimum quantity that can be added to a Cart. See Quantity limits. |
maxCartQuantityLong | 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
safetyStockInt | |
reorderPointInt |
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
quantityOnStock by the specified amount. This changes the availableQuantity, based on the number of active reservations.quantityLong | Value to add to quantityOnStock. |
Change Quantity
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.quantityLong | Value to set for quantityOnStock. |
Remove Quantity
quantityOnStock. This changes the availableQuantity, based on the number of active reservations. You can update quantityOnStock to values below zero.ReserveOnCart reservations will not be invalidated by this update action and can still be ordered.quantityLong | Value to remove from quantityOnStock. |
Set Key
keyString |
Set Restockable In Days
restockableInDaysInt | 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
reservationExpirationInMinutesInt | Value to set, must be a positive integer. If omitted, any existing value is removed. |
Set Supply Channel
sku and supplyChannel already exists, an DuplicateField error is returned.supplyChannel | Value to set. If omitted, any existing value is removed. |
Set Custom Type
typeIdString | |
typeKeyString | |
type | |
fieldsArray of CustomFieldInput |
Set Custom Field
nameString | Name of the Custom Field. |
valueString | 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
minCartQuantityInt | |
maxCartQuantityInt |
Set Safety Stock
quantityInt |
Set Reorder Point
quantityInt |