# Save or archive a complete native recipe

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

`POST /v1/product-structures/commands`

save activates a changed recipe immediately; unchanged content can keep the active version with reused=true. There is no separately saved draft. archive uses the current structure_id and expected_revision. request_id stays unchanged for the same business operation. Existing order snapshots and warehouse records are not rewritten; afterwards you may need to explicitly republish a stock structure.

Required scopes: `"products:write"`, `"product_structures: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. |
| request_id | string | Required when parent is present | Not allowed | Identifier for this intended request; retain it when retrying the same operation. format: `"uuid"`. |
| operation | alternative (anyOf) | Required when parent is present | Not allowed | Action to perform. Select kind first, then supply the fields required by that action variant. |
| operation | object | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Action to perform. Select kind first, then supply the fields required by that action variant. Additional properties are not allowed. |
| operation.kind | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Action or record discriminator; selects the applicable fields and requirements in this object. const: `"save"`. |
| operation.definition | object | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Complete native recipe. Components cannot reference the parent article; every route target must reference a listed component slot. Saving does not silently rewrite existing orders. Additional properties are not allowed. x-meykt-unique-by: `{"parts":[["slotId"]]}`. |
| operation.definition.parentProductId | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Meykt article identifier whose native recipe is being defined. format: `"uuid"`. |
| operation.definition.parentProductVariantId | alternative (anyOf) | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Native parent variant identifier; null selects the main article recipe. |
| operation.definition.parentProductVariantId | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 1/2: At least one alternative must match. Native parent variant identifier; null selects the main article recipe. format: `"uuid"`. |
| operation.definition.parentProductVariantId | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 2/2: At least one alternative must match. Native parent variant identifier; null selects the main article recipe. |
| operation.definition.expectedRevision | integer | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Current recipe revision; use the revision read from the current recipe. minimum: `0`. maximum: `2147483647`. |
| operation.definition.parts | array | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Complete list of component slots. Slot UUIDs must be unique. A parent article cannot be its own component. minItems: `1`. maxItems: `100`. |
| operation.definition.parts[] | object | Every array item | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Additional properties are not allowed. |
| operation.definition.parts[].slotId | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Stable component slot UUID; retain it when editing the same component slot. format: `"uuid"`. |
| operation.definition.parts[].productId | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Meykt article identifier used by this component slot. format: `"uuid"`. |
| operation.definition.parts[].productVariantId | alternative (anyOf) | Required when parent is present | Allowed by schema | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Native variant identifier selected for this component; null selects its main article. |
| operation.definition.parts[].productVariantId | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 1/2: At least one alternative must match. Native variant identifier selected for this component; null selects its main article. format: `"uuid"`. |
| operation.definition.parts[].productVariantId | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 2/2: At least one alternative must match. Native variant identifier selected for this component; null selects its main article. |
| operation.definition.parts[].label | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Display label explaining this attachment or entry to the user. minLength: `1`. maxLength: `120`. |
| operation.definition.parts[].quantity | integer | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Quantity in the stated unit, represented as a JSON number by this contract. exclusiveMinimum: `0`. maximum: `1000000000`. |
| operation.definition.parts[].sortOrder | integer | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Display ordering of this component slot, starting at zero. minimum: `0`. maximum: `99`. |
| operation.definition.routes | array | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Rules deciding which personalization reaches which component slots. Targets must name slots in parts; the total number of targets across all routes must stay within the recipe limit. maxItems: `500`. |
| operation.definition.routes[] | object | Every array item | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Additional properties are not allowed. |
| operation.definition.routes[].source | alternative (anyOf) | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Source personalization field selected for this routing rule. |
| operation.definition.routes[].source | object | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 1/2: At least one alternative must match. Applies to kind = `"provider_field"`. Source personalization field selected for this routing rule. Additional properties are not allowed. |
| operation.definition.routes[].source.kind | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 1/2: At least one alternative must match. Applies to kind = `"provider_field"`. Action or record discriminator; selects the applicable fields and requirements in this object. const: `"provider_field"`. |
| operation.definition.routes[].source.provider | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 1/2: At least one alternative must match. Applies to kind = `"provider_field"`. Provider code for this external condition mapping or source field. enum: `["shopify","etsy","woocommerce","amazon","ebay","billbee","pos","manual","b2b_portal","b2c_portal","api"]`. |
| operation.definition.routes[].source.sourceKey | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 1/2: At least one alternative must match. Applies to kind = `"provider_field"`. Exact field key used by the selected source provider. minLength: `1`. maxLength: `500`. |
| operation.definition.routes[].source | object | Conditional: anyOf 2/2 | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 2/2: At least one alternative must match. Applies to kind = `"compiler_variable"`. Source personalization field selected for this routing rule. Additional properties are not allowed. |
| operation.definition.routes[].source.kind | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 2/2: At least one alternative must match. Applies to kind = `"compiler_variable"`. Action or record discriminator; selects the applicable fields and requirements in this object. const: `"compiler_variable"`. |
| operation.definition.routes[].source.variableId | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 2/2: At least one alternative must match. Applies to kind = `"compiler_variable"`. Identifier of the configured variable selected as the source. format: `"uuid"`. |
| operation.definition.routes[].source.variableKey | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`.; anyOf 2/2: At least one alternative must match. Applies to kind = `"compiler_variable"`. Published key of the configured variable. minLength: `1`. maxLength: `120`. |
| operation.definition.routes[].mode | string | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Selected behavior from the supported modes; each mode has its own documented requirements. enum: `["append","replace","exclude"]`. |
| operation.definition.routes[].targetSlotIds | array | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Component slot identifiers receiving the selected personalization. maxItems: `100`. uniqueItems: `true`. |
| operation.definition.routes[].targetSlotIds[] | string | Every array item | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. format: `"uuid"`. |
| operation.definition.routes[].overwriteExisting | boolean | Required when parent is present | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Whether this route may replace an existing value on its selected targets. |
| operation.definition.routes[].compileTargetVariable | string | Optional | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. Optional target variable name: starts with a letter or underscore, then letters, digits or underscores. Whitespace is trimmed; a surrounding {{...}} is accepted and removed. An empty value means not set. maxLength: `120`. pattern: `"^[A-Za-z_][A-Za-z0-9_]*$"`. |
| operation.definition.fulfillmentMode | string | Optional | Not allowed | anyOf 1/2: At least one alternative must match. Applies to kind = `"save"`. atomic fulfills the set as a whole; per_part fulfills its components separately. Default: `"atomic"`. enum: `["atomic","per_part"]`. |
| operation | object | Conditional: anyOf 2/2 | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"archive"`. Action to perform. Select kind first, then supply the fields required by that action variant. Additional properties are not allowed. |
| operation.kind | string | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"archive"`. Action or record discriminator; selects the applicable fields and requirements in this object. const: `"archive"`. |
| operation.product_id | string | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"archive"`. Meykt article identifier; not its SKU or an external system identifier. format: `"uuid"`. |
| operation.structure_id | string | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"archive"`. Identifier of the native recipe being archived. format: `"uuid"`. |
| operation.expected_revision | integer | Required when parent is present | Not allowed | anyOf 2/2: At least one alternative must match. Applies to kind = `"archive"`. Current native recipe revision; an outdated revision rejects the archive request. minimum: `0`. maximum: `2147483647`. |

## 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.request_id | string | Required when parent is present | Not allowed | Identifier for this intended request; retain it when retrying the same operation. format: `"uuid"`. |
| data.kind | string | Required when parent is present | Not allowed | Action or record discriminator; selects the applicable fields and requirements in this object. enum: `["save","archive"]`. |
| data.product_id | string | Required when parent is present | Not allowed | Meykt article identifier; not its SKU or an external system identifier. format: `"uuid"`. |
| data.variant_id | alternative (anyOf) | Required when parent is present | Allowed by schema | Native Meykt variant identifier; null refers to the 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 identifier; null refers to the 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 identifier; null refers to the main article where allowed. |
| data.structure_id | string | Required when parent is present | Not allowed | Identifier of the native recipe being archived. format: `"uuid"`. |
| data.version_id | alternative (anyOf) | Required when parent is present | Allowed by schema | Saved native recipe version; null when no active version exists. |
| data.version_id | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Saved native recipe version; null when no active version exists. format: `"uuid"`. |
| data.version_id | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Saved native recipe version; null when no active version exists. |
| data.revision | integer | Required when parent is present | Not allowed | Current native recipe revision. minimum: `0`. maximum: `2147483647`. |
| data.content_hash | alternative (anyOf) | Required when parent is present | Allowed by schema | Opaque fingerprint of the saved recipe content; null when no version exists. |
| data.content_hash | string | Conditional: anyOf 1/2 | Not allowed | anyOf 1/2: At least one alternative must match. Opaque fingerprint of the saved recipe content; null when no version exists. pattern: `"^[a-f0-9]{64}$"`. |
| data.content_hash | null | Conditional: anyOf 2/2 | Allowed by schema | anyOf 2/2: At least one alternative must match. Opaque fingerprint of the saved recipe content; null when no version exists. |
| data.archived | boolean | Required when parent is present | Not allowed | Whether this recipe or record has been archived. |
| data.reused | boolean | Required when parent is present | Not allowed | Whether an existing identical version was reused. |
| data.activation | string | Required when parent is present | Not allowed | Outcome of activating this native recipe version. enum: `["activated_by_save","archived"]`. |
| data.stock_publication_stale | boolean | Required when parent is present | Not allowed | Whether the warehouse publication no longer matches the current native recipe and needs explicit republishing. |
| data.created_at | string | Required when parent is present | Not allowed | Time this record was created, including a time-zone offset. format: `"date-time"`. |

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