Experiment Variants
Manage variants on a parent experiment. Create, list, update, and delete control and treatment variants and adjust their weights.
Manage variants on a parent experiment. Each variant is either a redirect (sends matched visitors to a new URL) or a dom_modifications set (declarative on-page mutations). Variant content (redirect URL, DOM modifications) can only be edited while the parent experiment is in draft status. However, traffic weights can be adjusted on running or paused experiments — the change is recorded in the experiment's change log so results remain interpretable. Completed experiments cannot be edited.
Authorization
apiKey Ours Privacy API key
In: header
Query Parameters
Maximum number of variants to return. Defaults to 200; values below 1 are clamped to 1 and values above 200 are clamped to 200. Variants per experiment are capped at 200 server-side, so a single request returns the full set.
Opaque pagination cursor from pagination.nextCursor in the previous response. Do not decode or modify it. Malformed cursors return 400 Bad Request.
Required. List variants belonging to this parent experiment.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/rest/v1/experiment-variants?experimentId=08524dc8-5289-48e8-bf40-b3a7cfa6ca0a"{
"entities": [
{
"id": "var_01HZX8YJH3Z3W1R2Q4M5N6P7Q8",
"experimentId": "exp_01HZX8TK6TSN91C5XWZP3N1M4E",
"name": "Headline Variant B",
"isControl": false,
"weight": 50,
"variantType": "string",
"redirectUrl": "https://www.example.com/pricing-v2",
"domModifications": [
{
"selector": "h1.hero-title",
"action": "customCss",
"value": "Start your free trial",
"styles": [
{
"property": "background-color",
"value": "#10B981"
}
],
"attribute": {}
}
]
}
],
"pagination": {
"nextCursor": "string",
"hasMore": true
}
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}Authorization
apiKey Ours Privacy API key
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/rest/v1/experiment-variants" \ -H "Content-Type: application/json" \ -d '{ "experimentId": "string", "name": "Variant B", "weight": 50 }'{
"id": "var_01HZX8YJH3Z3W1R2Q4M5N6P7Q8",
"experimentId": "exp_01HZX8TK6TSN91C5XWZP3N1M4E",
"name": "Headline Variant B",
"isControl": false,
"weight": 50,
"variantType": "string",
"redirectUrl": "https://www.example.com/pricing-v2",
"domModifications": [
{
"selector": "h1.hero-title",
"action": "customCss",
"value": "Start your free trial",
"styles": [
{
"property": "background-color",
"value": "#10B981"
}
],
"attribute": {}
}
]
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}Authorization
apiKey Ours Privacy API key
In: header
Path Parameters
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/rest/v1/experiment-variants/string"{
"id": "var_01HZX8YJH3Z3W1R2Q4M5N6P7Q8",
"experimentId": "exp_01HZX8TK6TSN91C5XWZP3N1M4E",
"name": "Headline Variant B",
"isControl": false,
"weight": 50,
"variantType": "string",
"redirectUrl": "https://www.example.com/pricing-v2",
"domModifications": [
{
"selector": "h1.hero-title",
"action": "customCss",
"value": "Start your free trial",
"styles": [
{
"property": "background-color",
"value": "#10B981"
}
],
"attribute": {}
}
]
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}Authorization
apiKey Ours Privacy API key
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X PATCH "https://example.com/rest/v1/experiment-variants/string" \ -H "Content-Type: application/json" \ -d '{}'{
"id": "var_01HZX8YJH3Z3W1R2Q4M5N6P7Q8",
"experimentId": "exp_01HZX8TK6TSN91C5XWZP3N1M4E",
"name": "Headline Variant B",
"isControl": false,
"weight": 50,
"variantType": "string",
"redirectUrl": "https://www.example.com/pricing-v2",
"domModifications": [
{
"selector": "h1.hero-title",
"action": "customCss",
"value": "Start your free trial",
"styles": [
{
"property": "background-color",
"value": "#10B981"
}
],
"attribute": {}
}
]
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}Authorization
apiKey Ours Privacy API key
In: header
Path Parameters
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X DELETE "https://example.com/rest/v1/experiment-variants/string"{
"id": "var_01HZX8YJH3Z3W1R2Q4M5N6P7Q8",
"experimentId": "exp_01HZX8TK6TSN91C5XWZP3N1M4E",
"name": "Headline Variant B",
"isControl": false,
"weight": 50,
"variantType": "string",
"redirectUrl": "https://www.example.com/pricing-v2",
"domModifications": [
{
"selector": "h1.hero-title",
"action": "customCss",
"value": "Start your free trial",
"styles": [
{
"property": "background-color",
"value": "#10B981"
}
],
"attribute": {}
}
]
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}{
"error": "string",
"details": "string"
}How is this guide?

