Scan contents and seal a Package for a Pack task's order
POST/tasks/:id/package-seals
The Pack-path counterpart to complete: the station holding the active claim on a Pack task scans the order's contents and seals them into a brand-new Package resource (created by this call, not pre-existing — see the Location header). The task itself is left claimed; a separate POST /tasks/{id}/completions call finishes the Pack task once the package is sealed. Requires at least one scanned item — an empty contents array is a domain invariant violation (422), not a malformed request (400), since the array is present and well-formed, just semantically insufficient to seal.
Ship in own container (opt-in, ADR-0056). With shipInOwnContainer: true and the order line's lineQuantity (in eaches), a line that is exactly one full active CASE of its SKU (lineQuantity equal to the unitsPerPack of the SKU's active CASE level in the local pack-level copy of product-master's events) is sealed in the case itself: the package carries containerSource: CASE and the case's GTIN, dimensions and weight in container, with no cartonisation. contents must then name exactly one SKU. Anything else is refused with 422 and nothing is sealed: not exactly one line (ship-in-own-container-not-single-line), a quantity other than one full case (ship-in-own-container-quantity-mismatch), no CASE level for the SKU (ship-in-own-container-no-case-level), a retired CASE level (ship-in-own-container-case-retired), or a case declared without dimensions and weight (ship-in-own-container-case-dimensions-unknown). Without the new fields the request and the response are exactly as before.
Request
Responses
- 201
- 400
- 404
- 409
- 422
- 500
Package sealed.
Response Headers
Present, with the value true, ONLY when this answer is the stored replay of an earlier request that used the same Idempotency-Key (the handler did not run again). The first execution never carries it.
Path of the newly created package, e.g. /packages/{id}.
The Idempotency-Key header is missing (idempotency-key-required) or not 1-128 printable ASCII characters (idempotency-key-invalid) on a POST, or the request body could not be read or contains a NUL character (malformed-request-body), or the request body is malformed JSON, a required field is missing or empty, or a field value is invalid (e.g. a task type outside the TaskType enum).
No task exists with this id.
One of: stationId has no active claim on this task — it was never claimed, or the lease has expired, whichever station held it (task-not-claimed, the same type complete and lease-renewals return for that condition; ADR-0038); an ACTIVE lease on the task is held by a different station (task-not-owner); or a scanned item's live DOT hazard classification lookup found it incompatible — per the class-level 49 CFR §177.848-derived segregation matrix — with an item already scanned into this same package (package-segregation-violation, see ADR-0010). The segregation check only runs when the deployment has PRODUCT_CLASSIFICATION_MODE=kafka configured (a local copy of product-master's classifications, ADR-0039); the default permissive mode never rejects on this basis. The same Idempotency-Key reused with a different method, path or body is also a 409, problem type idempotency-key-reused.
The task is not a Pack task (wrong-task-type), or contents was empty (nothing was scanned, so there is nothing to seal: package-no-scanned-contents), or a shipInOwnContainer request cannot ship in a case, in which case nothing is sealed: ship-in-own-container-not-single-line (contents is not exactly one SKU), ship-in-own-container-quantity-mismatch (lineQuantity is not the unitsPerPack of the SKU's active CASE level), ship-in-own-container-no-case-level (the local pack-level copy holds no CASE level in effect for the SKU), ship-in-own-container-case-retired (the SKU's CASE level is end-dated) or ship-in-own-container-case-dimensions-unknown (the case was declared without dimensions and weight).
An unexpected server-side failure (e.g. a repository or event-publisher error).