Inventory

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

Representations

InventoryEntry

  • id - String
    The unique ID of the inventory entry.
  • version - Number
  • createdAt - DateTime
  • createdBy - CreatedBy BETA
    Present on resources created after 2019-02-01 except for events not tracked.
  • lastModifiedAt - DateTime
  • lastModifiedBy - LastModifiedBy BETA
    Present on resources updated after 2019-02-01 except for events not tracked.
  • sku - String
  • supplyChannel - Reference to a Channel - Optional
    Connection to a particular supplier.
  • quantityOnStock - Number
    Overall amount of stock. (available + reserved)
  • availableQuantity - Number
    Available amount of stock. (available means: quantityOnStock - reserved quantity)
  • restockableInDays - Number - Optional
    The time period in days, that tells how often this inventory entry is restocked. Also used to override ReserveOnOrder InventoryMode to allow backorders on certain line items while orders for other line items with insufficient stock are blocked.
  • expectedDelivery - DateTime - Optional
    The date and time of the next restock.
  • custom - CustomFields - Optional

InventoryEntryDraft

There can only be one inventory entry for the combination of sku and supplyChannel.

Get InventoryEntry by ID

Endpoint: /{projectKey}/inventory/{id}
Method: GET
OAuth 2.0 Scopes: view_products:{projectKey}
Response Representation: InventoryEntry

Query Inventory

Endpoint: /{projectKey}/inventory
Method: GET
OAuth 2.0 Scopes: view_products:{projectKey}
Response Representation: PagedQueryResult with results containing an array of InventoryEntry
Query Parameters:

Create an InventoryEntry

Endpoint: /{projectKey}/inventory
Method: POST
OAuth 2.0 Scopes: manage_products:{projectKey}
Request Representation: InventoryEntryDraft
Response Representation: InventoryEntry

Creating an InventoryEntry produces the InventoryEntryCreatedMessage.

Update an InventoryEntry

Endpoint: /{projectKey}/inventory/{id}
Method: POST
OAuth 2.0 Scopes: manage_products:{projectKey}
Response Representation: InventoryEntry
Fields:

  • version - Number - Required
    The expected version of the InventoryEntry on which the changes should be applied. If the expected version does not match the actual version, a 409 Conflict will be returned.
  • actions - Array of UpdateAction - Required
    The list of update actions to be performed on the InventoryEntry.

Update actions

Add Quantity

Increments quantityOnStock and updates availableQuantity according to the new quantity and amount of active reservations.

  • action - String - "addQuantity"
  • quantity - Number

Remove Quantity

Decrements quantityOnStock and updates availableQuantity according to the new quantity and amount of active reservations.

  • action - String - "removeQuantity"
  • quantity - Number

Change Quantity

Sets quantityOnStock and updates availableQuantity according to the new quantity and amount of active reservations.

  • action - String - "changeQuantity"
  • quantity - Number

Set RestockableInDays

  • action - String - "setRestockableInDays"
  • restockableInDays - Number - Optional

Set ExpectedDelivery

  • action - String - "setExpectedDelivery"
  • expectedDelivery - DateTime - Optional

Set SupplyChannel

  • action - String - "setSupplyChannel"

  • supplyChannel - ResourceIdentifier of a Channel - Optional If absent, the supply channel is removed.

    This action will fail if an entry with the combination of sku and supplyChannel already exists.

Set Custom Type

This action sets or removes the custom type for an existing inventory entry. If present, this action overwrites any existing custom type and fields.

Set CustomField

  • action - String - "setCustomField"
  • name - String - Required
  • value - Value - Optional
    If value is absent or null, this field will be removed if it exists. Trying to remove a field that does not exist will fail with an InvalidOperation error. If value is provided, set the value of the field defined by the name.

Delete an InventoryEntry

Endpoint: /{projectKey}/inventory/{id}
Method: DELETE
OAuth 2.0 Scopes: manage_products:{projectKey}

Deleting an InventoryEntry produces the InventoryEntryDeletedMessage.