Ongoing Warehouse Developer

Stock balances and inventory

Table of contents


The inventory describes which articles are in stock. There are several different functions for retrieving the inventory data from the API:

Note that these functions also return the basic article data (such as weight, dimensions and description) for each article. There is no separate function for getting the basic article data. Thus, in order to get the article registry, GetInventory should be used.

How the different quantities are related in GetInventory and GetInventoryByQuery

When you call GetInventory and GetInventoryByQuery, you will receive five different quantities for each article:

ToReceiveNumberOfItems has no relationship to the rest of the values. It describes how large a quantity of goods is expected to arrive in the warehouse, that is, how large a quantity exists on a purchase order but is not yet received.

The rest of the quantities have a complicated relationship to each other.

NumberOfItemsDecimal is the total stock stored in the warehouse.

NumberOfBookedItemsDecimal is the number of items on orders but which have not yet been picked.

Sometimes warehouses first allocate a certain amount of items of an article before picking it, then that item can also be found under AllocatedNumberOfItems.

Finally article items can also be locked. NumberOfLockedItems counts article items where either:

The following Venn diagram illustrates the relation between the different quantities.

Venn diagram describing the relationship between the different quantities.

Physical stock balance

The number of items which are physically present in the warehouse is simply NumberOfItemsDecimal.

Sellable stock balance - basic formula

It is common to want to know how much stock there is in the warehouse which is available for selling. In general this can be achieved by the following formula:

Sellable stock balance = NumberOfItemsDecimal - NumberOfBookedItemsDecimal

Note that this formula can become negative. This formula is suitable for most cases, including web shops.

Sellable stock balance - advanced formula

One issue with the the basic formula is that it considers locked items to be sellable. For instance, if the warehouse has locked some items because they are under investigation for quality reasons, then the basic formula will still consider those items to be sellable.

In most cases, the basic formula is enough. But if you are sure that you don't want to count locked items as sellable when calculating available stock, use the below formula instead:

Sellable stock balance = NumberOfItemsDecimal - NumberOfBookedItemsDecimal - NumberOfLockedItems + AllocatedNumberOfItems

Keep in mind that article items could be locked by standard warehouse activities like stock-taking. This can lead to available stock being zero or negative during the stock-taking activity.

The difference between GetInventory and GetInventoryItems

The fundamental difference between GetInventory and GetInventoryItems is that:

You can use GetInventoryItems to answer questions such as:

As an example, let us say that you have an article called A1 with the following items in stock:

A call to GetInventory will return NumberOfItemsDecimal = 15 for A1. But if you call GetInventoryItems, you will receive two separate InventoryItems tags for A1: