---
title: "Create a new experiment"
method: POST
path: "/experiments"
tags: ["Experiment"]
---

# Create a new experiment

`POST /experiments`

Create a new experiment with the given parameters.

## Request body

- Experiment
  - `autoOptimized` boolean — Deprecated. Use trafficAllocationMethod field instead
  - `baseURL` string, required — URL of the website to load in editor and preview mode
  - `collectingDataEnabled` boolean — Indicates if data collection is enabled
  - `commonCssCode` string — CSS code specific to all variations
  - `commonJavaScriptCode` string — JavaScript code specific to all variations
  - `createdBy` integer — Account Id of the creator of the experiment
  - `dateCollectingDataStopped` string, date-time — Date the data collection stops
  - `dateCreated` string, date-time
  - `dateEnded` string, date-time — Date the experiment ceased
  - `dateModified` string, date-time — Date the experiment was modified
  - `dateStarted` string, date-time — Date the experiment was launched
  - `dateStatusModified` string, date-time — Date the experiment was last modified
  - `description` string
  - `deviations` object — Traffic allocation per variation. Key can be 'origin'(for original page) or variation id.`Value` is the percentage of traffic which will be directed to this variation.It has to be double numbers ranging from 0(0%) to 1(100%).
  - `executeCodeForReference` boolean
  - `globalScript` string — JavaScript code that will be applied only to the selected experiment and executed in the end of the Global custom script
  - `goals` integer[] — List of Ids of the goals being used by this experiment.For GET requests, this is an optional field that needs to be specified in request params
  - `id` integer — Unique Id of the experiment
  - `isArchived` boolean — Indicates if experiment is archived
  - `isLegacyEditor` boolean
  - `isMultipleTestingCorrection` boolean — Indicates whether multiple testing correction is enabled
  - `mainGoalId` integer
  - `mvtAllocationSettings` MVTAllocation — Traffic allocation settings for a multivariate test (MVT) experiment. On `POST /experiments`, Kameleoon accepts this object but always applies equal allocation across variations, regardless of the values you submit. To set custom allocation, submit this object again in a `PATCH /experiments/{experimentId}` request, using the generated IDs returned by a GET request. Populate only one of `sectionsAllocations` or `combinationsAllocations`, not both.
    - `combinationsAllocations` AllocationItem[] — Traffic allocation by full combination. Each entry's `variationId` is a generated combination Id that Kameleoon returns in the top-level `variations` array and as keys in the `deviations` map. Combination Ids don't exist until Kameleoon generates them, so you can't populate this array in a creation request.
      - `allocationPart` number, float — Share of traffic to allocate to this variation or combination, from 0 (0%) to 1 (100%).
      - `checked` boolean — Whether the experiment includes this variation or combination.
      - `locked` boolean — Whether to lock this entry's `allocationPart`. A locked entry keeps its value when Kameleoon rebalances the other entries in the same section or combination set.
      - `sectionId` integer — Id of the section this entry belongs to. In `sectionsAllocations`, `sectionId` is the generated section Id from `mvtVariations`. Not used in `combinationsAllocations`.
      - `variationId` string — Id of the variation (in `sectionsAllocations`) or combination (in `combinationsAllocations`) this entry allocates traffic to. The generated reference variation in each section uses `"0"`.
    - `exposedPart` number, float — Share of visitors to expose to the experiment, from 0 (0%) to 1 (100%). The remaining visitors don't see any variation.
    - `sectionsAllocations` AllocationItem[] — Traffic allocation by variation within each section. Each entry's `sectionId` and `variationId` reference a section and variation from `mvtVariations`. Kameleoon derives each generated combination's share from these section-level values.
      - `allocationPart` number, float — Share of traffic to allocate to this variation or combination, from 0 (0%) to 1 (100%).
      - `checked` boolean — Whether the experiment includes this variation or combination.
      - `locked` boolean — Whether to lock this entry's `allocationPart`. A locked entry keeps its value when Kameleoon rebalances the other entries in the same section or combination set.
      - `sectionId` integer — Id of the section this entry belongs to. In `sectionsAllocations`, `sectionId` is the generated section Id from `mvtVariations`. Not used in `combinationsAllocations`.
      - `variationId` string — Id of the variation (in `sectionsAllocations`) or combination (in `combinationsAllocations`) this entry allocates traffic to. The generated reference variation in each section uses `"0"`.
  - `mvtVariations` VariationCombination[] — Sections and variations for a multivariate test (MVT) experiment. On creation, the `sectionId` and variation `id` values you submit link entries in this array to entries in `mvtAllocationSettings`; Kameleoon replaces them with its own generated IDs in the response. Kameleoon doesn't return this field on subsequent GET requests.
    - `sectionId` integer — On a creation request, a temporary Id you use only to link this section to its allocation entries in the same request. Kameleoon replaces it with a generated Id in the response.
    - `sectionName` string — Name of the section.
    - `variations` MVTVariation[] — Variations to test for this section, not including the reference variation that Kameleoon adds automatically.
      - `id` integer — On a creation request, a temporary Id you use only to link this variation to its allocation entry in the same request. Kameleoon replaces it with a generated Id in the response.
      - `name` string — Name of the variation.
  - `name` string, required — Name of the experiment
  - `respoolTime` object — The respoolTime map contains key-value pairs, where each key is a variation ID and the corresponding value is a timestamp representing the most recent change to the variation’s allocation (for example, using the Kameleoon app or the Automation API).
  - `siteCode` string, required — Site code of the experiment
  - `siteId` integer, required — Site Id of the project the experiment belongs to
  - `status` string — Status of the experiment
  - `tags` string[] — List of tags being used by this experiment.For GET requests, this is an optional field that needs to be specified in request params.
  - `targetingConfiguration` 'ALL_VISITORS' | 'AUTOPROMO_AUTODEFINED' | 'GRAPHICAL_PAGES' | 'HEAT_SLICE' | 'PAGE' | 'SAVED_TEMPLATE' | 'SITE' | 'URL' — Deprecated. Use the https://api.kameleoon.com/targeting-rules endpoint to update the targeting of your experiment
  - `targetingRule` TargetingRule — Targeting Rule defines the conditions for displaying content to specific user groups based on segments and triggers
    - `id` integer — Unique Id of the targeting rule
    - `segmentConfiguration` 'ALL_VISITORS' | 'AUTOPROMO_AUTODEFINED' | 'GRAPHICAL_PAGES' | 'HEAT_SLICE' | 'PAGE' | 'SAVED_TEMPLATE' | 'SITE' | 'URL' — Configuration defining how the segment should be applied
    - `segmentId` integer — Id of the associated segment (user group) for targeting. If segment is deprecated, no trigger will be available for this rule.
    - `siteId` integer, required — Id of the project this targeting rule belongs to
    - `targetingConfigurationParam` string — Additional parameters for trigger configuration. For SAVED_TEMPLATE/HEAT_SLICE - contains segment Id. For PAGE - contains full URL. For URL - contains URL fragment.
    - `triggerConfiguration` 'ALL_VISITORS' | 'AUTOPROMO_AUTODEFINED' | 'GRAPHICAL_PAGES' | 'HEAT_SLICE' | 'PAGE' | 'SAVED_TEMPLATE' | 'SITE' | 'URL' — Configuration defining how the trigger should be applied. ALL_VISITORS configuration is not allowed for this trigger type
    - `triggerId` integer — Id of the associated trigger (activation condition)
  - `targetingRuleId` integer — Deprecated. Use TargetingRule instead.
  - `targetingSegmentId` integer — Deprecated. Use the https://api.kameleoon.com/targeting-rules endpoint to update the targeting of your experiment
  - `trackingTools` TrackingTool[]
    - `adobeOmnitureObject` string
    - `comScoreCustomerId` string
    - `comScoreDomain` string
    - `contentSquareUrl` string
    - `customIntegrations` string[]
    - `customVariable` integer
    - `eulerianUserCentricParameter` string
    - `name` 'GOOGLE_ANALYTICS4' | 'GOOGLE_ANALYTICS4_AUDIENCES' | 'GOOGLE_UNIVERSAL_ANALYTICS' | 'ECONDA' | 'SMART_TAG' | 'PIANO' | 'ADOBE_OMNITURE' | 'EULERIAN' | 'WEBTRENDS' | 'KISSMETRICS' | 'PIWIK' | 'CRAZY_EGG' | 'COM_SCORE' | 'TEALIUM' | 'YSANCE' | 'M_PATHY' | 'SMARTFOCUS' | 'EMARSYS' | 'EXPERTSENDER' | 'TAG_COMMANDER' | 'CONTENT_SQUARE' | 'WEBTREKK' | 'CUSTOM_INTEGRATIONS' | 'HEAP' | 'HEAP_COHORTS' | 'KLAVIYO_COHORTS' | 'SEGMENT' | 'MIXPANEL' | 'CLARITY' | 'IABTCF' | 'DATABRICKS' | 'REDSHIFT' | 'SMARTLOOK' | 'MOUSEFLOW' | 'KLAVIYO' | 'FULLSTORY' | 'AMPLITUDE' | 'SNOWPLOW' | 'JUNE' | 'MPARTICLE' | 'BIGQUERY' | 'RUDDERSTACK' | 'SNOWFLAKE' | 'GLASSBOX' | 'HUBSPOT' | 'AIR360' | 'DATADOG' | 'QUANTUM_METRIC' | 'GLASSBOX_V2' | 'BRAZE' | 'KAMELEOON_TRACKING' | 'CUSTOM_TRACKING' | 'VERCEL' | 'AKAMAI'
    - `reportingScript` string
    - `universalAnalyticsDimension` integer
  - `trafficAllocationMethod` 'CONTEXTUAL_BANDIT' | 'MANUAL' | 'MULTI_ARMED_BANDIT' — Method for allocating traffic across variations. Set to `MANUAL` to control the allocation yourself using `deviations` (classic and developer experiments) or `mvtAllocationSettings` (multivariate test experiments).
  - `type` 'AI' | 'CLASSIC' | 'DEVELOPER' | 'FEATURE_FLAG' | 'MVT' | 'PROMPT' | 'SDK_HYBRID'
  - `variations` integer[] — List of variation ids for this experiment

## Response `201`

Created

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `422` — Unprocessable Entity
- `423` — Locked
- `429` — Too Many Requests
- `500` — Internal Server Error

---

[API](https://skmtc.net/kameleoon/apis/openapi-definition-for-automation-api.md) · [All operations](https://skmtc.net/kameleoon/apis/openapi-definition-for-automation-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kameleoon/openapi-definition-for-automation-api/versions/09f2abcea0b5/schema)
