Issue the reverse label of one package of a return (IssueReturnLabel)
POST/return-labels
In-org route called by customer-returns (ADR 0017, ADR 0018), the reverse twin of POST /labels. Reads the ship-to of orderId from customer-ordering BEFORE the transaction opens and derives the stopKey exactly like the outbound label of the same order (same secret over the same normalized address), so a return pickup stop groups with the outbound delivery stop by construction. The RETURN DESTINATION is named in exactly one of two ways. destinationNodeId names the returns node, and this context derives the label's destination prefix itself, from its own view of node-topology's registered nodes (ADR 0018): the caller holds no address data. destinationPostalPrefix, deprecated, is a prefix the caller supplies. Sending both, or neither, is validation-failed. A destinationNodeId this context holds no usable prefix for (the node's registration has not been consumed yet, or its registered postal code has no letter or digit from A-Z 0-9) is refused with 409 destination-prefix-unavailable and no label is stored, nor is the refusal kept under the Idempotency-Key, so the same request with the same key is executed again and served once the node is known; this context does not judge whether the node is the right one or whether it is active. The label rides the ground carrier (RN-GROUND), starts NO package journey and seals NO ship-to snapshot; scans of the reverse package are counted-and-acknowledged unknowns, and shopper-facing return tracking is customer-returns' authorization view. The response is a ReturnLabel: no poNumber, no assignmentId, purpose RETURN and the returnAuthorizationId. One label per (returnAuthorizationId, packageNo). A replay of the same Idempotency-Key returns the first response when that response is final for the request: a success and a refusal that is stored (see the Idempotency-Key parameter). A refusal that follows state which can change is not stored, and a retry under the same key executes again.
Request
Responses
- 201
- 400
- 409
- 422
- 500
- 503
Reverse label issued (or replayed for a known Idempotency-Key).
Response Headers
Present, with the value true, only when the response is a replay of the answer stored for the Idempotency-Key.
idempotency-key-required (the Idempotency-Key header is missing) or idempotency-key-invalid (not 1-128 printable ASCII characters).
label-already-issued (a label already covers this (returnAuthorizationId, packageNo)), destination-prefix-unavailable (this context holds no usable destination prefix for destinationNodeId; it may hold one later, once the node's registration has been consumed. Like concurrent-update, this refusal is NOT stored under the Idempotency-Key, so a retry of the same request with the same key is executed again and is served once the node is known; ADR 0018), tracking-number-taken (ErrTrackingNumberTaken), concurrent-update (ErrConcurrentUpdate) or idempotency-key-reused (the Idempotency-Key was already used with a different request).
validation-failed (a malformed request, or the order is unknown to customer-ordering).
internal-error. An unmapped failure; the detail never carries the cause. Never cached by the idempotency middleware, so the same key retries the work.
ship-to-unavailable. customer-ordering did not return the ship-to in time. No label is stored.