---
title: "Create new variation"
method: POST
path: "/variations"
tags: ["Variation"]
---

# Create new variation

`POST /variations`

Create new variation with given parameters

## Request body

- Variation — JSON representation of the variation
  - `color` integer — Variation color displayed in the editor
  - `creationMode` 'AI' | 'CODE_BASE' | 'GRAPHICAL' | 'UNDEFINED' | 'WIDGET' — Creation mode of the variation: CODE_BASE, GRAPHICAL, AI or UNDEFINED
  - `cssCode` string — Code editor css code for variation
  - `customJson` string — Custom JSON for this variation
  - `experimentId` integer — Id of the experiment this variation belongs to
  - `expositionFrequencyDelaySecondsBetweenTwoExpositions` integer — Delay in seconds between two exposures
  - `expositionFrequencySameVisit` integer — Frequency of exposure during the same visit
  - `expositionFrequencySameVisitor` integer — Frequency of the exposure for the same visitor
  - `expositionFrequencySameVisitorDelaySeconds` integer — Delay in seconds between exposure for the same visitor
  - `forceNoFlicker` boolean
  - `id` integer — Unique Id of the variation
  - `isJsCodeAfterDomReady` boolean — Set to `true` (which is also the default value) if the code is applied once the DOM is ready.
  - `jsCode` string — Code editor javascript code for variation
  - `name` string, required — Name of the variation
  - `personalizationId` integer — Id of the personalization this variation belongs to
  - `prompt` Prompt — Object used to define an autorun message in the variation. Triggers the creation of a message of type autorun if valid
    - `attachments` PromptAttachment[] — Attachment metadata. Files are sent via multipart part `attachments` and matched by index.
      - `mediaType` 'IMAGE' | 'IMAGE', required — Attachment media type.
      - `name` string, required — Human-readable attachment name.
      - `type` 'TEMPORARY' | 'REGULAR' | 'TEMPORARY' | 'REGULAR', required — Attachment lifecycle type. Mirrors media-storage image type.
    - `promptSource` string — Internal tracking value for analytics or partner attribution
    - `textInput` string, required — The actual prompt content to be sent and executed by Electra
  - `redirection` VariationRedirection — Redirection parameters of a variation
    - `includeQueryParameters` boolean — In case of global redirection, option to include query parameters from the original url
    - `parameters` string — Parameters used for the redirection, in case of parameter redirection
    - `type` 'GLOBAL_REDIRECTION' | 'PARAMETER_REDIRECTION' — Type of the redirection
    - `url` string — URL used for the redirection, in case of global redirection
  - `redirectionStrings` string — Redirect URL used for redirecting variation. Deprecated property: use property 'redirection' instead
  - `shadowDom` boolean — ShadowDOM option
  - `siteId` integer, required — Site Id of the project the variation belongs to
  - `widgetTemplateInput` string — Widget template input data in JSON format.

## 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/revisions/09f2abcea0b5/schema)
