Replenishment Orders
Retrieve submitted purchase, transfer, work and production orders with a GET or a webhook, and filter them.
When buyers and planners submit orders in GAINS, GAINS Connect makes them available to your ERP or other system of record. This page explains how to receive submitted purchase, transfer, work and production orders, either pushed to you by webhook or read on demand from an endpoint.
Order types
Each order type has its own endpoint and its own webhook trigger, and both deliver the same order structure: an order header identified by its TrackingNumber, with its lines in LineItems.
| Order type | Endpoint | Webhook trigger | DataType |
|---|---|---|---|
| Purchase orders | GET /replenishment/purchase-orders | POSubmit | purchase_order |
| Transfer orders | GET /replenishment/transfer-orders | TOSubmit | transfer_order |
| Work orders | GET /replenishment/work-orders | WOSubmit | work_order |
| Production orders | GET /replenishment/production-orders | ProductionOrderSubmit | production_order |
GAINS decides whether an order line is a purchase, transfer or work order from where it ships from. Production orders are a separate kind:
- Purchase order: the
ShippingLocationis a vendor, not one of your GAINS locations. - Transfer order: the
ShippingLocationis another of your locations. The header carriesSenderNamewhere a purchase order carriesVendorName. - Work order: the order is built at the location that receives it, so
ShippingLocationandReceivingLocationare the same. - Production order: a production run submitted from Replenishment Scheduling or from Order Builder in production mode. It is scheduled on a
ProductionLineinstead of shipping from a location. See Production orders.
Choosing a webhook or the endpoint
Many integrations use both channels: the webhook to process orders as they arrive, and the endpoint to look up an order again by its TrackingNumber. Which channel to use, and how to combine them, is described in Pull or push.
Reading orders
Send a GET with any of the filters below. This request reads the purchase orders received into CHI01 from vendor ACME:
GET /api/v1/replenishment/purchase-orders?ReceivingLocation=CHI01&ShippingLocation=ACME&Size=50{
"DataType": "purchase_order",
"Data": [
{
"TrackingNumber": 4821,
"ShippingLocation": "ACME",
"ReceivingLocation": "CHI01",
"VendorName": "Acme Supplies",
"ReleaseDate": "2026-05-21",
"RequestedDeliveryDate": "2026-06-21",
"SubmittedBy": "[email protected]",
"UpdatedTime": "2026-05-21 11:00:00",
"Documentation": "Consolidated weekly replenishment order.",
"ContactName": "John Doe",
"ContactEmail": "[email protected]",
"ShipMethod": "land",
"Address1": "123 Any St",
"Address2": "Suite 400",
"Address3": "Dock 7",
"City": "Chicago",
"State": "IL",
"PostalCode": "60601",
"Country": "US",
"LineItems": [
{
"ItemCode": "ASM-7701",
"ItemDescription": "Hub assembly, front",
"Quantity": 480,
"QuantityUnadjusted": 462,
"Cost": 62.1,
"LineComment": "Rounded up to pallet quantity",
"ShippingLocation": "ACME",
"ReceivingLocation": "CHI01",
"OrderNumber": "PO-2026-004821",
"OrderType": "REPLEN",
"ReceiveDate": "2026-06-21",
"DeliveryDate": "2026-06-19",
"LineNumber": "1",
"BuyerCode": "JSMITH",
"ApprovalCode": "A",
"ApprovedBy": "finley",
"PreOrderCarryCost": 112.4,
"DaysOverLeadTime": 0.0,
"Weight": 6.2,
"Volume": 0.05,
"ConversionFactor": 12.0,
"BundleCode": 3
}
]
}
],
"Paging": {
"NextCursor": null,
"CurrentDataCount": 1
}
}The endpoint returns every submitted order of its type that GAINS currently holds and that matches your filters. It applies no date window and does not remember what you have already read, so the same order is returned on every call until GAINS no longer holds it. Record the TrackingNumber of each order you have processed, so that a scheduled pull does not create it twice.
Orders are returned newest first, in descending TrackingNumber order. Size counts orders, each with all its lines; see Pagination.
Filters
| Parameter | Matches | Applies to |
|---|---|---|
ApprovalCode | The approval code of the order's lines. Defaults to A | Every line |
TrackingNumber | The GAINS tracking number of the order | The order |
ShippingLocation | The vendor or location the order ships from | Every line |
ReceivingLocation | The location that receives the order | The order header |
- Each parameter takes a comma-separated list of up to 10 values:
ReceivingLocation=CHI01,DAL02. An order matches when it matches any value in the list. - Different parameters combine with AND.
- A line-level filter must match every line. An order is returned only when all of its lines carry one of the requested
ApprovalCodevalues and ship from one of the requestedShippingLocationvalues. An order with one line that does not match is left out entirely, not returned with fewer lines. - Only approved orders are returned by default. Without
ApprovalCode, the endpoint returns orders whose lines all carry approval codeA. To read orders that carry another code, name every code you want:ApprovalCode=A,U. - The header shows
multiplewhen lines differ. When an order's lines ship from different locations, the headerShippingLocationreadsmultiple. Filter onShippingLocationto find such orders by their lines.
You can also filter on extended data attributes that your GAINS representative has made available as filters. See Extended Data - Outbound.
Production orders
GAINS X versionProduction orders need a minimum GAINS X version, stated on the
GET /replenishment/production-ordersreference page. On an earlier version the endpoint answers426(see When your version is too old (426)).
A production order groups the production runs submitted under one TrackingNumber. It differs from the other order types in these ways:
- The production line takes the place of the shipping location. Filter with
ProductionLineinstead ofShippingLocation; it must match every line, as above. ReceivingLocationis the plant. When an order's lines go to several plants, the headerReceivingLocationreadsmultiple, and such an order matches noReceivingLocationfilter.- Lines carry the schedule of the run, for example
ScheduledStartDateandScheduledEndDate. Quantities are in stocking units. - Header details may be empty. On orders submitted from Replenishment Scheduling, header fields such as the contact and the address fields are
null. OrderNumberreadsNONEuntil GAINS records an order number against the line. Identify the order byTrackingNumber.- The approval code can differ. Orders submitted from Replenishment Scheduling can carry an approval code other than
A. Name every code you want to read, for exampleApprovalCode=A,U.
Webhooks
Enable the trigger for each order type you want to receive in your webhook settings. Each delivery carries the same orders and fields as the endpoint, without Paging.
A trigger is not all-or-nothing: give it a filter, and GAINS sends only the orders that match. For example, to send only orders for two receiving locations to one destination:
{
"Triggers": {
"POSubmit": {
"Enabled": true,
"Filter": "ReceivingLocation IN ('CHI01', 'DAL02')"
}
}
}Filters can use the fields of the payload and your extended data (ExtendedData.<ApiLabel>). Combined with several webhook destinations, they let you route orders for different locations or vendors to different systems. You can also resend a delivery, or the orders of one TrackingNumber, with POST /webhook/resend.
See Webhooks for setting up destinations, the filter syntax and retries, and Webhook Payload Samples for a sample payload of each order type.
Extended data
Orders can carry extended data on the order header and on each line, on both the endpoint and the webhook. See Extended Data - Outbound.
Errors
| Status | Cause |
|---|---|
400 Bad Request | A filter has more than 10 values, TrackingNumber is not a number, 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 replenishment data |
426 Upgrade Required | Production orders only: your GAINS X version is too old for this endpoint |
See Errors Handling & Exceptions for the error response body.
Related
- To read order recommendations line by line, whether or not they have been submitted, use
GET /replenishment/requisitions. - Outbound Overview: Pull or Push
- Webhooks
- Pagination
- Extended Data - Outbound
Updated 2 days ago
