Forecasts
Retrieve weekly, monthly and aggregate forecasts from GAINS with a GET or a webhook.
GAINS Connect gives you the demand forecast GAINS calculates for each SKU-location, in weekly or monthly buckets. This page explains which endpoint to call, what a forecast record contains, and how to receive changed forecasts by webhook.
Forecast endpoints
| Endpoint | Buckets | Period default | Period maximum |
|---|---|---|---|
GET /demand-planning/forecast/weekly | Weeks | 52 | 104 |
GET /demand-planning/forecast/monthly | Months | 12 | 24 |
GET /demand-planning/forecast/monthly-aggregate | Months, aggregate forecast | 12 | 24 |
All three return the same structure, with DataType forecast. The aggregate endpoint returns only the SKU-locations that have an aggregate forecast in GAINS.
Reading forecasts
This request reads the next three monthly buckets for every item at CHI01:
GET /api/v1/demand-planning/forecast/monthly?LocationCode=CHI01&Period=3{
"DataType": "forecast",
"Data": [
{
"ItemCode": "ASM-7701",
"Locations": [
{
"LocationCode": "CHI01",
"InventoryClass": "A",
"ForecastBuckets": [
{
"ForecastPeriodNumber": 1,
"ForecastPeriodStart": "2026-11-01",
"ForecastPeriodEnd": "2026-11-30",
"ForecastQuantityTotal": 540,
"ForecastQuantityTotalRaw": 521
},
{
"ForecastPeriodNumber": 2,
"ForecastPeriodStart": "2026-12-01",
"ForecastPeriodEnd": "2026-12-31",
"ForecastQuantityTotal": 505,
"ForecastQuantityTotalRaw": 498
},
{
"ForecastPeriodNumber": 3,
"ForecastPeriodStart": "2027-01-01",
"ForecastPeriodEnd": "2027-01-31",
"ForecastQuantityTotal": 470,
"ForecastQuantityTotalRaw": 470
}
]
}
]
}
],
"Paging": {
"NextCursor": null,
"CurrentDataCount": 1
}
}The endpoints return the current forecast of every SKU-location that matches your filters, each time you call them. They do not keep track of what you have already read: what you receive is the forecast as it stands in GAINS at the time of the call. Size counts SKU-locations; see Pagination.
What a forecast contains
Each record is one item, with one entry in Locations per SKU-location, holding one bucket per forecast period.
| Field | Meaning |
|---|---|
ItemCode, LocationCode | The SKU-location the forecast is for |
InventoryClass | The inventory class of the SKU-location |
ForecastPeriodNumber | The position of the bucket, from 1 |
ForecastPeriodStart, ForecastPeriodEnd | The first and last day of the bucket |
ForecastQuantityTotal | The forecast quantity, including any adjustments planners made in GAINS |
ForecastQuantityTotalRaw | The forecast quantity GAINS calculated, before planner adjustments |
Compare the two quantities to see where a planner has adjusted the forecast.
Parameters
| Parameter | Effect |
|---|---|
ItemCode | Only these items |
LocationCode | Only these locations |
StockIndicator | Only SKU-locations with this stock indicator, for example S for stocked |
Period | The number of buckets returned per SKU-location, from 1 to the endpoint's maximum |
ItemCode,LocationCodeandStockIndicatortake a comma-separated list of up to 10 values:LocationCode=CHI01,DAL02.- Different parameters combine with AND.
Periodcounts buckets, not dates.Period=6on the weekly endpoint returns six weekly buckets, starting from bucket1.
You can also filter on extended data attributes that your GAINS representative has made available as filters. See Extended Data - Outbound.
Receiving changed forecasts by webhook
Rather than reading every forecast on a schedule, you can have GAINS send you the forecasts that change:
| Trigger | Sends | DataType |
|---|---|---|
ForecastWeeklyUpdate | Weekly forecasts that changed | forecast |
ForecastMonthlyUpdate | Monthly forecasts that changed | forecast |
A delivery has the same structure as the endpoint, without Paging. Each location also carries EventOccurredAt, the time GAINS generated the forecast, which the endpoints do not return. There is no webhook for the aggregate forecast.
Both triggers share the DataType forecast. If you subscribe to both, send them to different destinations, or tell them apart by the length of their buckets.
Like the other triggers, a forecast trigger can take a filter, for example LocationCode IN ('CHI01', 'DAL02'), so that GAINS sends only the forecasts you need. See Webhooks for setting up destinations and filters, and Webhook Payload Samples for sample payloads.
A common pattern is to read the full forecast once from the endpoint, then keep it up to date from the webhook.
Extended data
Forecasts can carry extended data on the item and on each location. Weekly, monthly and aggregate forecasts are configured separately, and the webhooks carry the same extended data as the matching endpoint. See Extended Data - Outbound.
Errors
| Status | Cause |
|---|---|
400 Bad Request | Period is outside the endpoint's range, a filter has more than 10 values, or Size is not between 1 and 1000 |
401 Unauthorized | The request carries no valid credentials |
403 Forbidden | Your credentials do not grant access to outbound demand planning data |
See Errors Handling & Exceptions for the error response body.
Related
- To load forecasts produced in another system into GAINS, use
POST /forecasts. - Outbound Overview: Pull or Push
- Webhooks
- Pagination
- Extended Data - Outbound
Updated 2 days ago
