# 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

## Path parameters:

  - `pageId` (string, required)
    The unique identifier of the page for which to create a personalization version.
    Example: "3f2504e0-4f89-11d3-9a0c-0305e82c3301"

## 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.
    Example: "job-1234"

## Request fields (application/json):

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

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

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

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

## Response 201 fields (application/json):

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

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

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

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

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

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

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

  - `archived` (boolean, required)
    Whether the flow definition (A/B/n test or personalization) is archived.

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

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

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

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

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

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

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

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

  - `schedule.startDate` (string, required)
    The start date of the schedule.
    Example: "2023-01-01T00:00:00Z"

  - `revisions` (object, required)
    Links to the revisions of the flow definition (A/B/n test or personalization).

  - `revisions.href` (string, required)
    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` (object, required)
    The sample size configuration for the flow definition (A/B/n test or personalization).

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

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

  - `sampleSizeConfig.confidenceLevel` (number, required)
    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` (boolean, required)
    Whether notifications are enabled for the flow definition (A/B/n test or personalization).

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

  - `traffic` (object, required)
    The traffic distribution configuration for the personalization experience.

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

  - `traffic.weightingAlgorithm` (string, required)
    The algorithm used for weighting traffic distribution.
    Example: "random"

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

  - `traffic.splits.template` (string, required)
    The flow definition (A/B/n test or personalization) template.
    Example: "split-6c54-4b01-90e6-d701748f0851"

  - `traffic.splits.variantName` (string, required)
    The name of the variant.
    Example: "Variant A"

  - `traffic.splits.audienceName` (string, required)
    The name of the audience targeted.
    Example: "Returning Visitors"

  - `traffic.splits.conditionGroups` (array, required)
    A list of condition groups for the variant.

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

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

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

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

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

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

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

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

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

## Response 422 fields (application/json):

  - `detail` (array)

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

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

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


