# Item-based safety stock

Item-based safety stock is used to safeguard stock in the supply chain against uncertain influencing factors. It is an extra quantity of an item that is held at a location to reduce the risk that an item is going to be out of stock. Maintaining enough safety stock enables businesses to deal with demand or supply uncertainty.

Item-based safety stock can be defined at several levels such as:
• `item`
• `item-node`
• `item-node-deliveryMethod`
If safety stock is not defined at a specific level, the next level in the hierarchy that is less specific is used. For example, if safety stock is not defined at the `item-node-deliveryMethod` level, then the safety stock at the item-node level is used. If safety stock is not defined at any level, then safety stock is disabled. The calculated quantity is also published (through event subscriptions) to external systems along with the amount of safety stock that is withheld. The following example explains how to use safety stock to prevent online channels from overselling.
For example, consider an item T-Shirt with variation that has one associated child item: Medium T-Shirt. Safety stock is configured as explained in the following table.
Example safety stock configuration
Hierarchy Safety stock quantity
Medium T-shirt 4
Medium T-shirt + Matrix-Store-001 2
Medium T-shirt + Matrix-Store-001 + SHP 1
T-shirt 5
T-shirt + Matrix-Store-001 3
T-shirt + Matrix-Store-001 + SHP 0
The item Medium T-shirt has on hand stock of 10 quantity at node Matrix-Store-001.
Availability picture with safety stock
Availability criteria Safety stock quantity Quantity available to sell
Medium T-Shirt + Matrix-Store-001 + PICK 2 10 - 2 = 8
Medium T-Shirt + Matrix-Store-001 + SHP 1 10 - 1 = 9
T-Shirt + Matrix-Store-001 + PICK 3 10 - 3 = 7
T-Shirt + Matrix-Store-001 + SHP 0 10 - 0 = 10
Consider a customer walks into the store Matrix-Store-001 and purchases eight Medium T-Shirts. Now the total stock on hand is 10 - 8 = 2.
Availability after customer purchases 8 Medium T-Shirts
Availability criteria Safety stock quantity Quantity available to sell
Medium T-Shirt + Matrix-Store-001 + PICK 2 2 - 2 = 0
Medium T-Shirt + Matrix-Store-001 + SHP 1 2 - 1 = 1
T-Shirt + Matrix-Store-001 + PICK 3 2 - 3 = 0
T-Shirt + Matrix-Store-001 + SHP 0 2 - 0 = 2
Now another customer walks into the store Matrix-Store-001 and purchases two Medium T-Shirts. Now the total stock on hand is 2 - 2 = 0.
Availability after another customer purchases two medium t-shirts.
Availability criteria Safety stock quantity Quantity available to sell
Medium T-Shirt + Matrix-Store-001 + PICK 2 0 - 2 = 0; Shortage quantity =2;
Medium T-Shirt + Matrix-Store-001 + SHP 1 0 - 1 = 0; Shortage quantity =1;
T-Shirt + Matrix-Store-001 + PICK 3 0 - 3 = 0; Shortage quantity =3;
T-Shirt + Matrix-Store-001 + SHP 0 0 - 0 = 0
When inventory is back in stock, the shortage quantity is then applied. Until then, safety stock does not get applied due to shortage.

## Safety stock and total availability

By default, the Availability API reports the total availability for a node or distribution group with safety stock withheld considered. For example, when total available quantity is 15 and total safety stock that is withheld is 5. In this scenario, the total available is 10.

If you want to ignore safety stock when the absolute inventory is calculated and consider safety stock as available, you can use the considerSafetyStock parameter in the Availability API.