Unpack a packed-but-unshipped order
Authorization: requires orders:write API-key scope AND the per-user
orders.edit permission (handler-top SoD assertion mirrors the Cognito
dispatch). System-actor calls without an identifiable principal are
denied per AICPA SoC2 CC6.1.
Returns a packed-but-unshipped order to editable state by voiding any
unshipped Shippo labels and atomically cancelling every reversible
package (status IN (‘draft’,‘packed’,‘label_created’)). Idempotent
via Idempotency-Key.
Industry parallels (retrieved 2026-05-15):
- Shopify “Cancel fulfillment” (https://help.shopify.com/en/manual/fulfillment/managing-orders/canceling-orders)
- NetSuite “Reopen Sales Order”
- Acumatica “Unpack Shipment” (Shipments form, Actions menu)
Workflow (atomic):
- Live recompute of
eligibility.can_unpackinside the transaction. - Void unshipped Shippo labels via the canonical voidLabel helper (mirrors the packOrder repack branch AUDIT-009-G3 idempotent pattern).
- Hard-delete every package_shipment_labels + package_items + packages row for the order (Layer 1 entity-scoped).
- Release per-line
quantity_packed -> 0on order_items. - Re-flip
orders.fulfillment_statusback to'unfulfilled'. - Append
ACTIONS.ORDER_UNPACKEDactivity row + order_timeline event. - Broadcast
package.deleted(per package) +order.unpacked+order.updatedpost-commit.
After unpack, the line-item editor regains its trash + pen + Rules +
sell-rate + qty controls automatically (the gate in
isLineItemEditAllowedClient releases when fulfillment_status
returns to 'unfulfilled').
Blocker codes (422 response):
nothing_to_unpack: no packages in a reversible status exist. Returns HTTP 409already_unpackedinstead when this is the ONLY blocker (concurrent double-click idempotency).labels_already_shipped: at least one package on the order has entered carrier custody (status IN (‘shipped’,‘delivered’,‘returned’)); use Returns + new SO instead.order_fulfilled:fulfillment_status='fulfilled'; use Returns.order_voided/order_cancelled/order_archived/order_is_quote: order is in a terminal state and cannot be unpacked.
Authorizations
API key issued per entity via Settings > Developers > API Keys.
Each key carries scopes (e.g. orders:read, products:write).
Bearer token format: Authorization: Bearer ark_live_ent_Test keys use ark_test_ent_. Both are issued per entity
via Settings > Developers > API Keys.
Headers
Client-generated unique key for idempotent POST/PATCH/DELETE operations. Alias for the Idempotency parameter. Max 255 chars. On retry with the same key, the original response is returned without re-executing the operation. Keys expire after 24 hours.
255Path Parameters
Body
Operator-supplied reason; defaults to 'unpack_and_edit'.
Response
Order unpacked. Response surfaces the package_ids_cancelled[] and label_voids[] arrays so the caller can confirm the carrier-side void outcome. label_void_errors[] (optional) lists labels that failed to void at Shippo (non-fatal -- the operator can retry the void from the shipping routes or hand-void in the Shippo dashboard).

