Experiment Variants

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). Variants only mutate while the parent experiment is in draft status — once running, the variant set is locked.

GET
/rest/v1/experiment-variants
AuthorizationBearer <token>

Ours Privacy API key

In: header

Query Parameters

experimentId*string

Required. List variants belonging to this parent experiment.

Length1 <= length

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://app.oursprivacy.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": {}
        }
      ]
    }
  ]
}
{
  "error": "string",
  "details": "string"
}
{
  "error": "string",
  "details": "string"
}
{
  "error": "string",
  "details": "string"
}
{
  "error": "string",
  "details": "string"
}
{
  "error": "string",
  "details": "string"
}
POST
/rest/v1/experiment-variants
*object
AuthorizationBearer <token>

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://app.oursprivacy.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"
}
GET
/rest/v1/experiment-variants/{id}
AuthorizationBearer <token>

Ours Privacy API key

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://app.oursprivacy.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"
}
PATCH
/rest/v1/experiment-variants/{id}
*object
AuthorizationBearer <token>

Ours Privacy API key

In: header

Path Parameters

id*string

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://app.oursprivacy.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"
}
DELETE
/rest/v1/experiment-variants/{id}
AuthorizationBearer <token>

Ours Privacy API key

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X DELETE "https://app.oursprivacy.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?