Inventory Policies

Read inventory policies and service levels from GAINS, and receive changed policies by webhook.

When GAINS manages your inventory policies, GAINS Connect gives you the current policy of each SKU-location, such as its order quantities, safety stock and service level, so you can apply it in your ERP. This page explains the two inventory endpoints, their filters, and how to receive changed policies by webhook.

Inventory endpoints

EndpointReturns
GET /inventory/policiesThe inventory policy of each SKU-location: order quantities, safety stock, service level, lead time
GET /inventory/service-levelThe same policy with its costs and cost drivers, and the trade-off GAINS evaluated at each service level

The service level endpoint returns only the SKU-locations for which GAINS has evaluated service levels.

Reading inventory policies

This request reads the policies of stocked SKU-locations in inventory classes A and B:

GET /api/v1/inventory/policies?InventoryClass=A,B&StockIndicator=S
{
  "DataType": "inventory_policy",
  "Data": [
    {
      "ItemCode": "ASM-7701",
      "ItemDescription": "Hub assembly, front",
      "Locations": [
        {
          "LocationCode": "CHI01",
          "LocationName": "Chicago DC",
          "InventoryPolicy": {
            "AdjustedOrq": 120,
            "MinimumOrq": 50,
            "IncrementalOrq": 10,
            "CalcOrq": 118,
            "Rsq": 0,
            "RsqOverride": 0,
            "CalcSs": 34,
            "AdjustedSs": 40,
            "SsOverride": 0,
            "ServiceLevel": 0.95,
            "ServiceLevelMinimum": 0.9,
            "InventoryClass": "A",
            "StockIndicator": "S",
            "LeadTime": 2.0,
            "ForecastError": 0.18,
            "AvgLTTotalDemand": 96
          }
        }
      ]
    }
  ],
  "Paging": {
    "NextCursor": null,
    "CurrentDataCount": 1
  }
}

The endpoints return the current policy of every SKU-location that matches your filters, each time you call them. They do not keep track of what you have already read; to receive only the policies that change, use the webhook.

Both endpoints return one record per item, with one entry in Locations per SKU-location. Size counts SKU-locations, not items, so on both policies and service levels an item's Locations can continue on the next page: merge records with the same ItemCode across pages. See Pagination.

What a policy contains

A policy holds the order quantity and safety stock GAINS calculated for the SKU-location, the values after adjustments, any value a planner has set in GAINS, and the service level, lead time and forecast error behind them.

GET /inventory/service-level adds, for each SKU-location, the costs GAINS uses to set the policy, demand and order statistics, the inventory model in use, and a ServiceLevels array. Each entry of ServiceLevels is one service level GAINS evaluated, with the order quantity, safety stock and costs that service level would bring. Use it to see what a higher or lower service level would cost before changing one. The API Reference describes every field.

Filters

Narrow what you read by item, location, inventory class, stock indicator, department or group, and, for policies, by planner. You can also filter on extended data attributes that your GAINS representative has made available as filters; see Receiving Extended Data. The API Reference describes each filter.

With ItemLocationFilterType=exclude, ItemCode=ASM-7701&LocationCode=DAL02 leaves out item ASM-7701 at every location, and every item at DAL02. It does not leave out only the SKU-location ASM-7701 at DAL02.

Receiving changed policies by webhook

Inventory policies have a trigger that sends a SKU-location's policy when GAINS detects that it has changed; the trigger name is on Webhooks. There is no webhook for service levels. To combine a first read with webhook updates, see Pull or Push.

A delivery has the same structure as GET /inventory/policies, without Paging. Each location also carries EventOccurredAt, the time GAINS calculated the policy, which the endpoint does not return.

The trigger can take a filter, for example InventoryClass IN ('A', 'B'), so that GAINS sends only the policies you need. See Webhook Filters, and Webhook Payload Samples for the attributes GAINS watches for a change and a sample payload.

Extended data

Policies and service levels can carry extended data on the item and on each location, configured separately for each endpoint. The webhook carries the same extended data as GET /inventory/policies. See Receiving Extended Data.

Errors

These endpoints return the statuses described in Errors & Retries.

Related


Did this page help you?