Experimentation is an add-on feature
Experimentation is available as an add-on for customers on an Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.
This feature is in beta
To use this feature, pass in a header including the
LD-API-Version
key with value set tobeta
. Use this header with each call. To learn more, read Beta resources.
An experiment is a running tally of user behaviors based on which variation of a feature flag they receive. In LaunchDarkly, an experiment requires two things: a metric that defines what user behaviors to track, and at least one flag associated with that metric. To learn more, read Experimentation.
Experiments are largely managed by making PATCH requests to the flags API. There are also dedicated API resources for getting and deleting experiment data.
To add an experiment to a flag, add a new object to the /experiments/items/
property.
The object must contain:
PATCH /api/v2/flags/{projKey}/{flagKey}
[
{
"op": "add",
"path": "/experiments/items/0",
"value": {
"metricKey": "example-metric",
"environments": []
}
}
]
To remove an experiment, remove the corresponding item from the experiments or items property.
PATCH /api/v2/flags/{projKey}/{flagKey}
[
{
"op": "remove",
"path": "/experiments/items/0"
}
]
To start recording data for an experiment in an environment, add the environment key to the list of environments for that experiment.
PATCH /api/v2/flags/{projKey}/{flagKey}
[
{
"op": "add",
"path": "/experiments/items/0/environments/0",
"value": "production"
}
]
To pause collecting data for an experiment in a specific environment, remove the environment from the list that experiment uses.
PATCH /api/v2/flags/{projKey}/{flagKey}
[
{
"op": "remove",
"path": "/experiments/items/0/environments/0"
}
]
To update the baseline for all experiments on a flag across all environments in the project, replace the baselineIdx
property with the index of the new baseline variation.
PATCH /api/v2/flags/{projKey}/{flagKey}
[
{
"op": "replace",
"path": "/experiments/baselineIdx",
"value": 1
}
]
Get detailed experiment result data for legacy experiments.
Experiment results response
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
curl -i -X GET \ 'https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/experiments/{environmentKey}/{metricKey}' \ -H 'Authorization: YOUR_API_KEY_HERE'
{- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}, - "metadata": [
- {
- "key": null
}
], - "totals": [
- {
- "cumulativeValue": 0,
- "cumulativeCount": 0,
- "cumulativeImpressionCount": 0,
- "cumulativeConversionRate": 0,
- "cumulativeConfidenceInterval": {
- "upper": 0,
- "lower": 0
}, - "pValue": 0,
- "improvement": 0,
- "minSampleSize": 0
}
], - "series": [
- {
- "Time": 0,
- "VariationData": [
- {
- "value": 0,
- "count": 0,
- "cumulativeValue": 0,
- "cumulativeCount": 0,
- "conversionRate": 0,
- "cumulativeConversionRate": 0,
- "confidenceInterval": {
- "upper": 0,
- "lower": 0
}, - "cumulativeConfidenceInterval": {
- "upper": 0,
- "lower": 0
}
}
]
}
], - "stats": {
- "pValue": 0,
- "chi2": 0,
- "winningVariationIdx": 0,
- "minSampleSizeMet": true
}, - "granularity": "string",
- "metricSeen": {
- "ever": true,
- "timestamp": 0
}
}
Reset all experiment results by deleting all existing data for an experiment.
Experiment results reset successfully
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
curl -i -X DELETE \ 'https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/experiments/{environmentKey}/{metricKey}/results' \ -H 'Authorization: YOUR_API_KEY_HERE'
{- "code": "unauthorized",
- "message": "invalid key"
}
Get details about all experiments in an environment.
LaunchDarkly supports the filter
query param for filtering, with the following fields:
flagKey
filters for only experiments which use the flag with the given key.status
filters for only experiments with an iteration with the given status. An iteration can have the status not_started
, running
or stopped
.For example, filter=flagKey:my-flag,status=running
filters for experiments for the given flag key which have a currently running iteration.
LaunchDarkly supports four fields for expanding the "List experiments" response. By default, these fields are not included in the response.
To expand the response, append the expand
query parameter and add a comma-separated list with any of the following fields:
previousIterations
includes all iterations prior to the current iteration. By default only the current iteration will be included in the response.draftIteration
includes a draft of an iteration which has not been started yet, if any.secondaryMetrics
includes secondary metrics. By default only the primary metric is included in the response.treatments
includes all treatment and parameter details. By default treatment data will not be included in the response.For example, expand=draftIteration,treatments
includes the draftIteration
and treatments
fields in the response.
Experiment response JSON
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Method not allowed
Rate limited
curl -i -X GET \ 'https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/experiments' \ -H 'Authorization: YOUR_API_KEY_HERE'
{- "items": [
- {
- "_id": "string",
- "key": "string",
- "name": "string",
- "description": "string",
- "_maintainerId": "string",
- "_creationDate": 0,
- "_links": {
- "parent": {
- "href": "/api/v2/projects/my-project/environments/my-environment",
- "type": "application/json"
}, - "self": {
- "href": "/api/v2/projects/my-project/environments/my-environment/experiments/my-experiment",
- "type": "application/json"
}
}, - "currentIteration": {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": null,
- "flagKey": null
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}, - "draftIteration": {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": null,
- "flagKey": null
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}, - "previousIterations": [
- {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- null
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}
]
}
], - "total_count": 0,
- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}
}
Create an experiment. To learn more, read Creating experiments.
Experiment response JSON
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "name": "string",
- "description": "string",
- "maintainerId": "string",
- "key": "string",
- "iteration": {
- "hypothesis": "string",
- "canReshuffleTraffic": true,
- "metrics": [
- {
- "key": "string",
- "primary": true
}
], - "treatments": [
- {
- "name": "string",
- "baseline": true,
- "allocationPercent": "string",
- "parameters": [
- {
- "flagKey": "string",
- "variationId": "string"
}
]
}
], - "flags": {
- "property1": {
- "ruleId": "string",
- "flagConfigVersion": 0
}, - "property2": {
- "ruleId": "string",
- "flagConfigVersion": 0
}
}
}
}
{- "_id": "string",
- "key": "string",
- "name": "string",
- "description": "string",
- "_maintainerId": "string",
- "_creationDate": 0,
- "_links": {
- "parent": {
- "href": "/api/v2/projects/my-project/environments/my-environment",
- "type": "application/json"
}, - "self": {
- "href": "/api/v2/projects/my-project/environments/my-environment/experiments/my-experiment",
- "type": "application/json"
}
}, - "currentIteration": {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": "string",
- "flagKey": "string"
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}, - "draftIteration": {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": "string",
- "flagKey": "string"
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}, - "previousIterations": [
- {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": "string",
- "flagKey": "string"
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}
]
}
Get details about an experiment.
Experiment response JSON
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Method not allowed
Rate limited
curl -i -X GET \ 'https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey}' \ -H 'Authorization: YOUR_API_KEY_HERE'
{- "_id": "string",
- "key": "string",
- "name": "string",
- "description": "string",
- "_maintainerId": "string",
- "_creationDate": 0,
- "_links": {
- "parent": {
- "href": "/api/v2/projects/my-project/environments/my-environment",
- "type": "application/json"
}, - "self": {
- "href": "/api/v2/projects/my-project/environments/my-environment/experiments/my-experiment",
- "type": "application/json"
}
}, - "currentIteration": {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": "string",
- "flagKey": "string"
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}, - "draftIteration": {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": "string",
- "flagKey": "string"
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}, - "previousIterations": [
- {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": "string",
- "flagKey": "string"
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}
]
}
Update an experiment. Updating an experiment uses the semantic patch format.
To make a semantic patch request, you must append domain-model=launchdarkly.semanticpatch
to your Content-Type
header. To learn more, read Updates using semantic patch.
Semantic patch requests support the following kind
instructions for updating experiments.
Updates the experiment name.
value
: The new name.Updates the experiment description.
value
: The new description.Starts a new iteration for this experiment.
Stops the current iteration for this experiment.
Experiment response JSON
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "Comment": "string",
- "Instructions": [
- {
- "property1": null,
- "property2": null
}
]
}
{- "_id": "string",
- "key": "string",
- "name": "string",
- "description": "string",
- "_maintainerId": "string",
- "_creationDate": 0,
- "_links": {
- "parent": {
- "href": "/api/v2/projects/my-project/environments/my-environment",
- "type": "application/json"
}, - "self": {
- "href": "/api/v2/projects/my-project/environments/my-environment/experiments/my-experiment",
- "type": "application/json"
}
}, - "currentIteration": {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": "string",
- "flagKey": "string"
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}, - "draftIteration": {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": "string",
- "flagKey": "string"
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}, - "previousIterations": [
- {
- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": "string",
- "flagKey": "string"
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}
]
}
Create an experiment iteration. Experiment iterations let you record experiments in discrete blocks of time. To learn more, read Starting experiment iterations.
Iteration response JSON
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "hypothesis": "string",
- "canReshuffleTraffic": true,
- "metrics": [
- {
- "key": "string",
- "primary": true
}
], - "treatments": [
- {
- "name": "string",
- "baseline": true,
- "allocationPercent": "string",
- "parameters": [
- {
- "flagKey": "string",
- "variationId": "string"
}
]
}
], - "flags": {
- "property1": {
- "ruleId": "string",
- "flagConfigVersion": 0
}, - "property2": {
- "ruleId": "string",
- "flagConfigVersion": 0
}
}
}
{- "_id": "string",
- "hypothesis": "string",
- "status": "string",
- "createdAt": 0,
- "startedAt": 0,
- "endedAt": 0,
- "winningTreatmentId": "string",
- "winningReason": "string",
- "canReshuffleTraffic": true,
- "flags": {
- "property1": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}, - "property2": {
- "targetingRule": "string",
- "flagConfigVersion": 0,
- "_links": {
- "self": {
- "href": "/api/v2/flags/my-project/my-flag",
- "type": "application/json"
}
}
}
}, - "primaryMetric": {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}, - "treatments": [
- {
- "_id": "string",
- "name": "string",
- "allocationPercent": "string",
- "baseline": true,
- "parameters": [
- {
- "variationId": "string",
- "flagKey": "string"
}
]
}
], - "secondaryMetrics": [
- {
- "key": "string",
- "name": "string",
- "kind": "string",
- "_links": {
- "self": {
- "href": "/api/v2/metrics/my-project/my-metric",
- "type": "application/json"
}
}
}
]
}
Get results from an experiment for a particular metric.
Experiment results response JSON
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
curl -i -X GET \ 'https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey}/metrics/{metricKey}/results' \ -H 'Authorization: YOUR_API_KEY_HERE'
{- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}, - "treatmentResults": [
- {
- "treatmentId": "string",
- "treatmentName": "string",
- "mean": 0,
- "credibleInterval": {
- "upper": 0,
- "lower": 0
}, - "pBest": 0,
- "relativeDifferences": [
- {
- "upper": 0,
- "lower": 0,
- "fromTreatmentId": "string"
}
], - "units": 0
}
], - "metricSeen": {
- "ever": true,
- "timestamp": 0
}
}