# Create a personalization variant

Creates a new personalization variant of a page, enabling you to define targeting rules for different audiences.

Endpoint: POST /api/v2/personalization/{pageId}/versions
Version: v2.0
Security: HTTPBearer

## Security:

  - `HTTPBearer` (unknown)
    http bearer JWT

## Path parameters:

  - `pageId` (string, required)
    The unique identifier of the page for which to create a personalization version. To get this ID, use [List pages of a site](#operation/sites-get_all_pages_by_site).

## Header parameters:

  - `x-sc-job-id` (any)
    A unique identifier for the job, used to trace, audit, and revert actions performed by an AI agent through the Agent API.

## Request fields (application/json):

  - `name` (string, required)
    The name of the personalization rule.
    Example: Summer Sale Personalization

  - `language` (any)
    The language code for the personalization rule, or null for default.
    Example: en

  - `variant_name` (string, required)
    The name of the personalization variant.
    Example: Summer Sale Variant

  - `audience_name` (string, required)
    The name of the audience for the personalization rule.
    Example: Returning Customers

  - `condition_groups` (array, required)
    List of condition groups with their conditions

  - `condition_groups.union_type` (any)
    The union type for combining conditions within the group. Either 'AND' or 'OR'. The first group should not have a union type.
    Example: AND

  - `condition_groups.conditions` (array, required)
    A list of conditions in this group.

  - `condition_groups.conditions.condition_template_id` (string, required)
    The unique identifier of the condition template to apply.
    Example: 3f2504e0-4f89-11d3-9a0c-0305e82c3301

  - `condition_groups.conditions.condition_params` (object, required)
    A key-value map of parameters for the condition template.
    Example: {"timeOnSite":"30"}

## Response 201:

  - `201` (unknown)
    Successful response

## Response 201 fields (application/json):

  - `clientKey` (string)
    The client key associated with the flow definition (A/B/n test or personalization).
    Example: pers12345

  - `href` (any)
    The URL of the flow definition (A/B/n test or personalization).
    Example: https://www.example.com/flow-definition

  - `ref` (string)
    A reference identifier for the flow definition (A/B/n test or personalization).
    Example: FlowDefinition-12345

  - `name` (string)
    The name of the flow definition (A/B/n test or personalization).
    Example: User Registration Flow

  - `modifiedByRef` (any)
    A reference identifier for the user who last modified the flow definition (A/B/n test or personalization).
    Example: User-67890

  - `modifiedAt` (any)
    The timestamp when the flow definition was last modified (A/B/n test or personalization).
    Example: 2025-01-15T10:30:00Z

  - `revision` (any)
    The revision number of the flow definition (A/B/n test or personalization).
    Example: 2

  - `archived` (boolean)
    Whether the flow definition (A/B/n test or personalization) is archived.
    Example: false

  - `friendlyId` (string)
    A user-friendly identifier for the flow definition (A/B/n test or personalization).
    Example: user_registration_flow

  - `type` (string)
    The type of the flow definition (A/B/n test or personalization).
    Example: EMBEDDED

  - `channels` (any)
    A list of channels associated with the flow definition (A/B/n test or personalization), such as web or mobile.

  - `triggers` (any)
    A list of triggers for the flow definition (A/B/n test or personalization), or null if none.

  - `tags` (any)
    A list of tags associated with the flow definition (A/B/n test or personalization), or null if none.

  - `businessProcess` (any)
    The business process associated with the flow definition (A/B/n test or personalization).
    Example: user_registration

  - `siteId` (string)
    The unique identifier of the site associated with A/B/n test or personalization.
    Example: site_123

  - `transpiledVariants` (any)
    A list of transpiled variants for the flow definition (A/B/n test or personalization), or null if none. `variantId` is typically in `transpiledVariants[].tasks[].input.template` as serialized JSON.

  - `variants` (any)
    A list of variants for the flow definition (A/B/n test or personalization), or null if none.

  - `status` (string)
    The current status of the flow definition (A/B/n test or personalization).
    Example: DRAFT

  - `schedule` (any)
    The schedule configuration for the flow definition (A/B/n test or personalization).

  - `schedule.type` (string)
    The type of schedule for the flow definition (A/B/n test or personalization).
    Example: simpleSchedule

  - `schedule.startDate` (any)
    The start date of the schedule.
    Example: 2023-01-01T00:00:00Z

  - `revisions` (any)
    Links to the revisions of the flow definition.

  - `revisions.href` (any)
    The URL to access the revisions of the flow definition (A/B/n test or personalization).
    Example: https://www.example.com/flow-definition/revisions

  - `sampleSizeConfig` (any)
    The sample size configuration for the flow definition.

  - `sampleSizeConfig.baseValue` (number)
    The base value used for sample size calculation.
    Example: 0.5

  - `sampleSizeConfig.minimumDetectableDifference` (number)
    The minimum detectable difference for the sample size calculation.
    Example: 0.1

  - `sampleSizeConfig.confidenceLevel` (number)
    The confidence level for the sample size calculation.
    Example: 0.95

  - `sampleSizeConfig.sampleSize` (any)
    The calculated sample size, or null if not yet computed.

  - `notificationEnabled` (any)
    Whether notifications are enabled for the flow definition (A/B/n test or personalization).

  - `subtype` (string)
    The subtype of the flow definition (A/B/n test or personalization), identifying it as a personalization experience.
    Example: EXPERIENCE

  - `traffic` (object)

  - `traffic.type` (string)
    The type of traffic distribution for the flow definition (A/B/n test or personalization).
    Example: audienceTraffic

  - `traffic.weightingAlgorithm` (any)
    The algorithm used for weighting traffic distribution.
    Example: USER_DEFINED

  - `traffic.modifiedAt` (any)
    The timestamp when the traffic distribution was last modified.
    Example: 2023-01-01T00:00:00Z

  - `traffic.splits` (array)
    A list of traffic splits for each personalization experience variant.

  - `traffic.splits.template` (string)
    A serialized JSON payload for the split template. This payload typically includes variantId.
    Example: {"variantId":"27f26f52b0ac40168aedb6eb15eff10f"}

  - `traffic.splits.variantName` (string)
    The display name of the variant used in this split.
    Example: Page 2 variant

  - `traffic.splits.audienceName` (string)
    The display name of the audience targeted by this split.
    Example: Returning Visitors

  - `traffic.splits.conditionGroups` (array)
    The list of condition groups that determine when this split is eligible.

  - `traffic.splits.conditionGroups.unionType` (any)
    Union type for combining conditions. Either AND or OR. First group should not have a unionType.

  - `traffic.splits.conditionGroups.conditions` (array)
    A list of conditions in this condition group.

  - `traffic.splits.conditionGroups.conditions.templateId` (string)
    The unique identifier of the condition template.
    Example: cond-6c54-4b01-90e6-d701748f0851

  - `traffic.splits.conditionGroups.conditions.params` (object)
    A key-value map of parameters for the condition.

  - `dashboardLinks` (any)
    A list of dashboard links for the experience, or null if none.

## Response 422:

  - `422` (unknown)
    Unprocessable entity

## Response 422 fields (application/json):

  - `detail` (array)

  - `detail.loc` (array)
    The location of the error in the request.

  - `detail.msg` (string)
    The error message.

  - `detail.type` (string)
    The type of error.

  - `detail.input` (any)
    The input that caused the error.

  - `detail.ctx` (object)
    The context in which the error occurred.

