Replenishment Orders
Receive submitted purchase, transfer, work and production orders by GET or webhook, and read order requisitions.
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, and how to read the order recommendations, or requisitions, they come from.
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. Outbound Subjects lists the endpoints, and Webhooks the triggers.
GAINS decides whether an order line is a purchase, transfer or work order from where it ships from, unless the order type was overridden on the line in GAINS. 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.
An overridden line is returned with the order type set in GAINS.
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. To combine the endpoint with the webhook, see Pull or Push.
Size counts orders, each with all its lines; see Pagination.
Filters
Narrow what you read by approval code, tracking number, shipping or receiving location, or by extended data attributes that your GAINS representative has made available as filters. The API Reference describes each filter. Two points shape what you receive:
- A filter on a line value must match every line of an order. An order with one line that does not match is left out entirely, not returned with fewer lines.
- By default you receive only orders whose every line is approved. The approval code is a line value, so the default, approved (
A), follows the rule above: an order with one line that is not yet approved is left out. To read it, name every code its lines carry, for exampleApprovalCode=A,U.
See Receiving Extended Data for extended data filters.
Production orders
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. When an order's lines are on several production lines, the headerProductionLinereadsmultiple. 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. - 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.
Requisitions
A requisition is a single order recommendation in GAINS: one item to be ordered from one shipping location into one receiving location, with its quantity, dates and cost. Buyers review requisitions and submit them; once submitted, they are grouped under a TrackingNumber and returned by the order endpoints above.
GET /replenishment/requisitions returns the recommendations line by line. Use it to see what GAINS recommends before buyers act on it, for example to report on open recommendations by buyer or vendor.
GET /api/v1/replenishment/requisitions?OrderType=purchase_order&ReceivingLocation=CHI01{
"DataType": "requisition",
"Data": [
{
"OrderType": "purchase_order",
"ItemCode": "ASM-7701",
"ItemDescription": "Hub assembly, front",
"ShippingLocation": "ACME",
"ReceivingLocation": "CHI01",
"ReceiveDate": "2026-12-01",
"ReleaseDate": "2026-11-10",
"DeliveryDate": "2026-11-28",
"ApprovalCode": "U",
"Quantity": 480,
"Cost": 62.1,
"LineComment": null,
"OrderNumber": null,
"BuyerCode": "JSMITH",
"PreOrderCarryCost": 112.4,
"DaysOverLeadTime": 0.0,
"Weight": 6.2,
"Volume": 0.05,
"ConversionFactor": 12.0,
"BundleCode": 3,
"Department": "10",
"Group": "HUB"
}
],
"Paging": {
"NextCursor": null,
"CurrentDataCount": 1
}
}Requisitions differ from orders in these ways:
- Each record is one line. There is no order header, and
Sizecounts lines. - GAINS decides the
OrderTypeof each line as for orders: from where it ships from, unless the order type was overridden on the line in GAINS. - By default you receive the recommendations still under review, not approved ones, because that is what the endpoint is for. To include approved lines, name the approval codes you want.
- A requisition does not say whether it has been submitted. It carries no
TrackingNumber, so you cannot tell from the response whether a line is already part of an order. To process submitted orders, use the order endpoints or their webhooks. - There is no webhook for requisitions.
Requisitions can carry extended data on each line, and can be filtered by extended data attributes that your GAINS representative has made available as filters.
Webhooks
Enable the trigger for each order type you want to receive in your webhook configuration. 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 Configuring Webhooks, Webhook Filters and Delivery & Recovery, 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 Receiving Extended Data.
Errors
These endpoints return the statuses described in Errors & Retries.
Related
Updated 10 days ago
