Repack template imports

Import reusable repacking setups with exact input products, output products and packaging, operating options, and process steps.

Access and preparation

Use POST /repack-templates/batch with repack-templates:write, current Work Order update permission, and Work Orders enabled for the organization and acting person. GET /me reports scope and permission availability; the import also checks Work Order availability.

Products and packaging must already exist in the organization. productCode and packagingName match exactly and case-insensitively. Packaging choices follow those available for the input's base unit in the Repack editor. For a fixed-package output product, send its catalog packaging name and capacity exactly.

Preview a template batch

Send 1 to 50 items with unique, stable clientItemId values and distinct trimmed template names. Replace the example codes, packaging name, and capacity with your catalog values.

curl "$SHELFCYCLE_API_BASE_URL/repack-templates/batch?dryRun=true" \
  -X POST \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "clientItemId": "repack-001",
        "payload": {
          "name": "Northstar bulk to drums",
          "description": "Reviewed drum repacking setup",
          "inputs": [{ "productCode": "SOLVENT-BULK", "isPackaging": false }],
          "outputs": [{ "productCode": "SOLVENT-DRUM", "packagingName": "Drum", "capacityUOM": 55, "kind": "PRODUCT" }],
          "tolerance": 1,
          "allowPartialPackage": false,
          "allowCrossFamilyRepack": false,
          "keepLotIdentity": true
        }
      }
    ]
  }'

The preview returns ordered ready or failed outcomes without saving templates. It does not require an Idempotency-Key.

Describe the setup

Each payload requires name, at least one inputs entry, and at least one outputs entry. Inputs use productCode and optional isPackaging; include at least one non-packaging input. Each output requires productCode, packagingName, positive numeric capacityUOM, and kind (PRODUCT or PACKAGE).

Optional settings are tolerance from 0 to 100, allowPartialPackage, allowCrossFamilyRepack, and keepLotIdentity. Optional processSteps use name and attrs with key/value pairs, as in Formula imports.

Each template supports up to 100 product-code entries across inputs and outputs, counting repeats. The name after trimming and the optional description each support up to 2400 UTF-8 bytes. The complete request supports up to 2 MB.

Save and resume

Execute the reviewed body without dryRun=true and with a stable Idempotency-Key. Results stay in input order and identify each clientItemId, with succeeded or failed status. Saved items return their template ID, name, number, and resultAction: "created".

Invalid content, unknown or ambiguous identifiers, archived products, and existing template names fail the affected item without undoing successful templates. Missing or repeated item IDs, missing names, and duplicate trimmed names within the batch reject the complete request before saves.

After an interruption, repeat the identical body, item order, item IDs, and key. Recorded outcomes return and only pending items continue; a completed retry reports idempotencyStatus: "replayed". Submit corrected failed items under a new stable key without already successful items. X-RateLimit-Cost reports submitted item count.

This saves templates, not work orders or inventory movements. Use the saved templates in the appropriate ShelfCycle work-order workflow.