Skip to main content
Sitecore Documentation
  • Learn
  • Downloads
  • Changelog
  • Roadmap
PersonalizeCloud Portal
Sitecore Personalize developer documentation
  • Developing with Sitecore Personalize
    • Base URL
    • Response codes
        • Create a flow definition
        • Retrieve flow definitions
        • Retrieve a flow definition
        • Update a flow definition
  1. REST API Flow definition
  1. Sitecore Personalize developer documentation
  2. REST APIs

Create a flow definition

POST /v3/flowDefinitions

Creates a flow definition in Sitecore Personalize.

You can use this endpoint to create web, interactive API, or triggered experiments and experiences.

A flow definition specifies the experiment or experience configuration, including its type, subtype, variants, traffic allocation, schedule, and business process.

For experiments, you can configure multiple variants and specify how traffic is distributed between them. Use audience conditions in filters to determine which guests are eligible for the flow.

Request body

Provide the following attributes in the request body:

AttributeTypeRequiredDescriptionExample
namestringYesThe name of the flow definition."Alert bar"
friendlyIdstringYesThe unique ID of the flow definition. Use lowercase alphanumeric characters and underscores."alert_bar_1"
typestring enumYesThe flow type: INTERACTIVE_WEB_FLOW, INTERACTIVE_API_FLOW, or TRIGGERED_V3."INTERACTIVE_API_FLOW"
subtypestring enumYesWhether the flow is an EXPERIMENT or an EXPERIENCE."EXPERIMENT"
statusstring enumYesSet to DRAFT when creating a flow."DRAFT"
channelsarray of stringsYesThe touchpoints where guests interact with your brand.["WEB"]
businessProcessstringYesSet to interactive_v1 for interactive flows or triggered_v1 for triggered flows."interactive_v1"
filtersobjectNoSets the conditions that must pass before the experiment or experience can run.Filters and example
variantsarray of objectsYesVersions of the experiment or experience. Set this value to an empty array ([]) when the flow has no variants yet. Otherwise, include one object for each variant.Variants and example
trafficobjectYesDefines traffic allocation and distribution between variants.Traffic and examples
scheduleobjectYesDefines when the experiment or experience can run.Schedule and example
sampleSizeConfigobjectYesDefines the sample size parameters. The create request fails when this object is null.Sample size configuration and example

For a complete payload, see Example: Create an experiment with audience filters.

The traffic object

The traffic object defines traffic allocation and distribution between variants.

AttributeTypeDescriptionExample
typestring enumThe traffic allocation type. Set this to simpleTraffic or advancedTraffic."simpleTraffic"
weightingAlgorithmstring enumThe algorithm used to determine variant weights."USER_DEFINED"
coupledbooleanWhether the experiment is coupled to other experiments.false
allocationintegerThe percentage of guests exposed to the experiment. Minimum 0, maximum 100. For an experience, set this to 100.100
splitsarray of objectsDefines traffic distribution between variants. For simpleTraffic, each object specifies a variant reference and percentage. For advancedTraffic, each object specifies a variant reference and bucket range.See below

Example: Simple traffic allocation

This example uses simpleTraffic to expose 60 percent of guests to one variant and 40 percent to another:

{
  "traffic": {
    "type": "simpleTraffic",
    "weightingAlgorithm": "USER_DEFINED",
    "splits": [
      {
        "ref": "71206a12-b1b0-4baa-93ea-a0752a2762b0",
        "split": 60
      },
      {
        "ref": "ffe19d2a-b531-468d-a155-fedf757208e5",
        "split": 40
      }
    ]
  }
}

Example: Advanced traffic allocation

This example uses advancedTraffic for an experiment. Guests in buckets 1 to 11 will not be exposed to the experiment. Guests in buckets 12 to 55 will be exposed to one variant, while guests in buckets 56 to 120 will be exposed to another variant.

{
  "traffic": {
    "type": "advancedTraffic",
    "weightingAlgorithm": "USER_DEFINED",
    "modifiedAt": "2026-07-21T16:09:54.583Z",
    "allocationLow": 12,
    "allocationHigh": 120,
    "splits": [
      {
        "ref": "3e0c4419-5679-47e8-9d95-7f34b074af4b",
        "lowSplit": 12,
        "highSplit": 55
      },
      {
        "ref": "61705a82-a5d2-4a0f-920f-2c0990897b39",
        "lowSplit": 56,
        "highSplit": 120
      }
    ]
  }
}

The filters object

The optional filters object sets the conditions that must pass before an experiment or experience can run. It can contain condition groups and a saved audience in targetGroup.

AttributeTypeDescriptionExample(s)
conditionGroups optionalarray of objectsGroups of filter conditions evaluated together before the experiment or experience can run.See the following example.
targetGroup optionalobjectThe saved audience that the guest must belong to.See the following example.

Personalize sets renderedExpression when it publishes the experience. Leave this attribute out of the create request.

Each object in conditionGroups:

AttributeTypeDescriptionExample(s)
conditionsarray of objectsThe conditions in this group.See the following example.
unionType optionalstring enumHow this group combines with the other groups."AND" or "OR"

Each object in conditions:

AttributeTypeDescriptionExample(s)
templateFriendlyIdstringThe friendly ID of the audience template that defines the condition."country"
templateRevisionintegerThe revision of the audience template that defines the condition.5
paramsobjectParameter values passed to the audience template. Each value is a string.{ "is": "is", "country(s)": "DK" }
source optionalstringThe data source to evaluate."CDP"
field optionalstringThe field in the data source to evaluate."email"
operator optionalstringThe comparison to apply to the field."NOT_NULL"
value optionalstring, number, boolean, array, or nullThe value to compare with the field."gold"
mapKey optionalstringThe key to read when the field is a map."utm_source"
unit optionalstringThe time unit for a time-based operator."DAYS"
scope optionalstringThe count scope for a nested array."total" or "session"
unionType optionalstring enumHow this condition combines with the other conditions in the group."AND" or "OR"

The targetGroup object:

AttributeTypeDescriptionExample(s)
refstring (UUID)The reference of the saved audience."b7e3f1d0-9a2c-4f8e-b5d1-3c6e7a0d2f4b"
generatedCode optionalstringJavaScript that evaluates the audience. Personalize generates this value. Leave it out of the create request."function () { return true; }"

Example: Country and operating system filters

To target guests in Denmark who use Windows, add two condition groups to filters.conditionGroups. Set unionType to "AND" on the second group so that both conditions must match:

  • For the country template, set is to "is" and country(s) to "DK".
  • For the operating_system template, set is to "is" and operating system(s) to "Windows".

Windows is an operating system, not a device type.

Each condition requires both templateFriendlyId and templateRevision. This example uses country template revision 5 and operating system template revision 9. Use the template revisions available in your environment.

Include the following fragment in the create request alongside the other required flow definition attributes:

{
  "filters": {
    "conditionGroups": [
      {
        "conditions": [
          {
            "templateFriendlyId": "country",
            "templateRevision": 5,
            "params": {
              "is": "is",
              "country(s)": "DK"
            }
          }
        ]
      },
      {
        "unionType": "AND",
        "conditions": [
          {
            "templateFriendlyId": "operating_system",
            "templateRevision": 9,
            "params": {
              "is": "is",
              "operating system(s)": "Windows"
            }
          }
        ]
      }
    ]
  }
}

These filters apply to the entire experiment or experience, not to an individual variant. For an experiment, use traffic.splits to configure the traffic distribution between variants separately. For example, a 50/50 split distributes eligible traffic between the control and the other variant.

When you retrieve the flow definition, each condition can include templateFriendlyId, templateRevision, and expression. In the Denmark and Windows example, the country expression checks request.params.geo.country, falling back to geolocation data in open web sessions when the request country is unavailable. The operating system expression checks the request's User-Agent header. The transpiledVariants array contains the combined condition expression in a conditionsTask for each variant.

For template-based filters such as these, provide templateFriendlyId, templateRevision, and params in the create request. You do not need to copy the condition's expression or the transpiledVariants array from a retrieved flow. Personalize resolves the template expressions and generates the transpiled variants.

The variants array

The variants array contains one object for each version of the experiment or experience. When the array contains variants, include at least one control variant and set its isControl property to true. Each variant requires a name and tasks.

AttributeTypeDescriptionExample(s)
namestringThe name of the variant."Control"
tasksarray of objectsThe actions to run when this variant is served.See below
ref optionalstring (UUID)The reference of the variant. Use the same value in the matching traffic split's ref."71206a12-b1b0-4baa-93ea-a0752a2762b0"
isControl optionalbooleanWhether this is the control variant. Set this to true for one variant in the array.true
previewUrl optionalstringThe URL used to preview the variant."https://www.example.com/preview"
assets optionalobjectThe CSS, HTML, and JavaScript for the variant.See below
templateVariables optionalobjectString values that override template variables for this variant.{ "headline": "Welcome" }
description optionalstringA description of the variant."Control variant"
templateRef optionalstring (UUID)The reference of the template used to render the variant."a1b2c3d4-e5f6-7890-abcd-ef1234567890"
render optionalbooleanWhether to render the variant on the server when it is served.true

Each attribute in the assets object is optional:

AttributeTypeDescriptionExample(s)
css optionalstringThe CSS for the variant.".alert { color: #000; }"
html optionalstringThe HTML for the variant."<div class=\"alert\">Hello</div>"
js optionalstringThe JavaScript for the variant."insertHTMLAfter('body');"

Each object in tasks:

AttributeTypeDescriptionExample(s)
implementationstringThe task to run."templateRenderTask" or "conditionsTask"
inputobjectThe task parameters. Set inputType to the matching input type.See below

For inputType: "templateRenderTaskInput", use the following attributes:

AttributeTypeDescriptionExample(s)
inputTypestringThe input type for the task. Set this to "templateRenderTaskInput"."templateRenderTaskInput"
typestringThe content type of the template."application/json"
templatestringThe template to render."{ \"message\": \"Hello\" }"

For inputType: "conditionsTaskInput", use the following attribute:

AttributeTypeDescriptionExample(s)
rulesarray of objectsThe rules that determine whether the variant runs.See below

Each object in rules:

AttributeTypeDescriptionExample(s)
idstringThe identifier of the rule."scriptCondition"
ruleDataobjectThe data used to evaluate the rule.See below
friendlyId optionalstringThe friendly ID of the rule. Use lowercase letters, digits, and underscores."guest_has_email"
name optionalstringThe display name of the rule."Guest has email"
description optionalstringA description of the rule."Matches guests who have an email address."

The ruleData object:

AttributeTypeDescriptionExample(s)
expressionstringThe expression or value to evaluate."guest.email"
field optionalstringThe guest profile field to evaluate."orders.totalValue"
operator optionalstringThe comparison between the field and the expression."GREATER_THAN"

For inputType: "webhookTaskInput", set connectionRef to the UUID of the connection. Personalize resolves the connection object when it publishes the experience, so leave connection out of the create request.

Example: A control variant

This fragment defines the control variant used in the full experiment example. Use the same ref in the corresponding traffic.splits object.

{
  "variants": [
    {
      "ref": "e8c92a61-740f-4d35-a19b-3f062b85c947",
      "name": "Control",
      "isControl": true,
      "tasks": [
        {
          "implementation": "templateRenderTask",
          "input": {
            "inputType": "templateRenderTaskInput",
            "type": "application/json",
            "template": "{ \"message\": \"Hello\" }"
          }
        }
      ]
    }
  ]
}

The schedule object

The schedule object defines when the experiment or experience can run.

AttributeTypeDescriptionExample(s)
typestring enumThe type of the flow schedule.

Set this value to "simpleSchedule".
"simpleSchedule"
startDatestring (ISO 8601)The earliest possible time the flow can run.2026-07-04T11:46:41.810Z
endDate

optional
string (ISO 8601)The last possible time the flow can run.2026-07-22T12:00:00.810Z

Example: A start date

This fragment sets the earliest time the experiment can run:

{
  "schedule": {
    "type": "simpleSchedule",
    "startDate": "2026-10-29T00:00:00.000Z"
  }
}

The sampleSizeConfig object

The sampleSizeConfig object defines the sample size parameters for the experiment.

AttributeTypeDescriptionExample(s)
baseValuenumberThe anticipated conversion goal value of the primary goal.

The default is 0.02.
0.02
minimumDetectableDifferencenumberThe minimum conversion goal difference to detect relative to the base value.

The default is 0.2.
0.2
confidenceLevelnumberThe required confidence level before the test is considered complete.

This value represents the confidence your organization has that if the null hypothesis is true, the measured difference is not due to random fluctuations.

The default is 0.95.
0.95

Example: Sample size configuration

This fragment uses the default sample size parameters:

{
  "sampleSizeConfig": {
    "baseValue": 0.02,
    "minimumDetectableDifference": 0.2,
    "confidenceLevel": 0.95
  }
}

Example: Create an experiment with audience filters

The following request creates a draft web experiment for guests in Denmark who use Windows. Eligible traffic is split equally between the control and Variant B.

In the response, the ref key contains the flow definition reference. Use it to retrieve or update the flow definition.

curl -X POST '<baseURL>/v3/flowDefinitions' \
-H 'Authorization: Bearer <accessToken>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '
{
  "name": "Denmark Windows variant test 2",
  "friendlyId": "denmark_windows_variant_test_2",
  "type": "INTERACTIVE_WEB_FLOW",
  "subtype": "EXPERIMENT",
  "status": "DRAFT",
  "channels": [
    "WEB"
  ],
  "businessProcess": "interactive_v1",
  "filters": {
    "conditionGroups": [
      {
        "conditions": [
          {
            "templateFriendlyId": "country",
            "templateRevision": 5,
            "params": {
              "is": "is",
              "country(s)": "DK"
            }
          }
        ]
      },
      {
        "unionType": "AND",
        "conditions": [
          {
            "templateFriendlyId": "operating_system",
            "templateRevision": 9,
            "params": {
              "is": "is",
              "operating system(s)": "Windows"
            }
          }
        ]
      }
    ]
  },
  "variants": [
    {
      "ref": "e8c92a61-740f-4d35-a19b-3f062b85c947",
      "name": "Control",
      "isControl": true,
      "tasks": [
        {
          "implementation": "templateRenderTask",
          "input": {
            "inputType": "templateRenderTaskInput",
            "type": "application/json",
            "template": "{ \"message\": \"Hello\" }"
          }
        }
      ]
    },
    {
      "ref": "72b1d0f9-c583-46ae-8d24-f917ac603be5",
      "name": "Variant B",
      "isControl": false,
      "tasks": [
        {
          "implementation": "templateRenderTask",
          "input": {
            "inputType": "templateRenderTaskInput",
            "type": "application/json",
            "template": "{ \"message\": \"Hej\" }"
          }
        }
      ]
    }
  ],
  "traffic": {
    "type": "simpleTraffic",
    "weightingAlgorithm": "USER_DEFINED",
    "coupled": false,
    "allocation": 100,
    "splits": [
      {
        "ref": "e8c92a61-740f-4d35-a19b-3f062b85c947",
        "split": 50
      },
      {
        "ref": "72b1d0f9-c583-46ae-8d24-f917ac603be5",
        "split": 50
      }
    ]
  },
  "schedule": {
    "type": "simpleSchedule",
    "startDate": "2026-10-29T00:00:00.000Z"
  },
  "sampleSizeConfig": {
    "baseValue": 0.02,
    "minimumDetectableDifference": 0.2,
    "confidenceLevel": 0.95
  }
}'
If you have suggestions for improving this article, let us know!

© Copyright , Sitecore A/S or a Sitecore affiliated company.
All rights reserved.

Privacy policySitecore Trust CenterTerms of use
PersonalizeCloud Portal