Check a return announcement
All field references · Returns
POST /v1/returns/commands/preview
Checks the same action and then fully rolls it back. saved=false is not a booking. Also requires the read scope; the preview cannot read real warehouse stock through a test key.
Required scopes: "returns:announce", "returns:read".
#Request body
Request body required.
Content type: application/json
| Field | Type | Presence | null | Meaning, limits and examples |
|---|---|---|---|---|
| $ (whole value) | object | Whole value | Not allowed | Additional properties are not allowed. |
| idempotency_key | string | Required when parent is present | Not allowed | New client UUID per command; after unclear outcomes retry the same UUID and arguments. format: "uuid". |
| operation | alternative (anyOf) | Required when parent is present | Not allowed | Action to perform. Select kind first; only that variant determines which fields are required. |
| operation | object | Conditional: anyOf 1/1 | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Action to perform. Select kind first; only that variant determines which fields are required. Additional properties are not allowed. |
| operation.kind | string | Required when parent is present | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Kind selects required fields. const: "announce". |
| operation.return_id | string | Required when parent is present | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Return UUID: new on announce; reuse for reads/changes/retries. format: "uuid". |
| operation.reference | string | Required when parent is present | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Displayed source-system reference. minLength: 1. maxLength: 200. |
| operation.lines | array | Required when parent is present | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Returned shipment lines. Each id and each shipment_id/order_item_id/component_id combination must be unique. minItems: 1. maxItems: 100. x-meykt-unique-by: [["id"],["shipment_id","order_item_id","component_id"]]. |
| operation.lines[] | object | Every array item | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Additional properties are not allowed. |
| operation.lines[].id | string | Required when parent is present | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Stable entry identifier. format: "uuid". |
| operation.lines[].shipment_id | string | Required when parent is present | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Identifier of the documented shipment that proves the returned or dispatched quantity. format: "uuid". |
| operation.lines[].order_item_id | string | Required when parent is present | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Line identifier from the current order read. format: "uuid". |
| operation.lines[].component_id | alternative (anyOf) | Optional | Allowed by schema | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Component identifier within this order, shipment or dispatch section. Default: null. |
| operation.lines[].component_id | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce".; anyOf 1/2: At least one alternative must match. Component identifier within this order, shipment or dispatch section. format: "uuid". |
| operation.lines[].component_id | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 1/1: At least one alternative must match. Applies to kind = "announce".; anyOf 2/2: At least one alternative must match. Component identifier within this order, shipment or dispatch section. |
| operation.lines[].quantity | string | Required when parent is present | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Exact decimal-string quantity in the stated unit; no floats. pattern: "^(?=.*[1-9])(0|[1-9]\\d{0,8})(\\.\\d{1,6})?$". |
| operation.lines[].reason | string | Required when parent is present | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Recorded reason. minLength: 1. maxLength: 500. |
| operation.reason_key | string | Optional | Not allowed | anyOf 1/1: At least one alternative must match. Applies to kind = "announce". Customer return reason: withdrawal, not_as_expected, wrong_size, defective, wrong_item, transport_damage, other, or own:<uuid>. Omit for none. minLength: 1. maxLength: 80. |
#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.saved | boolean | Required when parent is present | Not allowed | Whether this operation persisted a change; false identifies a preview rather than a booking. const: false. |
| data.already_applied | boolean | Required when parent is present | Not allowed | Whether the same intended operation was already applied and this response is its replay. |
| data.entity_id | string | Required when parent is present | Not allowed | Identifier of the specific inbound or return case selected for this recovery view. format: "uuid". |
| data.before_fingerprint | string | Required when parent is present | Not allowed | Opaque fingerprint of the state inspected by the preview. pattern: "^[0-9a-f]{64}$". |
| data.before | alternative (anyOf) | Required when parent is present | Allowed by schema | Business state before the proposed action; null when the action would create the record. |
| data.before | object | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Business state before the proposed action; null when the action would create the record. |
| data.before.{key} | any JSON value | Every additional entry | Allowed by schema | anyOf 1/2: At least one alternative must match. Operation-specific current field; the concrete fields follow the selected case and action. |
| data.before | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Business state before the proposed action; null when the action would create the record. |
| data.after | alternative (anyOf) | Required when parent is present | Allowed by schema | Prospective case state after this action; a preview does not persist it. |
| data.after | object | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Prospective case state after this action; a preview does not persist it. |
| data.after.{key} | any JSON value | Every additional entry | Allowed by schema | anyOf 1/2: At least one alternative must match. Operation-specific prospective field; the concrete fields follow the selected case and action. |
| data.after | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Prospective case state after this action; a preview does not persist it. |
| data.expected_version | alternative (anyOf) | Required when parent is present | Allowed by schema | Current version from the latest read; an outdated version rejects the operation instead of overwriting concurrent changes. |
| data.expected_version | integer | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Current version from the latest read; an outdated version rejects the operation instead of overwriting concurrent changes. minimum: 0. |
| data.expected_version | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Current version from the latest read; an outdated version rejects the operation instead of overwriting concurrent changes. |
#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". |
Machine-readable version of this page: https://www.meykt.com/developers/fields-preview-return-announcement.md