Management API (Beta)
The Experiment management API can be used to programmatically create and control flags and experiments.
Experiment Management API in Beta
This API is in Beta. If you would like to try out an early version of the API please reach out to us.
Endpoints¶
Name |
Description |
---|---|
List experiments | List of experiments including their configuration details. |
Get experiment details | Get the configuration details of an experiment. |
List experiment versions | List all versions for an experiment. |
Get experiment version details | Get a specific version for an experiment. |
List experiment variants | List all variants for an experiment. |
Get experiment variant details | Get a specific variant for an experiment. |
Get experiment variant inclusions | Get all inclusions (users) for an experiment's variant. |
Create experiment variant | Create a new variant for an experiment. |
Edit experiment variant | Edit a variant for an experiment. |
Remove experiment variant | Remove a variant from an experiment. |
Add users to experiment's variant | Add users to experiment's variant. |
Remove users from experiment's variant | Remove users from experiment's variant. |
Remove all users from experiment's variant | Remove all users from experiment's variant. |
Edit experiment | Edit experiment. |
Create experiment | Create a new experiment. |
Activate experiment | Activate an inactive experiment. |
Deactivate experiment | Deactivate an active experiment. |
Rollout weights | Update the rollout weights for an experiment. |
Name |
Description |
---|---|
List flags | List of flags including their configuration details. |
Get flag details | Get the configuration details of a flag. |
List flag versions | List all versions for a flag. |
Get flag version details | Get a specific version for a flag. |
List flag variants | List all variants for a flag. |
Get flag variant details | Get a specific variant for a flag. |
Get flag variant inclusions | Get all inclusions (users) for a flag's variant. |
Create flag variant | Create a new variant for a flag. |
Edit flag variant | Edit a variant for a flag. |
Remove flag variant | Remove a variant from a flag. |
Add users to flag's variant | Add users to flag's variant. |
Remove users from flag's variant | Remove users from flag's variant. |
Remove all users from flag's variant | Remove all users from flag's variant. |
Edit flag | Edit flag. |
Create flag | Create a new flag. |
Name |
Description |
---|---|
List deployments | List deployments that experiments or flags can be assigned to. |
Regions¶
Region | Endpoint |
---|---|
Standard Server | https://management-api.experiment.amplitude.com |
EU Residency Server | https://management-api.experiment.eu.amplitude.com |
Authorization¶
The management API uses the HTTP Authorization header for authentication.
The header must be: Authorization: Bearer <management-api-key>
.
Management API Keys
Management API keys are different from the deployment keys used to fetch flag variants. They're created and managed via the Management API link in the Experiment sidebar.
Conventions¶
Status codes¶
The API uses meaningful status codes to communicate the result of requests.
Code | Meaning |
---|---|
200 | Success! |
400 | Input is missing or invalid |
401 | Invalid or revoked API key |
403 | API key doesn't have access to the specified environment |
Cursors¶
Endpoints that list resources such as /experiments/list
will only return a limited number of items per request. To fetch the next page of items, the nextCursor
value returned from the first request must be passed as the cursor
parameter of the next request. In this way multiple requests can be chained together to fetch the total set of items.
Experiment endpoints¶
List experiments¶
GET https://management-api.experiment.amplitude.com/experiments/list
Fetch a list of experiments including their configuration details. Results are ordered with the most recently created experiments first.
Query parameters¶
Name | Description |
---|---|
limit |
The max number of experiments to be returned. Capped at 1000. |
cursor |
The offset to start the "page" of results from. |
Response¶
A successful request returns a 200 OK
response and a list of experiments encoded as JSON in the response body.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/experiments/list?limit=1000' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Get experiment details¶
GET https://management-api.experiment.amplitude.com/experiments/{id}
Fetch the configuration details of an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
Response¶
A successful request returns a 200 OK
response and a JSON object with the experiment's details.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
List experiment versions¶
GET https://management-api.experiment.amplitude.com/experiments/{id}/versions
Fetch a list of all versions for an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
Response¶
A successful request returns a 200 OK
response and a list of experiment's versions encoded as JSON in the response body.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/versions' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Get experiment version details¶
GET https://management-api.experiment.amplitude.com/experiments/{id}/versions/{versionId}
Fetch details of a specific version of an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
versionId |
Required. String. The version's ID. |
Response¶
A successful request returns a 200 OK
response and a JSON object with details of experiment's version.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/versions/<versionId>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
List experiment variants¶
GET https://management-api.experiment.amplitude.com/experiments/{id}/variants
Fetch a list of all variants for an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
Response¶
A successful request returns a 200 OK
response and a list of experiment's variants encoded as JSON in the response body.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/variants' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Get experiment variant details¶
GET https://management-api.experiment.amplitude.com/experiments/{id}/variants/{variantKey}
Fetch details of a specific variant of an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
variantKey |
Required. String. The variant's key. |
Response¶
A successful request returns a 200 OK
response and a JSON object with details of experiment's variant.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/variants/<variantKey>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Get experiment variant inclusions¶
GET https://management-api.experiment.amplitude.com/experiments/{id}/variants/{variantKey}/users
Fetch a list of inclusions for a specific variant of an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
variantKey |
Required. String. The variant's key. |
Response¶
A successful request returns a 200 OK
response and a JSON object with a list of inclusions of experiment's variant.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/variants/<variantKey>/users' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Create experiment variant¶
POST https://management-api.experiment.amplitude.com/experiments/{id}/variants
Create a new variant for an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
Request body¶
Name |
Requirement | Type | Description |
---|---|---|---|
key |
Required | string | The variant key. |
description |
Optional | string | Description for the variant. |
name |
Optional | string | Name for the variant. |
payload |
Optional | string | Optional payload. Value must be a valid JSON element. |
rolloutWeight |
Optional | number | Rollout weight for non-targeted users. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request POST \
--url 'https://management-api.experiment.amplitude.com/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 experiment variant¶
PATCH https://management-api.experiment.amplitude.com/experiments/{id}/variants/{variantKey}
Edit a variant for an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
variantKey |
Required. String. The variant's key. |
Request body¶
Name |
Requirement | Type | Description |
---|---|---|---|
key |
Optional | string | The variant key. |
description |
Optional | string | Description for the variant. |
name |
Optional | string | Name for the variant. |
payload |
Optional | string | Optional payload. Value must be a valid JSON element. |
rolloutWeight |
Optional | number | Rollout weight for non-targeted users. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request PATCH \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/variants/<variantKey>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>' \
--data '{"key":"<key>","name":"<name>","description":"<description>","payload":"<payload>","rolloutWeight":<rolloutWeight>}'
Remove experiment variant¶
DELETE https://management-api.experiment.amplitude.com/experiments/{id}/variants/{variantKey}
Remove a variant from an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
variantKey |
Required. String. The variant's key. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request DELETE \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/variants/<variantKey>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Add users to experiment's variant¶
POST https://management-api.experiment.amplitude.com/experiments/{id}/variants/{variantKey}/users
Add inclusions (users or devices) to experiment's variant.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
variantKey |
Required. String. The variant's key. |
Request body¶
Name |
Requirement | Type | Description |
---|---|---|---|
inclusions |
Required | object | Contains an string array of user or device ids. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request POST \
--url 'https://management-api.experiment.amplitude.com/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"]>}'
Remove users from experiment's variant¶
DELETE https://management-api.experiment.amplitude.com/experiments/{id}/variants/{variantKey}/users/{userIndex}
Remove inclusions (users or devices) from experiment's variant.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
variantKey |
Required. String. The variant's key. |
userIndex |
Required. String. The user's index. Zero-indexed. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request DELETE \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/variants/<variantKey>/users/{<userIndex>}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Remove all users from experiment's variant¶
DELETE https://management-api.experiment.amplitude.com/experiments/{id}/variants/{variantKey}/users
Remove all inclusions (users or devices) from experiment's variant.
Path variables¶
Name |
Description |
---|---|
id |
Required. String. The experiment's ID. |
variantKey |
Required. String. The variant's key. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request DELETE \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/variants/<variantKey>/users' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Edit experiment¶
PATCH https://management-api.experiment.amplitude.com/experiments/{id}
Edit an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
Request body¶
Name |
Requirement | Type | Description |
---|---|---|---|
bucketingKey |
Optional | string | The user property to bucket the user by. |
bucketingSalt |
Optional | string | Experiment's bucketing salt. |
bucketingUnit |
Optional | string | Experiment's bucketing unit represented by a group type from the accounts add-on. Used for group level bucketing and analysis. |
description |
Optional | string | Description of the experiment. |
enabled |
Optional | boolean | Property to activate or deactivate the experiment. |
evaluationMode |
Optional | string | Evaluation mode for the experiment, either local or remote . |
name |
Optional | string | Name of the experiment. |
rolloutPercentage |
Optional | number | Rollout percentage for non-targeted users. Range 0 - 100. |
experimentType |
Optional | string | Experiment type, options include no-harm or hypothesis-testing . |
stickyBucketing |
Optional | boolean | If true, the experiment uses sticky bucketing. |
startDate |
Optional | string | Start date of the experiment in ISO 8601 format. |
endDate |
Optional | string | End date of the experiment in ISO 8601 format. End date can be null. |
exposureEvent |
Optional | object | See the exposureEvent table for more information. If set to null, the Amplitude Exposure Event will be used. |
exposureEvent
¶
The exposureEvent
field contains these objects.
Name |
Requirement | Type | Description |
---|---|---|---|
event_type |
Required | string | Event type. |
filters |
Required | object array | A list of property filters. See the filters table for more information. |
filters
¶
The filters
field contains these objects.
Name |
Requirement | Type | Description |
---|---|---|---|
group_type |
Optional | string | Group type of the filter; can be null. Can be User value or one of the group values, eg org _id , org name |
subprop_key |
Required | string | Filter's key; can be null. |
subprop_op |
Required | string | The operation to use in this filter. |
subprop_type |
Required | string | Either event , user or group indicating that the property is either an event, user or group property, respectively. |
subprop_value |
Required | string array | A list of values to filter the event property by. |
subprop_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
glob match
glob does not match
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request PATCH \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>' \
--data '{"enabled":<enabled>,"rolloutPercentage":<rolloutPercentage>}'
Create experiment¶
POST https://management-api.experiment.amplitude.com/experiments/new
Create a new experiment.
Request body¶
Name |
Requirement | Type | Description |
---|---|---|---|
projectId |
Required | string | The project's ID. |
key |
Required | string | The experiment key. |
name |
Optional | string | The experiment name. |
description |
Optional | string | Description for the experiment. |
variants |
Optional | object array | Array of variants . |
bucketingKey |
Optional | string | The user property to bucket the user by. |
rolloutWeights |
Optional | object | Rollout weights for non-targeted users. The object should be a mapping from variant key to rollout weight as an integer. For example: { "control": 1, "treatment": 1 } . |
targetSegments |
Optional | object | See the targetSegments table for more information. |
deployments |
Optional | string array | Array of deployments that the experiment should be assigned to. |
experimentType |
Optional | string | Experiment type; options include hypothesis-testing or no-harm . |
evaluationMode |
Optional | string | Experiment evaluation mode; options include remote or local . |
variants
¶
The variants
field contains these objects.
Name |
Requirement | Type | Description |
---|---|---|---|
key |
Required | string | The key (a.k.a value) of the variant. |
payload |
Optional | string | Optional payload. Value must be a valid JSON element. |
name |
Optional | string | The variant name. |
description |
Optional | string | The variant description. |
targetSegments
¶
The targetSegments
field contains these objects.
Name |
Requirement | Type | Description |
---|---|---|---|
name |
Optional | string | The segment name. |
conditions |
Required | object array | Array of conditions . |
percentage |
Optional | number | The allocation percentage for users who match a condition. |
rolloutWeights |
Optional | object | A map from variant key to rollout weight. For example: { "control": 1, "treatment": 1 } . |
conditions
¶
The conditions
field contains these objects.
Name |
Requirement | Type | Description |
---|---|---|---|
type |
Required | string | Must have value: property |
prop |
Required | string | The property to use in the condition. |
op |
Required | string | The operation to use in this condition. |
values |
Required | string array | The values to use in the operation. |
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
glob match
glob does not match
Response¶
A successful request returns a 200 OK
response and a JSON object with the experiment's details.
Example cURL
curl --request POST \
--url 'https://management-api.experiment.amplitude.com/experiments/new' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>' \
--data '{"projectId":"<projectId>","key":"<key>"}'
Activate experiment¶
Not recommended. Use edit experiment
instead.
POST https://management-api.experiment.amplitude.com/experiments/{id}/activate
Activate an inactive experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
Example cURL
curl --request POST \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/activate' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Deactivate experiment¶
Not recommended. Use edit experiment
instead.
POST https://management-api.experiment.amplitude.com/experiments/{id}/deactivate
Deactivate an active experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
Example cURL
curl --request POST \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/deactivate' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Rollout weights¶
Not recommended. Use edit experiment variant
instead.
POST https://management-api.experiment.amplitude.com/experiments/{id}/rollout-weights
Update the rollout weights for an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The experiment's ID. |
Request body¶
Name |
Requirement | Type | Description |
---|---|---|---|
rolloutWeights |
Required | object | A map from variant key to rollout weight. For example: {"control": 1,"treatment":1} . |
Example cURL
curl --request POST \
--url 'https://management-api.experiment.amplitude.com/experiments/<id>/rollout-weights' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>' \
--data '{"rolloutWeights":{"control": 1,"treatment":1}}'
Flag endpoints¶
List flags¶
GET https://management-api.experiment.amplitude.com/flags/list
Fetch a list of flags including their configuration details. Results are ordered with the most recently created flags first.
Query parameters¶
Name | Description |
---|---|
limit |
The max number of flags to be returned. Capped at 1000. |
cursor |
The offset to start the "page" of results from. |
Response¶
A successful request returns a 200 OK
response and a list of flags encoded as JSON in the response body.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/flags/list?limit=1000' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Get flag details¶
GET https://management-api.experiment.amplitude.com/flags/{id}
Fetch the configuration details of a flag.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
Response¶
A successful request returns a 200 OK
response and a JSON object with the flag's details.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/flags/<id>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
List flag versions¶
GET https://management-api.experiment.amplitude.com/flags/{id}/versions
Fetch a list of all versions for a flag.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
Response¶
A successful request returns a 200 OK
response and a list of flag's versions encoded as JSON in the response body.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/flags/<id>/versions' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Get flag version details¶
GET https://management-api.experiment.amplitude.com/flags/{id}/versions/{versionId}
Fetch details of a specific version of a flag.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flags's ID. |
versionId |
Required. String. The version's ID. |
Response¶
A successful request returns a 200 OK
response and a JSON object with details of flag's version.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/flags/<id>/versions/<versionId>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
List flag variants¶
GET https://management-api.experiment.amplitude.com/flags/{id}/variants
Fetch a list of all variants for a flag.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
Response¶
A successful request returns a 200 OK
response and a list of flag's variants encoded as JSON in the response body.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/flags/<id>/variants' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Get flag variant details¶
GET https://management-api.experiment.amplitude.com/flags/{id}/variants/{variantKey}
Fetch details of a specific variant of a flag.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
variantKey |
Required. String. The variant's key. |
Response¶
A successful request returns a 200 OK
response and a JSON object with details of flag's variant.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/flags/<id>/variants/<variantKey>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Get flag variant inclusions¶
GET https://management-api.experiment.amplitude.com/flags/{id}/variants/{variantKey}/users
Fetch a list of inclusions for a specific variant of a flag.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
variantKey |
Required. String. The variant's key. |
Response¶
A successful request returns a 200 OK
response and a JSON object with a list of inclusions of flag's variant.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/flags/<id>/variants/<variantKey>/users' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Create flag variant¶
POST https://management-api.experiment.amplitude.com/flags/{id}/variants
Create a new variant for a flag.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
Request body¶
Name |
Requirement | Type | Description |
---|---|---|---|
key |
Required | string | The variant key. |
description |
Optional | string | Description for the variant. |
name |
Optional | string | Name for the variant. |
payload |
Optional | string | Optional payload. Value must be a valid JSON element. |
rolloutWeight |
Optional | number | Rollout weight for non-targeted users. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request POST \
--url 'https://management-api.experiment.amplitude.com/flags/<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 flag variant¶
PATCH https://management-api.experiment.amplitude.com/flags/{id}/variants/{variantKey}
Edit a variant for a flag.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
variantKey |
Required. String. The variant's key. |
Request body¶
Name |
Requirement | Type | Description |
---|---|---|---|
key |
Optional | string | The variant key. |
description |
Optional | string | Description for the variant. |
name |
Optional | string | Name for the variant. |
payload |
Optional | string | Optional payload. Value must be a valid JSON element. |
rolloutWeight |
Optional | number | Rollout weight for non-targeted users. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request PATCH \
--url 'https://management-api.experiment.amplitude.com/flags/<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 flag variant¶
DELETE https://management-api.experiment.amplitude.com/flags/{id}/variants/{variantKey}
Remove a variant from an experiment.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
variantKey |
Required. String. The variant's key. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request DELETE \
--url 'https://management-api.experiment.amplitude.com/flags/<id>/variants/<variantKey>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Add users to flag's variant¶
POST https://management-api.experiment.amplitude.com/flags/{id}/variants/{variantKey}/users
Add inclusions (users or devices) to flag's variant.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
variantKey |
Required. String. The variant's key. |
Request body¶
Name |
Requirement | Type | Description |
---|---|---|---|
inclusions |
Required | object | Contains an string array of user or device ids. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request POST \
--url 'https://management-api.experiment.amplitude.com/flags/<id>/variants/<variantKey>/users' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>' \
--data '{"inclusions":<["id1", "id2", "id3"]>}'
Remove users from flag's variant¶
DELETE https://management-api.experiment.amplitude.com/flags/{id}/variants/{variantKey}/users/{userIndex}
Remove users (inclusions) from flag's variant.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
variantKey |
Required. String. The flag's key. |
userIndex |
Required. String. The user's index. Zero-indexed. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request DELETE \
--url 'https://management-api.experiment.amplitude.com/flags/<id>/variants/<variantKey>/users/{<userIndex>}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Remove all users from flag's variant¶
DELETE https://management-api.experiment.amplitude.com/flags/{id}/variants/{variantKey}/users
Remove all inclusion (users or devices) from flag's variant.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
variantKey |
Required. String. The flag's key. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request DELETE \
--url 'https://management-api.experiment.amplitude.com/flags/<id>/variants/<variantKey>/users' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Edit flag¶
PATCH https://management-api.experiment.amplitude.com/flags/{id}
Edit a flag.
Path variables¶
Name | Description |
---|---|
id |
Required. String. The flag's ID. |
Request body¶
Name |
Requirement | Type | Description |
---|---|---|---|
bucketingKey |
Optional | string | The user property to bucket the user by. |
bucketingSalt |
Optional | string | Flag's bucketing salt. |
bucketingUnit |
Optional | string | Flag's bucketing unit represented by a group type from the accounts add-on. Used for group level bucketing. |
description |
Optional | string | Description of the flag. |
enabled |
Optional | boolean | Property to activate or deactivate the flag. |
evaluationMode |
Optional | string | Evaluation mode for the flag, either local or remote . |
name |
Optional | string | Name of the flag. |
rolloutPercentage |
Optional | number | Rollout percentage for non-targeted users. Range 0 - 100. |
Response¶
A successful request returns a 200 OK
response.
Example cURL
curl --request PATCH \
--url 'https://management-api.experiment.amplitude.com/flags/<id>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>' \
--data '{"enabled":<enabled>,"rolloutPercentage":<rolloutPercentage>}'
Create flag¶
POST https://management-api.experiment.amplitude.com/flags/new
Create a new flag.
Request body¶
Name |
Requirement | Type | Description |
---|---|---|---|
projectId |
Required | string | The project's ID. |
key |
Required | string | The flag key. |
name |
Optional | string | The flag name. |
description |
Optional | string | Description for the flag. |
variants |
Optional | object array | Array of variants . |
bucketingKey |
Optional | string | The user property to bucket the user by. |
rolloutWeights |
Optional | object | Rollout weights for non-targeted users. The object should be a mapping from variant key to rollout weight as an integer. For example: { "control": 1, "treatment": 1 } . |
targetSegments |
Optional | object | See the targetSegments table for more information. |
deployments |
Optional | string array | Array of deployments that the experiment should be assigned to. |
evaluationMode |
Optional | string | Experiment evaluation mode; options include remote or local . |
Response¶
A successful request returns a 200 OK
response and a JSON object with the flag's details.
Example cURL
curl --request POST \
--url 'https://management-api.experiment.amplitude.com/flags/new' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>' \
--data '{"projectId":"<projectId>","key":"<key>"}'
Other endpoints¶
List deployments¶
GET https://management-api.experiment.amplitude.com/deployments/list
Fetch a list of deployments that experiments or flags can be assigned to.
Query parameters¶
Name | Description |
---|---|
limit |
The max number of deployments to be returned. Capped at 1000. |
cursor |
The offset to start the "page" of results from. |
Response¶
A successful request returns a 200 OK
response and a list of deployments encoded as JSON in the response body.
Example cURL
curl --request GET \
--url 'https://management-api.experiment.amplitude.com/deployments/list?limit=1000' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <management-api-key>'
Still have questions? Ask them in the Community.