For the complete documentation index, see llms.txt. For the full documentation snapshot, see llms-full.txt.
Create an experiment iteration.
Experiment iterations let you record experiments in individual blocks of time. Initially, iterations are created with a status of not_started and appear in the draftIteration field of an experiment. To start or stop an iteration, update the experiment with the startIteration or stopIteration instruction.
To learn more, read Start experiment iterations.
curl --request POST \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey}/iterations \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"hypothesis": "Example hypothesis, the new button placement will increase conversion",
"metrics": [
{
"key": "metric-key-123abc",
"isGroup": true,
"primary": true
}
],
"treatments": [
{
"name": "Treatment 1",
"baseline": true,
"allocationPercent": "10",
"parameters": [
{
"flagKey": "example-flag-for-experiment",
"variationId": "e432f62b-55f6-49dd-a02f-eb24acf39d05"
}
]
}
],
"flags": "{\"example-flag-key\": { \"ruleId\": \"e432f62b-55f6-49dd-a02f-eb24acf39d05\", \"flagConfigVersion\": 12, \"notInExperimentVariationId\": \"e432f62b-55f6-49dd-a02f-eb24acf39d05\" }}",
"canReshuffleTraffic": true,
"primarySingleMetricKey": "metric-key-123abc",
"primaryFunnelKey": "metric-group-key-123abc",
"randomizationUnit": "user",
"reallocationFrequencyMillis": 3600000,
"covariateId": "<string>",
"attributes": [
"country",
"device",
"os"
]
}
'{
"hypothesis": "The new button placement will increase conversion",
"status": "running",
"createdAt": "1654104600000",
"_id": "12ab3c45de678910fgh12345",
"startedAt": "1655314200000",
"endedAt": "1656610200000",
"winningTreatmentId": "122c9f3e-da26-4321-ba68-e0fc02eced58",
"winningReason": "We ran this iteration for two weeks and the winning variation was clear",
"canReshuffleTraffic": true,
"flags": {},
"reallocationFrequencyMillis": 3600000,
"version": 0,
"primaryMetric": {
"key": "metric-key-123abc",
"_versionId": "<string>",
"name": "My metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"isGroup": true,
"isNumeric": true,
"eventKey": "event-key-123abc",
"metrics": [
{
"key": "metric-key-123abc",
"name": "Example metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_versionId": "version-id-123abc",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
},
"primarySingleMetric": {
"key": "metric-key-123abc",
"name": "Example metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_versionId": "version-id-123abc",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc"
},
"primaryFunnel": {
"key": "metric-group-key-123abc",
"name": "My metric group",
"kind": "funnel",
"_links": {
"parent": {
"href": "/api/v2/projects/my-project",
"type": "application/json"
},
"self": {
"href": "/api/v2/projects/my-project/metric-groups/my-metric-group",
"type": "application/json"
}
},
"metrics": [
{
"key": "metric-key-123abc",
"name": "Example metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_versionId": "version-id-123abc",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
},
"randomizationUnit": "user",
"attributes": [
"<string>"
],
"treatments": [
{
"name": "Treatment 1",
"allocationPercent": "10",
"_id": "122c9f3e-da26-4321-ba68-e0fc02eced58",
"baseline": true,
"parameters": [
{
"variationId": "<string>",
"flagKey": "<string>"
}
]
}
],
"secondaryMetrics": [
{
"key": "metric-key-123abc",
"name": "Example metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_versionId": "version-id-123abc",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc"
}
],
"metrics": [
{
"key": "metric-key-123abc",
"_versionId": "<string>",
"name": "My metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"isGroup": true,
"isNumeric": true,
"eventKey": "event-key-123abc",
"metrics": [
{
"key": "metric-key-123abc",
"name": "Example metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_versionId": "version-id-123abc",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
}
],
"layerSnapshot": {
"key": "checkout-flow",
"name": "Checkout Flow",
"reservationPercent": 10,
"otherReservationPercent": 70
},
"covariateInfo": {
"id": "74a49a2b-4834-4246-917e-5d85231d8c2a",
"fileName": "covariate.csv",
"createdAt": "1654104600000"
}
}Documentation Index
Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
The project key
The environment key
The experiment key
The expected outcome of this experiment
"Example hypothesis, the new button placement will increase conversion"
Details on the metrics for this experiment
Show child attributes
Details on the variations you are testing in the experiment. You establish these variations in feature flags, and then reuse them in experiments.
Show child attributes
Details on the feature flag and targeting rules for this iteration
Show child attributes
"{\"example-flag-key\": { \"ruleId\": \"e432f62b-55f6-49dd-a02f-eb24acf39d05\", \"flagConfigVersion\": 12, \"notInExperimentVariationId\": \"e432f62b-55f6-49dd-a02f-eb24acf39d05\" }}"
Whether to allow the experiment to reassign traffic to different variations when you increase or decrease the traffic in your experiment audience (true) or keep all traffic assigned to its initial variation (false). Defaults to true.
true
The key of the primary metric for this experiment. Either primarySingleMetricKey or primaryFunnelKey must be present.
"metric-key-123abc"
The key of the primary funnel group for this experiment. Either primarySingleMetricKey or primaryFunnelKey must be present.
"metric-group-key-123abc"
The unit of randomization for this iteration. Defaults to user.
"user"
The cadence (in milliseconds) to update the allocation.
3600000
The ID of the covariate CSV
The attributes that this iteration's results can be sliced by
["country", "device", "os"]Iteration response
The expected outcome of this experiment
"The new button placement will increase conversion"
The status of the iteration: not_started, running, stopped
not_started, running, stopped "running"
Timestamp of when the iteration was created
"1654104600000"
The iteration ID
"12ab3c45de678910fgh12345"
Timestamp of when the iteration started
"1655314200000"
Timestamp of when the iteration ended
"1656610200000"
The ID of the treatment chosen when the experiment stopped
"122c9f3e-da26-4321-ba68-e0fc02eced58"
The reason you stopped the experiment
"We ran this iteration for two weeks and the winning variation was clear"
Whether the experiment may reassign traffic to different variations when the experiment audience changes (true) or must keep all traffic assigned to its initial variation (false).
true
Details on the flag used in this experiment
Show child attributes
The cadence (in milliseconds) to update the allocation. Only present for multi-armed bandits.
3600000
The current version that the iteration is on
0
Deprecated, use primarySingleMetric and primaryFunnel instead. Details on the primary metric for this experiment.
Show child attributes
Details on the primary metric for this experiment
Show child attributes
Details on the primary funnel group for this experiment
Show child attributes
The unit of randomization for this iteration
"user"
The available attribute filters for this iteration
Details on the variations you are testing in the experiment
Show child attributes
Deprecated, use metrics instead. Details on the secondary metrics for this experiment.
Show child attributes
Details on the metrics for this experiment
Show child attributes
Snapshot of the layer state on iteration stop, if part of a layer. Otherwise omitted.
Show child attributes
Details of the covariate file for stratified sampling
Show child attributes
curl --request POST \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey}/iterations \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"hypothesis": "Example hypothesis, the new button placement will increase conversion",
"metrics": [
{
"key": "metric-key-123abc",
"isGroup": true,
"primary": true
}
],
"treatments": [
{
"name": "Treatment 1",
"baseline": true,
"allocationPercent": "10",
"parameters": [
{
"flagKey": "example-flag-for-experiment",
"variationId": "e432f62b-55f6-49dd-a02f-eb24acf39d05"
}
]
}
],
"flags": "{\"example-flag-key\": { \"ruleId\": \"e432f62b-55f6-49dd-a02f-eb24acf39d05\", \"flagConfigVersion\": 12, \"notInExperimentVariationId\": \"e432f62b-55f6-49dd-a02f-eb24acf39d05\" }}",
"canReshuffleTraffic": true,
"primarySingleMetricKey": "metric-key-123abc",
"primaryFunnelKey": "metric-group-key-123abc",
"randomizationUnit": "user",
"reallocationFrequencyMillis": 3600000,
"covariateId": "<string>",
"attributes": [
"country",
"device",
"os"
]
}
'{
"hypothesis": "The new button placement will increase conversion",
"status": "running",
"createdAt": "1654104600000",
"_id": "12ab3c45de678910fgh12345",
"startedAt": "1655314200000",
"endedAt": "1656610200000",
"winningTreatmentId": "122c9f3e-da26-4321-ba68-e0fc02eced58",
"winningReason": "We ran this iteration for two weeks and the winning variation was clear",
"canReshuffleTraffic": true,
"flags": {},
"reallocationFrequencyMillis": 3600000,
"version": 0,
"primaryMetric": {
"key": "metric-key-123abc",
"_versionId": "<string>",
"name": "My metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"isGroup": true,
"isNumeric": true,
"eventKey": "event-key-123abc",
"metrics": [
{
"key": "metric-key-123abc",
"name": "Example metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_versionId": "version-id-123abc",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
},
"primarySingleMetric": {
"key": "metric-key-123abc",
"name": "Example metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_versionId": "version-id-123abc",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc"
},
"primaryFunnel": {
"key": "metric-group-key-123abc",
"name": "My metric group",
"kind": "funnel",
"_links": {
"parent": {
"href": "/api/v2/projects/my-project",
"type": "application/json"
},
"self": {
"href": "/api/v2/projects/my-project/metric-groups/my-metric-group",
"type": "application/json"
}
},
"metrics": [
{
"key": "metric-key-123abc",
"name": "Example metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_versionId": "version-id-123abc",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
},
"randomizationUnit": "user",
"attributes": [
"<string>"
],
"treatments": [
{
"name": "Treatment 1",
"allocationPercent": "10",
"_id": "122c9f3e-da26-4321-ba68-e0fc02eced58",
"baseline": true,
"parameters": [
{
"variationId": "<string>",
"flagKey": "<string>"
}
]
}
],
"secondaryMetrics": [
{
"key": "metric-key-123abc",
"name": "Example metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_versionId": "version-id-123abc",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc"
}
],
"metrics": [
{
"key": "metric-key-123abc",
"_versionId": "<string>",
"name": "My metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"isGroup": true,
"isNumeric": true,
"eventKey": "event-key-123abc",
"metrics": [
{
"key": "metric-key-123abc",
"name": "Example metric",
"kind": "custom",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_versionId": "version-id-123abc",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
}
],
"layerSnapshot": {
"key": "checkout-flow",
"name": "Checkout Flow",
"reservationPercent": 10,
"otherReservationPercent": 70
},
"covariateInfo": {
"id": "74a49a2b-4834-4246-917e-5d85231d8c2a",
"fileName": "covariate.csv",
"createdAt": "1654104600000"
}
}