Request

Sets up a variant for a specific A/B/n test or personalization by copying, hiding, or swapping the original component.

Security
HTTPBearer
Path
flowIdstring(Flowid)required

The unique identifier of the A/B/n test or personalization to set up. To get this ID, you can use the List flow definitions endpoint for the page and use the flow ref value.

Example:1fdfbc60-9646-469d-b971-2b0f4c033fbc
variantIdstring(Variantid)required

The unique identifier of the personalization or A/B/n test variant to set up. To get this ID, you can use the List flow definitions endpoint. Use the transpiledVariants[].ref, or variants[].ref when available.

Example:8ea2cb6f-a92a-4c05-88a3-a4c0b29c63a8
Headers
x-sc-job-idany(X-Sc-Job-Id)

A unique identifier for the job, used to trace, audit, and revert actions performed by an AI agent through the Agent API.

Example:job-1234
Bodyapplication/jsonrequired
page_idstring, (uuid)(Page Id)required

The unique identifier of the page containing the component.

Example:"3f2504e0-4f89-11d3-9a0c-0305e82c3301"
component_idstring(Component Id)required

The unique identifier of the component to set up as a variant.

Example:"d290f1ee-6c54-4b01-90e6-d701748f0851"
variant_strategystring(VariantStrategy)required

The strategy for the variant. Either HIDE, SWAP, or COPY.

Enum:"HIDE""SWAP""COPY"
languagestring(Language)

The language code for the variant setup.

Default:"en"
Example:"en"
page_versioninteger or null(Page Version)
Example:1
Any of:

The version of the page to use, or null for the latest version.

integer
swapped_componentSwappedComponentModel (object) or null
Any of:

The replacement component details when the variant strategy is SWAP, or null otherwise.

curl -i -X POST \
  https://edge-platform.sitecorecloud.io/stream/ai-agent-api/api/v1/flows/1fdfbc60-9646-469d-b971-2b0f4c033fbc/variants/8ea2cb6f-a92a-4c05-88a3-a4c0b29c63a8 \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -H 'x-sc-job-id: job-1234' \
  -d '{
    "page_id": "3f2504e0-4f89-11d3-9a0c-0305e82c3301",
    "component_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "variant_strategy": "HIDE",
    "language": "en",
    "page_version": 1,
    "swapped_component": {
      "componentRenderingId": "86a03271-dff4-470a-92bd-b68c67de2e25",
      "datasourcePath": "/sitecore/content/Verticals/SkatePark/Data/Promos/Summer Sale"
    }
  }'

Responses

Successful response

Bodyapplication/json
pageIdstring, (uuid)(Pageid)

The unique identifier of the page.

Example:"3f2504e0-4f89-11d3-9a0c-0305e82c3301"
componentIdstring, (uuid)(Componentid)

The unique identifier of the component set up as a variant.

Example:"d290f1ee-6c54-4b01-90e6-d701748f0851"
componentRenderingIdstring, (uuid)(Componentrenderingid)

The unique identifier of the component rendering definition.

Example:"86a03271-dff4-470a-92bd-b68c67de2e25"
flowIdstring(Flowid)

The unique identifier of the A/B/n test or personalization.

Example:"1fdfbc60-9646-469d-b971-2b0f4c033fbc"
variantIdstring(Variantid)

The unique identifier of the A/B/n test or personalization variant.

Example:"8ea2cb6f-a92a-4c05-88a3-a4c0b29c63a8"
datasourcestring or null(Datasource)
Example:"/sitecore/content/Verticals/SkatePark/Data/Promos/Summer Sale"
Any of:

The path to the datasource used by the variant, or null if not applicable.

string
Response
{ "pageId": "3f2504e0-4f89-11d3-9a0c-0305e82c3301", "componentId": "d290f1ee-6c54-4b01-90e6-d701748f0851", "componentRenderingId": "86a03271-dff4-470a-92bd-b68c67de2e25", "flowId": "1fdfbc60-9646-469d-b971-2b0f4c033fbc", "variantId": "8ea2cb6f-a92a-4c05-88a3-a4c0b29c63a8", "datasource": "/sitecore/content/Verticals/SkatePark/Data/Promos/Summer Sale" }