On this page

Experiment Management API Experiment Endpoints

EU data residency

The examples on this page use the default base URL https://experiment.amplitude.com. If your project uses Amplitude's EU data center, use https://experiment.eu.amplitude.com instead. For more information, refer to Regions.

List

bash
GET https://experiment.amplitude.com/api/1/experiments

Fetch a list of experiments and their configuration details. Results are ordered with the most recently created items first.

Query parameters

Response

A successful request returns a 200 OK response and a list of experiments encoded as JSON in the response body. createdAt and lastModifiedAt are in UTC in ISO 8601 format.

bash
curl --request GET \
--url 'https://experiment.amplitude.com/api/1/experiments?limit=1000' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'

Get details

bash
GET https://experiment.amplitude.com/api/1/experiments/<id>

Fetch the configuration details of an experiment.

Path variables

Response

A successful request returns a 200 OK response and a JSON object with the experiment's details.

bash
curl --request GET \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

List versions

bash
GET https://experiment.amplitude.com/api/1/experiments/{id}/versions

Fetch a list of all versions for an experiment.

Path variables

Response

A successful request returns a 200 OK response and a list of the experiment's versions encoded as an array of JSON objects in the response body. Versions are sorted in descending order.

bash
curl --request GET \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/versions' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

Get version details

bash
GET https://experiment.amplitude.com/api/1/experiments/{id}/versions/{versionId}

Fetch details of a specific version of an experiment.

Path variables

Response

A successful request returns a 200 OK response and a JSON object with details of the version.

curl
curl --request GET \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/versions/<versionId>' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

List variants

bash
GET https://experiment.amplitude.com/api/1/experiments/{id}/variants

Fetch a list of all variants for an experiment.

Path variables

Response

A successful request returns a 200 OK response and a list of variants encoded as an array of JSON objects in the response body.

bash
curl --request GET \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

Get variant details

bash
GET https://experiment.amplitude.com/api/1/experiments/{id}/variants/{variantKey}

Fetch details of a specific variant of an experiment.

Path variables

Response

A successful request returns a 200 OK response and a JSON object with details of the experiment variant.

bash
curl --request GET \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

Get variant inclusions

bash
GET https://experiment.amplitude.com/api/1/experiments/{id}/variants/{variantKey}/users

Fetch a list of inclusions for a specific variant of an experiment.

Path variables

Response

A successful request returns a 200 OK response and a list of inclusions for the experiment's variant as an array of JSON objects.

bash
curl --request GET \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>/users' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

Get variant cohort inclusions

bash
GET https://experiment.amplitude.com/api/1/experiments/{id}/variants/{variantKey}/cohorts

Fetch a list of cohort inclusions for a specific variant of an experiment.

Path variables

Response

A successful request returns a 200 OK response and a list of cohort inclusions for the experiment's variant as an array of cohort IDs.

bash
curl --request GET \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>/cohorts' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

Create variant

bash
POST https://experiment.amplitude.com/api/1/experiments/{id}/variants

Create a new variant for an experiment.

Path variables

Request body

Request

json
{
  "key": "new-variant-key",
  "description": "optional description for variant",
  "name": "optional name for variant",
  "payload": { "variant-payload": "example payload" },
  "rolloutWeight": 0
}

Response

A successful request returns a 200 OK response and OK text.

Example request

bash
curl --request POST \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>' \
    --data '{"key":"<key>","name":"<name>","description":"<description>","payload":"<payload>","rolloutWeight":<rolloutWeight>}'

Edit variant

bash
PATCH https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>

Edit a variant for an experiment.

Path variables

Request body

Example request

json
{
  "key": "updated-variant-key",
  "description": "updated-optional description for variant",
  "name": "optional name for variant",
  "payload": { "variant-payload": "example payload" },
  "rolloutWeight": 10
}

Response

A successful request returns a 200 OK response and OK text.

Request

curl
curl --request PATCH \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>' \
    --data '{"key":"<key>","name":"<name>","description":"<description>","payload":"<payload>","rolloutWeight":<rolloutWeight>}'

Remove variant

bash
DELETE https://experiment.amplitude.com/api/1/experiments/{id}/variants/{variantKey}

Remove a variant from an experiment.

Path variables

Response

A successful request returns a 200 OK response and OK text.

Request

curl
curl --request DELETE \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

Add users to variant

bash
POST https://experiment.amplitude.com/api/1/experiments/{id}/variants/{variantKey}/users

Add inclusions (users or devices) to the experiment's variant.

Path variables

Example request

bash
{
    "inclusions": [<user1>@<your-company-email>, <user2>@<your-company-email>, <userId>]
}

Request body

Response

A successful request returns a 200 OK response and OK text.

Request

curl
curl --request POST \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>/users' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>' \
    --data '{"inclusions":<["id1", "id2", "id3"]>}'

Add cohorts to variant

bash
POST https://experiment.amplitude.com/api/1/experiments/{id}/variants/{variantKey}/cohorts

Add cohort inclusions to the experiment's variant.

Path variables

Request body

Example request

json
{
  "inclusions": ["cohort-id-1", "cohort-id-2"]
}

Response

A successful request returns a 200 OK response and OK text.

Request

bash
curl --request POST \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>/cohorts' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>' \
    --data '{"inclusions":["cohort-id-1", "cohort-id-2"]}'

Remove users from variant

bash
DELETE https://experiment.amplitude.com/api/1/experiments/{id}/variants/{variantKey}/users/{userIndex}

Remove inclusions (users or devices) from the experiment's variant.

Path variables

Response

A successful request returns a 200 OK response and OK text.

Request

curl
curl --request DELETE \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>/users/<userIndex>' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

Remove all users from variant

bash
DELETE https://experiment.amplitude.com/api/1/experiments/{id}/variants/{variantKey}/users

Remove all inclusions (users or devices) from the experiment's variant.

Path variables

Response

A successful request returns a 200 OK response and OK text.

Request

curl
curl --request DELETE \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>/users' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

Bulk remove users from variant

bash
DELETE https://experiment.amplitude.com/api/1/experiments/{id}/variants/{variantKey}/bulk-delete-users

Bulk remove users or devices from the experiment's variant. Limited to 100 per request.

Path variables

Request body

Response

A successful request returns a 200 OK response and OK text.

Request

curl
curl --request DELETE \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>/bulk-delete-users' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>' \
    --data '{"users":<["id1", "id2", "id3"]>}'

Bulk remove cohorts from variant

bash
DELETE https://experiment.amplitude.com/api/1/experiments/{id}/variants/{variantKey}/bulk-delete-cohorts

Bulk remove cohorts from the experiment's variant. Limited to 100 per request.

Path variables

Request body

Response

A successful request returns a 200 OK response and OK text.

Request

bash
curl --request DELETE \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/variants/<variantKey>/bulk-delete-cohorts' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>' \
    --data '{"users":["cohort-id-1", "cohort-id-2"]}'

List deployments

bash
GET https://experiment.amplitude.com/api/1/experiments/{id}/deployments

List all deployments for an experiment.

Path variables

Response

A successful request returns a 200 OK response and an array of JSON objects with the experiment's deployment details.

curl
curl --request GET \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/deployments' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

Add deployment

bash
POST https://experiment.amplitude.com/api/1/experiments/{id}/deployments

Add a deployment to an experiment.

Path variables

Request body

Example request

json
{
  "deployments": ["<deploymentId>"]
}

Response

A successful request returns a 200 OK response and OK text.

Request

curl
curl --request POST \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/deployments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'
    --data '{"deployments":[<deploymentId>]}'

Remove deployment

bash
DELETE https://experiment.amplitude.com/api/1/experiments/{id}/deployments/{deploymentId}

Remove a deployment from an experiment.

Path variables

Response

A successful request returns a 200 OK response and OK text.

Request

bash
curl --request DELETE \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>/deployments/<deploymentId>' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>'

Edit

Neither Web Experimentation nor Guides and Surveys support editing experiments. Attempts to edit a Web Experimentation or a Guides and Surveys experiment return a 405 error.

bash
PATCH https://experiment.amplitude.com/api/1/experiments/{id}

Edit an experiment.

Path variables

Request body

exposureEvent

filters

subprop_op

  • is
  • is not
  • contains
  • does not contain
  • less
  • less or equal
  • greater
  • greater or equal
  • glob match
  • glob does not match

Example request

json
{
  "name": "updated name",
  "description": "updated description",
  "bucketingKey": "amplitude_id",
  "bucketingSalt": "<bucketingSalt>",
  "evaluationMode": "remote",
  "rolloutPercentage": 0,
  "enabled": true,
  "experimentType": "a-b-test",
  "stickyBucketing": false,
  "startDate": "2023-07-31T10:26:00.996Z",
  "endDate": "2023-09-23T10:26:00.996Z",
  "tags": ["prod", "staging"],
  "exposureEvent": {
    "event_type": "_active",
    "filters": [
      {
        "group_type": "User",
        "subprop_key": "amplitude_day_of_week",
        "subprop_op": "is",
        "subprop_type": "day_time_prop",
        "subprop_value": ["Tuesday"]
      }
    ]
  }
}

Response

A successful request returns a 200 OK response.

Request

curl
curl --request PATCH \
    --url 'https://experiment.amplitude.com/api/1/experiments/<id>' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>' \
    --data '{"enabled":<enabled>,"rolloutPercentage":<rolloutPercentage>}'

Create

bash
POST https://experiment.amplitude.com/api/1/experiments

Create a new feature experiment.

Request body

variants

The variants field contains these objects.

targetSegments

The targetSegments field contains these objects.

conditions

The conditions field contains these objects.

op

A string value representing operations on a property value. Possible values are:

  • is
  • is not
  • contains
  • does not contain
  • less
  • less or equal
  • greater
  • greater or equal
  • set is
  • set is not
  • set contains
  • set does not contain
  • glob match
  • glob does not match

Example request

json
{
  "projectId": "<projectId>",
  "name": "Analyze button clicks experiment",
  "key": "analyze-button-clicks-experiment",
  "description": "analyze button clicks on the main page",
  "variants": [
    {
      "key": "control"
    },
    {
      "key": "treatment"
    }
  ],
  "rolloutWeights": { "control": 1, "treatment": 1 },
  "targetSegments": [
    {
      "name": "Segment 1",
      "conditions": [
        {
          "prop": "country",
          "op": "is",
          "type": "property",
          "values": ["United States"]
        }
      ],
      "percentage": 0,
      "bucketingKey": "amplitude_id",
      "rolloutWeights": {
        "control": 1,
        "treatment": 1
      }
    }
  ],
  "deployments": ["<deploymentId>"],
  "evaluationMode": "remote",
  "experimentType": "a-b-test"
}

Response

A successful request returns a 200 OK response and a JSON object with the experiment's id and url.

bash
curl --request POST \
    --url 'https://experiment.amplitude.com/api/1/experiments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <management-api-key>' \
    --data '{"projectId":"<projectId>","key":"<key>"}'

Was this helpful?