# Run a warehouse command on a returned parcel

[All field references](/en/developers/field-reference) · [Returns](/en/developers/fields-group-returns)

`POST /v1/returns/parcels/commands`

Warehouse commands: ask the goods owner, record a decision, reship, unpack, scrap, assign an order or replace the note. Reship needs an issued manual label of the same order, or a carrier and a tracking number. Personalized goods are never restocked as free. After an unclear outcome, retry the same idempotency key and the same body. A test key cannot change real parcels.

Required scopes: `"returns:process"`.

[How to read these tables](/en/developers/field-reference#reading-the-field-tables)

## Request body

Request body required.

Content type: `application/json`

| Field | Type | Presence | null | Meaning, limits and examples |
| --- | --- | --- | --- | --- |
| $ (whole value) | alternative (anyOf) | Whole value | Not allowed | — |
| $ (whole value) | object | Conditional: anyOf 1/7 | Not allowed | anyOf 1/7: At least one alternative must match. Applies to kind = `"ask_owner"`. Additional properties are not allowed. |
| kind | string | Required when parent is present | Not allowed | anyOf 1/7: At least one alternative must match. Applies to kind = `"ask_owner"`. Ask the goods owner to decide. Only an open parcel of foreign goods. const: `"ask_owner"`. |
| idempotency_key | string | Required when parent is present | Not allowed | anyOf 1/7: At least one alternative must match. Applies to kind = `"ask_owner"`. New UUID per intended command. The same key and body return the same result without a second booking. format: `"uuid"`. |
| parcel_id | string | Required when parent is present | Not allowed | anyOf 1/7: At least one alternative must match. Applies to kind = `"ask_owner"`. Return parcel in the warehouse organization. format: `"uuid"`. |
| expected_version | integer | Required when parent is present | Not allowed | anyOf 1/7: At least one alternative must match. Applies to kind = `"ask_owner"`. Parcel version from the last read. A mismatch is wms_version_conflict. minimum: `1`. maximum: `2147483647`. |
| $ (whole value) | object | Conditional: anyOf 2/7 | Not allowed | anyOf 2/7: At least one alternative must match. Applies to kind = `"decide"`. Additional properties are not allowed. |
| kind | string | Required when parent is present | Not allowed | anyOf 2/7: At least one alternative must match. Applies to kind = `"decide"`. Record reship, unpack, scrap, or hold. The warehouse may decide only when the rule is operator or the goods are its own. const: `"decide"`. |
| idempotency_key | string | Required when parent is present | Not allowed | anyOf 2/7: At least one alternative must match. Applies to kind = `"decide"`. New UUID per intended command. The same key and body return the same result without a second booking. format: `"uuid"`. |
| parcel_id | string | Required when parent is present | Not allowed | anyOf 2/7: At least one alternative must match. Applies to kind = `"decide"`. Return parcel in the warehouse organization. format: `"uuid"`. |
| expected_version | integer | Required when parent is present | Not allowed | anyOf 2/7: At least one alternative must match. Applies to kind = `"decide"`. Parcel version from the last read. A mismatch is wms_version_conflict. minimum: `1`. maximum: `2147483647`. |
| decision | string | Required when parent is present | Not allowed | anyOf 2/7: At least one alternative must match. Applies to kind = `"decide"`. reship, unpack, scrap, or hold. enum: `["reship","unpack","scrap","hold"]`. |
| note | string | Optional | Not allowed | anyOf 2/7: At least one alternative must match. Applies to kind = `"decide"`. Decision note, 1 to 1000 characters. Omit for no note. minLength: `1`. maxLength: `1000`. |
| reship_address | object | Optional | Not allowed | anyOf 2/7: At least one alternative must match. Applies to kind = `"decide"`. Replacement address stored with a reship decision. The label itself is created separately. Omit when the decision is not reship. |
| reship_address.{key} | string or number or boolean or null | Every additional entry | Allowed by schema | anyOf 2/7: At least one alternative must match. Applies to kind = `"decide"`. One replacement-address field: text, number, boolean or null. Omit the whole address when the decision is not reship. |
| $ (whole value) | object | Conditional: anyOf 3/7 | Not allowed | anyOf 3/7: At least one alternative must match. Applies to kind = `"reship"`. Additional properties are not allowed. |
| kind | string | Required when parent is present | Not allowed | anyOf 3/7: At least one alternative must match. Applies to kind = `"reship"`. Close the parcel as reshipped. Supply an issued manual label of the same order, or a carrier and tracking number. const: `"reship"`. |
| idempotency_key | string | Required when parent is present | Not allowed | anyOf 3/7: At least one alternative must match. Applies to kind = `"reship"`. New UUID per intended command. The same key and body return the same result without a second booking. format: `"uuid"`. |
| parcel_id | string | Required when parent is present | Not allowed | anyOf 3/7: At least one alternative must match. Applies to kind = `"reship"`. Return parcel in the warehouse organization. format: `"uuid"`. |
| expected_version | integer | Required when parent is present | Not allowed | anyOf 3/7: At least one alternative must match. Applies to kind = `"reship"`. Parcel version from the last read. A mismatch is wms_version_conflict. minimum: `1`. maximum: `2147483647`. |
| manual_label_id | string | Optional | Not allowed | anyOf 3/7: At least one alternative must match. Applies to kind = `"reship"`. Issued manual label of this order. Omit when carrier and tracking are sent instead. format: `"uuid"`. |
| carrier | string | Optional | Not allowed | anyOf 3/7: At least one alternative must match. Applies to kind = `"reship"`. Carrier name, 1 to 80 characters, only together with tracking and without a manual label. minLength: `1`. maxLength: `80`. |
| tracking | string | Optional | Not allowed | anyOf 3/7: At least one alternative must match. Applies to kind = `"reship"`. Tracking number, 1 to 120 characters, only together with carrier and without a manual label. minLength: `1`. maxLength: `120`. |
| $ (whole value) | object | Conditional: anyOf 4/7 | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. Additional properties are not allowed. |
| kind | string | Required when parent is present | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. Open the parcel and create a return case from its proved lines. When the package quantity is still open, send items with quantity_confirmed true. const: `"unpack"`. |
| idempotency_key | string | Required when parent is present | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. New UUID per intended command. The same key and body return the same result without a second booking. format: `"uuid"`. |
| parcel_id | string | Required when parent is present | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. Return parcel in the warehouse organization. format: `"uuid"`. |
| expected_version | integer | Required when parent is present | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. Parcel version from the last read. A mismatch is wms_version_conflict. minimum: `1`. maximum: `2147483647`. |
| items | array | Optional | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. Required only when the parcel still asks for a quantity per line. Omit when the package contents are already known. maxItems: `50`. |
| items[] | object | Every array item | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. Additional properties are not allowed. |
| items[].order_item_id | string | Required when parent is present | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. Order line whose quantity the person confirms for this package. format: `"uuid"`. |
| items[].label | string | Required when parent is present | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. Display name of the line, 1 to 200 characters. minLength: `1`. maxLength: `200`. |
| items[].quantity | alternative (anyOf) | Required when parent is present | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. How many pieces of this line were in this package. |
| items[].quantity | number | Conditional: anyOf 1/2 | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`.; anyOf 1/2: At least one alternative must match. How many pieces of this line were in this package. exclusiveMinimum: `0`. maximum: `1000000`. |
| items[].quantity | string | Conditional: anyOf 2/2 | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`.; anyOf 2/2: At least one alternative must match. How many pieces of this line were in this package. pattern: `"^(?:0\|[1-9]\\d*)(?:\\.\\d+)?$"`. |
| items[].quantity_confirmed | boolean | Required when parent is present | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. Must be true. Confirms the person entered this package quantity. const: `true`. |
| items[].personalized | boolean | Optional | Not allowed | anyOf 4/7: At least one alternative must match. Applies to kind = `"unpack"`. True when the person marks this piece as personalized. |
| $ (whole value) | object | Conditional: anyOf 5/7 | Not allowed | anyOf 5/7: At least one alternative must match. Applies to kind = `"scrap"`. Additional properties are not allowed. |
| kind | string | Required when parent is present | Not allowed | anyOf 5/7: At least one alternative must match. Applies to kind = `"scrap"`. Dispose of the unopened parcel. Stock was already removed at shipment. const: `"scrap"`. |
| idempotency_key | string | Required when parent is present | Not allowed | anyOf 5/7: At least one alternative must match. Applies to kind = `"scrap"`. New UUID per intended command. The same key and body return the same result without a second booking. format: `"uuid"`. |
| parcel_id | string | Required when parent is present | Not allowed | anyOf 5/7: At least one alternative must match. Applies to kind = `"scrap"`. Return parcel in the warehouse organization. format: `"uuid"`. |
| expected_version | integer | Required when parent is present | Not allowed | anyOf 5/7: At least one alternative must match. Applies to kind = `"scrap"`. Parcel version from the last read. A mismatch is wms_version_conflict. minimum: `1`. maximum: `2147483647`. |
| $ (whole value) | object | Conditional: anyOf 6/7 | Not allowed | anyOf 6/7: At least one alternative must match. Applies to kind = `"assign_order"`. Additional properties are not allowed. |
| kind | string | Required when parent is present | Not allowed | anyOf 6/7: At least one alternative must match. Applies to kind = `"assign_order"`. Attach an unknown parcel to an order. Optional package and shipment. const: `"assign_order"`. |
| idempotency_key | string | Required when parent is present | Not allowed | anyOf 6/7: At least one alternative must match. Applies to kind = `"assign_order"`. New UUID per intended command. The same key and body return the same result without a second booking. format: `"uuid"`. |
| parcel_id | string | Required when parent is present | Not allowed | anyOf 6/7: At least one alternative must match. Applies to kind = `"assign_order"`. Return parcel in the warehouse organization. format: `"uuid"`. |
| expected_version | integer | Required when parent is present | Not allowed | anyOf 6/7: At least one alternative must match. Applies to kind = `"assign_order"`. Parcel version from the last read. A mismatch is wms_version_conflict. minimum: `1`. maximum: `2147483647`. |
| order_id | string | Required when parent is present | Not allowed | anyOf 6/7: At least one alternative must match. Applies to kind = `"assign_order"`. Warehouse order that this parcel belongs to. format: `"uuid"`. |
| package_id | string | Optional | Not allowed | anyOf 6/7: At least one alternative must match. Applies to kind = `"assign_order"`. Shipped package on that order. Omit to keep the current package. format: `"uuid"`. |
| shipment_id | string | Optional | Not allowed | anyOf 6/7: At least one alternative must match. Applies to kind = `"assign_order"`. Shipment on that order. Omit to keep the current shipment. format: `"uuid"`. |
| $ (whole value) | object | Conditional: anyOf 7/7 | Not allowed | anyOf 7/7: At least one alternative must match. Applies to kind = `"note"`. Additional properties are not allowed. |
| kind | string | Required when parent is present | Not allowed | anyOf 7/7: At least one alternative must match. Applies to kind = `"note"`. Replace the parcel note. Allowed for the warehouse and the goods owner, including after close. const: `"note"`. |
| idempotency_key | string | Required when parent is present | Not allowed | anyOf 7/7: At least one alternative must match. Applies to kind = `"note"`. New UUID per intended command. The same key and body return the same result without a second booking. format: `"uuid"`. |
| parcel_id | string | Required when parent is present | Not allowed | anyOf 7/7: At least one alternative must match. Applies to kind = `"note"`. Return parcel in the warehouse organization. format: `"uuid"`. |
| expected_version | integer | Required when parent is present | Not allowed | anyOf 7/7: At least one alternative must match. Applies to kind = `"note"`. Parcel version from the last read. A mismatch is wms_version_conflict. minimum: `1`. maximum: `2147483647`. |
| note | string | Required when parent is present | Not allowed | anyOf 7/7: At least one alternative must match. Applies to kind = `"note"`. Note, 1 to 1000 characters. minLength: `1`. maxLength: `1000`. |

## Response 200

200: Success

Content type: `application/json`

| Field | Type | Presence | null | Meaning, limits and examples |
| --- | --- | --- | --- | --- |
| $ (whole value) | object | Whole value | Not allowed | Additional properties are not allowed. |
| data | object | Required when parent is present | Not allowed | Authorized response payload or documented event data. Additional properties are not allowed. |
| data.parcel_id | string | Required when parent is present | Not allowed | Return parcel the command applied to. format: `"uuid"`. |
| data.case_id | string | Required when parent is present | Not allowed | Clarification case of the parcel. format: `"uuid"`. |
| data.code | string | Required when parent is present | Not allowed | Case code, for example KF-0001. |
| data.kind | string | Required when parent is present | Not allowed | Command kind that was applied. |
| data.status | string | Required when parent is present | Not allowed | Parcel status after the command. enum: `["open","awaiting_owner","decided","closed"]`. |
| data.decision | alternative (anyOf) | Required when parent is present | Allowed by schema | Stored decision. Null until someone decides. |
| data.decision | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Stored decision. Null until someone decides. enum: `["reship","unpack","scrap","hold"]`. |
| data.decision | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Stored decision. Null until someone decides. |
| data.decision_side | alternative (anyOf) | Required when parent is present | Allowed by schema | Who decided. Null until someone decides. |
| data.decision_side | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Who decided. Null until someone decides. enum: `["operator","owner"]`. |
| data.decision_side | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Who decided. Null until someone decides. |
| data.outcome | alternative (anyOf) | Required when parent is present | Allowed by schema | Closed outcome. Null until the parcel is closed that way. |
| data.outcome | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Closed outcome. Null until the parcel is closed that way. enum: `["reshipped","unpacked","scrapped"]`. |
| data.outcome | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Closed outcome. Null until the parcel is closed that way. |
| data.return_id | alternative (anyOf) | Required when parent is present | Allowed by schema | Customer return created by unpack. Null otherwise. |
| data.return_id | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Customer return created by unpack. Null otherwise. format: `"uuid"`. |
| data.return_id | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Customer return created by unpack. Null otherwise. |
| data.version | integer | Required when parent is present | Not allowed | Parcel version after the command. Send it as expected_version next time. exclusiveMinimum: `0`. |

## Response 401, 403, 404, 409, 422, 429, 500, 503

401: The key is missing, unknown, revoked or expired. 403: The key lacks a required scope, or the operation requires a live key. 404: Not found. Also applies to IDs that belong to another organization — we deliberately do not distinguish between "does not exist" and "does not belong to you". 409: The same ID already exists with different content. It is never overwritten. 422: Content validation failed. The response lists all affected locations at once. 429: A rate limit was reached and the request did not run. Wait for Retry-After, then repeat it unchanged. X-RateLimit-Scope names the limit: key (120 requests per minute), organization (300 per minute across all keys), write (1,000 at once, refilling at 60 per minute) or list (300 unfiltered list pages at once, refilling at 10 per minute). 500: Unexpected error on our side. 503: Temporarily unavailable. Repeat the same request with the same business identity.

Content type: `application/json`

| Field | Type | Presence | null | Meaning, limits and examples |
| --- | --- | --- | --- | --- |
| $ (whole value) | object | Whole value | Not allowed | — |
| error | object | Required when parent is present | Not allowed | Machine-readable error code; use it to select the documented recovery path. |
| error.code | string | Required when parent is present | Not allowed | Machine-readable, permanently stable error code. Program against it, not against message. |
| error.message | string | Required when parent is present | Not allowed | Explanation for humans. May change at any time. |
| error.field | string | Optional | Not allowed | Affected location in the request, if it can be determined. |
| error.doc_url | string | Required when parent is present | Not allowed | Documentation link explaining this API error. format: `"uri"`. |
