# Publish an immutable stock structure version

[All field references](/en/developers/field-reference) · [Stock structures](/en/developers/fields-group-stock-structures)

`POST /v1/stock-structures/commands`

virtual_set, physical_kit or production_bom on an active native recipe. The current expected_revision and the same idempotency_key safeguard against conflicts and make retries safe. Changes neither historical orders nor quantities; assembly and manufacturing remain separate documented bookings.

Required scopes: `"stock_structures:write"`, `"products:write"`.

[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) | 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"`. |
| product_id | string | Required when parent is present | Not allowed | Meykt article ID; not SKU/external ID. format: `"uuid"`. |
| variant_id | alternative (anyOf) | Optional | Allowed by schema | Native Meykt variant ID; null = main article where allowed. Default: `null`. |
| variant_id | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Native Meykt variant ID; null = main article where allowed. format: `"uuid"`. |
| variant_id | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Native Meykt variant ID; null = main article where allowed. |
| structure_version_id | string | Required when parent is present | Not allowed | Exact saved recipe version whose warehouse behavior is being configured. format: `"uuid"`. |
| expected_revision | integer | Required when parent is present | Not allowed | Latest-read revision; stale revisions rejected. minimum: `0`. |
| mode | string | Required when parent is present | Not allowed | Mode; follow its required fields. enum: `["virtual_set","physical_kit","production_bom"]`. |
| output_condition_policy | alternative (anyOf) | Optional | Not allowed | Condition policy for finished goods from this warehouse definition. Default: `{"kind":"certified_released"}`. |
| output_condition_policy | object | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"certified_released"`. Condition policy for finished goods from this warehouse definition. Additional properties are not allowed. |
| output_condition_policy.kind | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"certified_released"`. Kind selects required fields. const: `"certified_released"`. |
| output_condition_policy | object | Conditional: anyOf 2/2 | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Condition policy for finished goods from this warehouse definition. Additional properties are not allowed. |
| output_condition_policy.kind | string | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Kind selects required fields. const: `"selected"`. |
| output_condition_policy.condition_refs | array | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Distinct immutable condition references selected from the current catalog. minItems: `1`. maxItems: `100`. |
| output_condition_policy.condition_refs[] | string | Every array item | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. format: `"uuid"`. |
| component_conditions | array | Required when parent is present | Not allowed | Condition policy for each selected component slot; list each slot only once. minItems: `1`. maxItems: `100`. |
| component_conditions[] | object | Every array item | Not allowed | Additional properties are not allowed. |
| component_conditions[].slot_id | string | Required when parent is present | Not allowed | Stable component slot ID from the selected structure. format: `"uuid"`. |
| component_conditions[].policy | alternative (anyOf) | Required when parent is present | Not allowed | Eligible stock-condition policy for the selected component slot. |
| component_conditions[].policy | object | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"certified_released"`. Eligible stock-condition policy for the selected component slot. Additional properties are not allowed. |
| component_conditions[].policy.kind | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"certified_released"`. Kind selects required fields. const: `"certified_released"`. |
| component_conditions[].policy | object | Conditional: anyOf 2/2 | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Eligible stock-condition policy for the selected component slot. Additional properties are not allowed. |
| component_conditions[].policy.kind | string | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Kind selects required fields. const: `"selected"`. |
| component_conditions[].policy.condition_refs | array | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Distinct immutable condition references selected from the current catalog. minItems: `1`. maxItems: `100`. |
| component_conditions[].policy.condition_refs[] | string | Every array item | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. format: `"uuid"`. |
| reason | string | Required when parent is present | Not allowed | Recorded reason. minLength: `1`. maxLength: `500`. |

## 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.product_id | string | Required when parent is present | Not allowed | Meykt article ID; not SKU/external ID. format: `"uuid"`. |
| data.variant_id | alternative (anyOf) | Required when parent is present | Allowed by schema | Native Meykt variant ID; null = main article where allowed. |
| data.variant_id | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Native Meykt variant ID; null = main article where allowed. format: `"uuid"`. |
| data.variant_id | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Native Meykt variant ID; null = main article where allowed. |
| data.stock_product_id | alternative (anyOf) | Required when parent is present | Allowed by schema | Physical stock article of this product/variant. |
| data.stock_product_id | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Physical stock article of this product/variant. format: `"uuid"`. |
| data.stock_product_id | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Physical stock article of this product/variant. |
| data.variant_revision | alternative (anyOf) | Required when parent is present | Allowed by schema | Current revision of the variant binding; retain it when changing that binding. |
| data.variant_revision | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Current revision of the variant binding; retain it when changing that binding. format: `"date-time"`. |
| data.variant_revision | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Current revision of the variant binding; retain it when changing that binding. |
| data.definition_id | string | Required when parent is present | Not allowed | Identifier of the published warehouse manufacturing definition. format: `"uuid"`. |
| data.structure_version_id | string | Required when parent is present | Not allowed | Exact saved recipe version whose warehouse behavior is being configured. format: `"uuid"`. |
| data.revision | integer | Required when parent is present | Not allowed | Revision token; reuse unchanged for the next change. exclusiveMinimum: `0`. |
| data.mode | string | Required when parent is present | Not allowed | Mode; follow its required fields. enum: `["virtual_set","physical_kit","production_bom"]`. |
| data.output_condition_policy | alternative (anyOf) | Required when parent is present | Not allowed | Condition policy for finished goods from this warehouse definition. |
| data.output_condition_policy | object | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"certified_released"`. Condition policy for finished goods from this warehouse definition. Additional properties are not allowed. |
| data.output_condition_policy.kind | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"certified_released"`. Kind selects required fields. const: `"certified_released"`. |
| data.output_condition_policy | object | Conditional: anyOf 2/2 | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Condition policy for finished goods from this warehouse definition. Additional properties are not allowed. |
| data.output_condition_policy.kind | string | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Kind selects required fields. const: `"selected"`. |
| data.output_condition_policy.condition_refs | array | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Distinct immutable condition references selected from the current catalog. minItems: `1`. maxItems: `100`. |
| data.output_condition_policy.condition_refs[] | string | Every array item | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. format: `"uuid"`. |
| data.created_at | string | Required when parent is present | Not allowed | Created at, with time-zone offset. format: `"date-time"`. |
| data.components | array | Required when parent is present | Not allowed | Component quantities/choices for this set, manufacturing or dispatch line. minItems: `1`. maxItems: `100`. |
| data.components[] | object | Every array item | Not allowed | Additional properties are not allowed. |
| data.components[].id | string | Required when parent is present | Not allowed | Stable entry identifier. format: `"uuid"`. |
| data.components[].slot_id | string | Required when parent is present | Not allowed | Stable component slot ID from the selected structure. format: `"uuid"`. |
| data.components[].product_id | string | Required when parent is present | Not allowed | Meykt article ID; not SKU/external ID. format: `"uuid"`. |
| data.components[].variant_id | alternative (anyOf) | Required when parent is present | Allowed by schema | Native Meykt variant ID; null = main article where allowed. |
| data.components[].variant_id | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Native Meykt variant ID; null = main article where allowed. format: `"uuid"`. |
| data.components[].variant_id | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Native Meykt variant ID; null = main article where allowed. |
| data.components[].stock_product_id | string | Required when parent is present | Not allowed | Physical stock article of this product/variant. format: `"uuid"`. |
| data.components[].unit | string | Required when parent is present | Not allowed | Exact offered unit; no implicit carton, weight or dimension conversion. const: `"piece"`. |
| data.components[].quantity_per_parent | string | Required when parent is present | Not allowed | Component quantity per parent item, in the component’s unit. pattern: `"^[1-9]\\d{0,8}$"`. |
| data.components[].condition_policy | alternative (anyOf) | Required when parent is present | Not allowed | Policy selecting which stock conditions are eligible for this component. |
| data.components[].condition_policy | object | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"certified_released"`. Policy selecting which stock conditions are eligible for this component. Additional properties are not allowed. |
| data.components[].condition_policy.kind | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"certified_released"`. Kind selects required fields. const: `"certified_released"`. |
| data.components[].condition_policy | object | Conditional: anyOf 2/2 | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Policy selecting which stock conditions are eligible for this component. Additional properties are not allowed. |
| data.components[].condition_policy.kind | string | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Kind selects required fields. const: `"selected"`. |
| data.components[].condition_policy.condition_refs | array | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. Distinct immutable condition references selected from the current catalog. minItems: `1`. maxItems: `100`. |
| data.components[].condition_policy.condition_refs[] | string | Every array item | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"selected"`. format: `"uuid"`. |

## 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"`. |
