Deleting Data & SKU-Location Review

Every delete endpoint and its record key, and how you approve or reject a SKU-location delete before anything is removed.

This page lists every delete endpoint, the key each one takes, and how you approve or reject a SKU-location delete before anything is removed. Read it before you remove data from GAINS through the API. How tasks work in general is described in Inbound Endpoints & Integration Tasks.

Delete endpoints

Each delete takes an array of record keys, not whole records, and creates a task like a load does. GAINS removes the matching records at its next scheduled load for that kind of data.

EndpointDeletesKey: requiredKey: optional
POST /skus/deleteItemsItemCode
POST /locations/deleteLocationsLocationCode
POST /skus-locations/deleteSKU-locations, after reviewItemCode, LocationCode
POST /customers/deleteCustomer ship-tosCustomerCode, ShipToCode
POST /vendors/deleteVendorsVendorCodeReceiveLocationCode
POST /vendor-alternatives/deleteAlternative vendors of a SKU-locationItemCode, LocationCode, ProductionLine, CapacityAllocGroup
POST /bills-of-material/deleteKit componentsKitItemCode, KitLocationCode, ComponentItemCode, ComponentLocationCode, EffectiveFrom
POST /supercessions/deleteOne old-to-new replacementNewItem and OldItem, each with ItemCode and LocationCode
POST /price-breaks/deletePrice breaks of a SKU-locationItemCode, LocationCode
POST /demand-transactions/deleteDemand transactionsOrderNumber, IdealShipFromLocationCode, CustomerRequestDateLineNumber, ItemCode, CustomerShipToCode
POST /demand-events/deleteDemand eventsEventId
POST /supply-transactions/deleteSupply order linesOrderNumber, LineNumberSplitNumber
POST /usage-transactions/deleteUsage transactionsWorkOrderNumber, ActualLocationCode, OrderReleaseDateWorkLineNumber, ItemCode
POST /forecasts/deleteImported forecasts of a SKU-locationItemCode, LocationCode

Each delete creates a task whose TaskType is Delete…, listed in Task types. Send each key exactly as you loaded the record. Dates are YYYY-MM-DD. The other kinds of inbound data, such as inventory availability, calendar overrides and vendor constraints, have no delete endpoint.

Sending a delete

POST /api/v1/supply-transactions/delete HTTP/1.1
Host: acme.gainsystems.com
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJqTl9F...
Content-Type: application/json
Idempotency-Key: 3a7e9c14-5b2d-4f81-9e6a-0c4d8b1f2a73
[
  {
    "OrderNumber": "PO-58213",
    "LineNumber": "1"
  },
  {
    "OrderNumber": "PO-58213",
    "LineNumber": "2",
    "SplitNumber": "2"
  }
]
{
  "Status": "Queued",
  "TaskId": "8d4f1a2e-6c3b-4e7a-9f05-2b1c7d9e4a60"
}

A delete follows the same rules as a load:

RuleDetail
Size1 to 1000 keys per request.
ChecksEach key is checked on its own. The response is 202, 207 with the rejected keys, or 422 when none passed.
RepeatsThe same key twice in one request refuses the whole request with 400.
AccessDeleting needs delete access. Without it the request answers 403.
IdempotencyIdempotency-Key is supported, as on loads.
Errors from GAINSIf GAINS cannot take the delete, the request answers 500, 503 or 504 and creates no task. Retry later; see Load Throughput & Retries.

Follow the task as for a load. Once it is final, Batch.Accepted and Batch.Rejected count the keys GAINS deleted and refused, and Batch.RejectedRecords says why each refused key was refused.

SKU-location delete review

Deleting a SKU-location removes planning history that cannot be restored. POST /skus-locations/delete therefore deletes nothing on receipt: GAINS Connect holds the request until you approve or reject it.

How the review works

  1. You send the SKU-locations to delete. The task starts in PendingReview. Nothing has been deleted or sent to GAINS.
  2. You approve or reject the request with PUT /tasks/{TaskId}, using credentials that have reviewer access.
  3. Approved: the task moves to Queued or Received and the deletion is loaded at the next scheduled load, like any other delete. It then moves to Processing and a final status.
  4. Rejected: the task moves to RejectedNotApproved. Nothing is deleted.

While the task is PendingReview, you can withdraw it yourself (see Withdrawing a request).

{
  "Status": "PendingReview",
  "TaskId": "f17c3a9b-2e48-4d6a-8b1f-5c0e9a7d3b24"
}

Who reviews

The review is recorded through PUT /tasks/{TaskId}. It needs reviewer access. Ask your GAINS representative to grant reviewer access, preferably to credentials separate from the ones your integration uses to submit deletes. A caller without reviewer access receives 403. The reviewer is taken from the credentials that make the call, so the body carries only the decision.

{
  "Status": "approved",
  "Comments": "Discontinued at MKE02 per planning review 2026-05-21"
}
FieldDetail
Statusapproved or rejected, in any letter case. Required.
CommentsOptional note, up to 1000 characters, returned on the task.
{
  "Reason": "The task has been marked as approved.",
  "Status": "Queued"
}

The decision is final: a second decision on the same task is refused with 400. Submit the delete again to get a new review.

Following the review

GET /tasks/{TaskId} shows the decision once it is made: UpdatedBy is the reviewer, UpdatedOn the time, and Comments the reviewer's note.

To be told instead of polling, enable the TaskStatusUpdate webhook trigger with a filter such as TaskType = 'DeleteSkuLocation'. See Webhooks.

Withdrawing a request

POST /tasks/{TaskId}/cancel withdraws a request that is still PendingReview, Received or Queued. The held SKU-locations are discarded and no review is needed. It answers as described in Cancelling a task.

Requests nobody reviews

A request still PendingReview 30 days after it was created is removed with its task, like every task of that age. Nothing is deleted. If you still need the deletion, send the request again.

GAINS version

The reference pages of POST /skus-locations/delete and PUT /tasks/{TaskId} state the minimum GAINS X version they need; on an older version they answer 426, see When your version is too old (426).

Related guides


Did this page help you?