# Release WMS orders with specific batches by API
URL: https://support.starshipit.com/articles/14700000001030-release-wms-orders-with-specific-batches-by-api
Canonical: https://support.starshipit.com/articles/14700000001030-release-wms-orders-with-specific-batches-by-api
Markdown: https://support.starshipit.com/articles/14700000001030-release-wms-orders-with-specific-batches-by-api.md
Updated: 2026-11-23

> For the complete documentation index, see [llms.txt](https://support.starshipit.com/llms.txt).

> Release a Pending WMS order with exact quantities from nominated batches, verify the allocations, and handle unavailable stock without substitution.

Use the WMS API to release an imported order to picking and reserve exact quantities from the batches you choose. Look up the matching inventory records, then submit their IDs and quantities in `exactManualAllocations`.

Create and update the sales order through the [Starshipit API](/developers/api-reference/starshipit). This workflow starts after the order has reached WMS and is still **Pending**.

## Before you begin

- Use the WMS base URL, `https://wms.starshipit.com`, and the `starshipit-api-key` header.
- Ask your administrator to confirm `fulfillment.view` for the order lookup, `inventory.view` for inventory reads, `fulfillment.manage` for release, and `jobs.view` for verification.
- Store the source Starshipit `order_id`. You will look up the WMS order ID before releasing it.
- Keep nominated orders out of automatic release until your integration is ready. If you use a WMS hold while confirming a batch, clear it before the release request. Clearing a hold does not select a batch; make sure no other process releases the order first.
- Choose a small test order with a standard, batch-tracked product. Replace every example ID with an ID returned by your own account.

:::warning
Releasing an order reserves warehouse stock and can create work for warehouse staff. Coordinate the test with your warehouse before sending the release request.
:::

## Look up the WMS order

1. Find the imported order using its Starshipit `order_id`.

```bash
curl --request GET \
  --url https://wms.starshipit.com/api/starshipit-order/by-starshipit-id/123456 \
  --header "starshipit-api-key: YOUR_STARSHIPIT_API_KEY"
```

2. Store `order.id` and confirm `order.status` is `PENDING`. The abbreviated response below shows one product requiring six units.

```json
{
  "success": true,
  "order": {
    "id": "wms-order-123",
    "orderId": "123456",
    "orderNumber": "SO-1001",
    "status": "PENDING",
    "currentHold": null,
    "items": [
      {
        "id": "order-item-123",
        "productId": "product-123",
        "sku": "WIDGET-001",
        "quantity": 6,
        "parentProductId": null,
        "trackingType": "BATCH"
      }
    ],
    "jobs": []
  }
}
```

Use the returned `order.id` in the release URL. It is different from the source Starshipit `order_id` and the customer-facing order number. If lookup returns `404`, confirm the account and that the order has been imported into WMS.

## Select the batch and expiry

1. Read fresh inventory for the product.

```bash
curl --request GET \
  --url "https://wms.starshipit.com/api/inventory/product-123?forMovement=true&refresh=true" \
  --header "starshipit-api-key: YOUR_STARSHIPIT_API_KEY"
```

2. Select records whose `batchNumber` and `expiryDate` match your nomination. This abbreviated response has six available units in `LOT-A` and ten in `LOT-B`.

```json
{
  "trackingType": "BATCH",
  "allocationRule": "FEFO",
  "inventoryRecords": [
    {
      "id": "inventory-lot-a",
      "locationId": "location-pick-1",
      "locationName": "A-01-01",
      "locationType": "PICK_FACE",
      "batchNumber": "LOT-A",
      "expiryDate": "2027-12-31T00:00:00.000Z",
      "quantityOnHand": 6,
      "allocatedQuantity": 0,
      "availableQuantity": 6
    },
    {
      "id": "inventory-lot-b",
      "locationId": "location-pick-1",
      "locationName": "A-01-01",
      "locationType": "PICK_FACE",
      "batchNumber": "LOT-B",
      "expiryDate": "2027-06-30T00:00:00.000Z",
      "quantityOnHand": 10,
      "allocatedQuantity": 0,
      "availableQuantity": 10
    }
  ]
}
```

Use each selected record's `id` as an `inventoryIds` value. The release request does not accept `batchNumber`, `batch_number`, or `expiryDate` inside an exact allocation row. Choosing the records identifies the batch, expiry and location.

An available inventory quantity is not a reservation or a guarantee that the stock can be picked. WMS checks the location, existing reservations, freezes and allocation eligibility again during release. A product outside your inventory access returns `null` with HTTP `200`; do not treat that as an empty stock list.

## Release exact quantities

For an ordinary release using the product's allocation rules, send `{}` to the same endpoint. Use a non-empty exact plan when a different batch must not be substituted.

1. Submit the full six-unit requirement against `LOT-A`'s inventory ID.

```bash
curl --request POST \
  --url https://wms.starshipit.com/api/starshipit-order/wms-order-123/release-to-pick \
  --header "starshipit-api-key: YOUR_STARSHIPIT_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "allowPartialRelease": false,
    "exactManualAllocations": [
      {
        "productId": "product-123",
        "rows": [
          {
            "inventoryIds": ["inventory-lot-a"],
            "quantity": 6
          }
        ]
      }
    ]
  }'
```

2. Confirm HTTP `200`, `success: true`, and `status: RELEASED`. Store the allocation IDs and `pickJobId`, plus every `pickJobIds` entry if that array is returned.

```json
{
  "success": true,
  "orderNumber": "SO-1001",
  "status": "RELEASED",
  "pickJobId": "pick-job-123",
  "allocations": [
    {
      "sku": "WIDGET-001",
      "productId": "product-123",
      "totalAllocated": 6,
      "allocations": [
        {
          "allocationId": "allocation-123",
          "inventoryId": "inventory-lot-a",
          "locationId": "location-pick-1",
          "quantityAllocated": 6,
          "batchNumber": "LOT-A"
        }
      ]
    }
  ]
}
```

For products included in `exactManualAllocations`, WMS uses only the selected records and quantities. It does not substitute `LOT-B` when `LOT-A` is short. If exact stock is unavailable or the whole order cannot be released, the exact release fails without committing the release allocations or new jobs. Other products that you omit from the plan still follow their normal allocation rules.

### Plan quantities and split batches

- Supply one plan per canonical product. Quantities must equal its full demand across all order lines, expressed in base inventory units. A case or unit-of-measure product can map to a parent product; exploding bundles require the canonical component demand rather than the bundle's selling quantity.
- Use positive whole-number quantities. You can split a ten-unit requirement into separate rows of six from one batch and four from another.
- Group multiple inventory IDs in one row only when they share the same product, location, batch and expiry. WMS consumes that row's quantity across those records. Use separate rows for different batches, expiries or locations, and select serial records individually.
- Use each inventory ID only once. The request can select at most `250` unique inventory records, including any `manualInventoryIds` supplied alongside it.
- Keep `allowPartialRelease` false for exact plans. An omitted or empty `exactManualAllocations` array makes a normal rule-based release; it does not enforce a batch nomination.

These plans apply to total canonical product demand, not a particular order-line ID. If two lines for the same product require different batches, you can reserve the combined quantities from both batches, but cannot bind each batch to a specific order line through this request.

## Verify the saved allocation

1. Repeat the order lookup and confirm its status is `RELEASED`.
2. Check the release response contains the intended inventory IDs and quantities.
3. Read allocations for each returned pick job to confirm saved batch and expiry values.

```bash
curl --request GET \
  --url https://wms.starshipit.com/api/job/pick-job-123/allocations \
  --header "starshipit-api-key: YOUR_STARSHIPIT_API_KEY"
```

In the [job allocation response](/developers/api-reference/wms#get-api-job-id-allocations-get-job-allocations), check each row's `inventoryId`, `quantityAllocated`, `inventory.batchNumber`, and `inventory.expiryDate`. A release can create more than one pick job when work spans zones. Read all returned jobs and match your recorded allocation IDs; job responses can include other work if a job is shared.

The release response does not include expiry dates. Keep the inventory selection you used, and use the saved job allocation's inventory details to verify expiry.

## Handle failures and retries

An exact-stock failure returns HTTP `400` with a nested error. For example:

```json
{
  "success": false,
  "error": {
    "code": "EXACT_MANUAL_STOCK_UNAVAILABLE",
    "message": "A selected row no longer has the exact quantity requested. Refresh inventory and review the quantities.",
    "details": {
      "productId": "product-123",
      "inventoryIds": ["inventory-lot-a"],
      "quantityRequired": 6,
      "quantityAvailable": 4
    }
  }
}
```

| Response | What to do |
| --- | --- |
| `400 EXACT_MANUAL_INVALID_PLAN` or `EXACT_MANUAL_INVALID_GROUP` | Correct the field names, IDs, duplicate records, quantity types or grouping. |
| `400 EXACT_MANUAL_DEMAND_MISMATCH` | Re-read the order and make selected quantities equal the full canonical product demand. |
| `400 EXACT_MANUAL_STOCK_UNAVAILABLE` | Re-read stock. Wait for matching stock or deliberately choose a different nomination; do not remove the exact plan to force a release. |
| `400 EXACT_MANUAL_FULL_RELEASE_REQUIRED` | Keep partial release disabled and resolve shortages or kitting requirements across the whole order. |
| `400 EXACT_MANUAL_ALLOCATION_INCOMPLETE` | Re-read the order and inventory, then review the complete plan before retrying. |
| `400 ORDER_ON_HOLD` or `INVALID_ORDER_STATUS` | Resolve the hold or confirm the order is still Pending. An already released order is not a request to create another release. |
| `403` | Ask your administrator to check the account and required WMS permissions. |
| `404` | Confirm the account, source order ID, and returned WMS order ID. |
| `409 PARTIAL_RELEASE_AVAILABLE` | This is a normal rule-based release asking for partial-release confirmation. An exact plan must remain a full release. |
| `503 RELEASE_TO_PICK_BUSY` | Honour `Retry-After: 1`, re-read the order and retry later. |
| Timeout or `500` | Reconcile the order and saved job allocations before retrying. A failed response alone does not prove that a write did not commit. |

There is no general idempotency key for this endpoint. If a response is lost, repeat the order lookup first. When the order is already released, inspect its jobs and allocations instead of releasing it again. If the saved batch differs from the nomination, stop and ask a warehouse manager to resolve it.

## Related questions

<!-- faq:start -->

<!-- faq:question -->Do I need to set allocationRule to SPECIFIC?<!-- /faq:question -->

No. `SPECIFIC` is a product allocation rule, not a field that carries a nominated batch from another system. Use `exactManualAllocations` to select exact stock for this release. You can leave the product's usual rule, such as FEFO, in place for other orders.

<!-- faq:question -->Can manualInventoryIds alone guarantee a batch and quantity?<!-- /faq:question -->

No. `manualInventoryIds` selects stock for the ordinary allocation workflow but does not specify exact quantities per row. Use a non-empty `exactManualAllocations` plan when substitution is not acceptable.

<!-- faq:question -->Can this replace a batch on an existing allocation?<!-- /faq:question -->

This workflow releases a Pending order. It does not replace the batch on an existing allocation or preserve an existing pick job while swapping stock. Do not delete an allocation and assume that releasing again will keep the nominated batch. Ask your warehouse manager to review existing work before recovery.

<!-- faq:question -->Can I require a minimum remaining shelf life?<!-- /faq:question -->

The release request has no minimum-days or minimum-months field. Compare the inventory expiry dates with your required shelf life before selecting the record IDs. FEFO orders stock by expiry; it does not, by itself, guarantee your minimum remaining shelf life.

<!-- faq:end -->

## Related guides

- [Order release endpoints](/developers/api-reference/wms#order-releases)
- [Manage orders and allocation in WMS](/articles/14700000000010-manage-orders-and-allocation-in-wms)
- [Automate warehouse work in WMS](/articles/14700000000039-automate-warehouse-work-in-wms)
- [WMS API fundamentals](/articles/developer-center/starshipit-wms-api/wms-api-fundamentals)
