For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • REST API overview
    • Access Tokens
    • Account Members
    • Account Usage Beta
    • AI Configs
    • Announcements
    • Applications Beta
    • Approvals
    • Approvals Beta
    • Audit Log
    • Code References
    • Contexts
    • Context Settings
    • Custom Roles
    • Data Export Destinations
    • Environments
    • Experiments
      • POSTCreate experiment
      • POSTCreate iteration
      • GETGet experiment
      • GETGet experimentation settings
      • GETGet experiments
      • GETGet experiments any environment
      • PATCHPatch experiment
      • PUTUpdate experimentation settings
    • Feature Flags
    • Feature Flags Beta
    • Flag Import Configurations Beta
    • Flag Links Beta
    • Flag Triggers
    • Follow Flags
    • Holdouts Beta
    • Insights Charts Beta
    • Insights Deployments Beta
    • Insights Flag Events Beta
    • Insights Pull Requests Beta
    • Insights Repositories Beta
    • Insights Scores Beta
    • Integration Audit Log Subscriptions
    • Integration Delivery Configurations Beta
    • Integrations Beta
    • Layers
    • Metrics
    • Metrics Beta
    • OAuth2 Clients
    • Persistent Store Integrations Beta
    • Projects
    • Relay Proxy Configurations
    • Release Pipelines Beta
    • Releases Beta
    • Scheduled Changes
    • Segments
    • Tags
    • Teams
    • Teams Beta
    • Users
    • Users Beta
    • User Settings
    • Views Beta
    • Webhooks
    • Workflows
    • Workflow Templates
    • Other
Sign inTry it free
LogoLogo
REST API overviewExperiments

Get experiments

GET
/api/v2/projects/:projectKey/environments/:environmentKey/experiments
GET
/api/v2/projects/:projectKey/environments/:environmentKey/experiments
$curl https://app.launchdarkly.com/api/v2/projects/projectKey/environments/environmentKey/experiments \
> -H "Authorization: <apiKey>"
1{
2 "items": [
3 {
4 "key": "experiment-key-123abc",
5 "name": "Example experiment",
6 "_maintainerId": "12ab3c45de678910fgh12345",
7 "_creationDate": 1654104600000,
8 "environmentKey": "string",
9 "_links": {
10 "parent": {
11 "href": "/api/v2/projects/my-project/environments/my-environment",
12 "type": "application/json"
13 },
14 "self": {
15 "href": "/api/v2/projects/my-project/environments/my-environment/experiments/my-experiment",
16 "type": "application/json"
17 }
18 },
19 "_id": "12ab3c45de678910fgh12345",
20 "description": "An example experiment, used in testing",
21 "methodology": "bayesian",
22 "dataSource": "snowflake",
23 "archivedDate": 1654104600000,
24 "tags": [
25 "experiment",
26 "feature"
27 ],
28 "holdoutId": "f3b74309-d581-44e1-8a2b-bb2933b4fe40",
29 "currentIteration": {
30 "hypothesis": "The new button placement will increase conversion",
31 "status": "running",
32 "createdAt": 1654104600000,
33 "_id": "12ab3c45de678910fgh12345",
34 "startedAt": 1655314200000,
35 "endedAt": 1656610200000,
36 "winningTreatmentId": "122c9f3e-da26-4321-ba68-e0fc02eced58",
37 "winningReason": "We ran this iteration for two weeks and the winning variation was clear",
38 "canReshuffleTraffic": true,
39 "flags": {},
40 "reallocationFrequencyMillis": 3600000,
41 "version": 0,
42 "primaryMetric": {
43 "key": "metric-key-123abc",
44 "_versionId": "string",
45 "name": "My metric",
46 "kind": "custom",
47 "_links": {
48 "self": {
49 "href": "/api/v2/metrics/my-project/my-metric",
50 "type": "application/json"
51 }
52 },
53 "isGroup": true,
54 "isNumeric": true,
55 "eventKey": "event-key-123abc",
56 "metrics": [
57 {
58 "key": "metric-key-123abc",
59 "name": "Example metric",
60 "kind": "custom",
61 "_links": {
62 "self": {
63 "href": "/api/v2/metrics/my-project/my-metric",
64 "type": "application/json"
65 }
66 },
67 "_versionId": "version-id-123abc",
68 "isNumeric": true,
69 "unitAggregationType": "sum",
70 "eventKey": "event-key-123abc",
71 "nameInGroup": "Step 1",
72 "analysisUnits": [
73 "user"
74 ],
75 "randomizationUnits": [
76 "user"
77 ]
78 }
79 ]
80 },
81 "primarySingleMetric": {
82 "key": "metric-key-123abc",
83 "name": "Example metric",
84 "kind": "custom",
85 "_links": {
86 "self": {
87 "href": "/api/v2/metrics/my-project/my-metric",
88 "type": "application/json"
89 }
90 },
91 "_versionId": "version-id-123abc",
92 "isNumeric": true,
93 "unitAggregationType": "sum",
94 "eventKey": "event-key-123abc"
95 },
96 "primaryFunnel": {
97 "key": "metric-group-key-123abc",
98 "name": "My metric group",
99 "kind": "funnel",
100 "_links": {
101 "parent": {
102 "href": "/api/v2/projects/my-project",
103 "type": "application/json"
104 },
105 "self": {
106 "href": "/api/v2/projects/my-project/metric-groups/my-metric-group",
107 "type": "application/json"
108 }
109 },
110 "metrics": [
111 {
112 "key": "metric-key-123abc",
113 "name": "Example metric",
114 "kind": "custom",
115 "_links": {
116 "self": {
117 "href": "/api/v2/metrics/my-project/my-metric",
118 "type": "application/json"
119 }
120 },
121 "_versionId": "version-id-123abc",
122 "isNumeric": true,
123 "unitAggregationType": "sum",
124 "eventKey": "event-key-123abc",
125 "nameInGroup": "Step 1",
126 "analysisUnits": [
127 "user"
128 ],
129 "randomizationUnits": [
130 "user"
131 ]
132 }
133 ]
134 },
135 "randomizationUnit": "user",
136 "attributes": [
137 "string"
138 ],
139 "treatments": [
140 {
141 "name": "Treatment 1",
142 "allocationPercent": "10",
143 "_id": "122c9f3e-da26-4321-ba68-e0fc02eced58",
144 "baseline": true,
145 "parameters": [
146 {
147 "variationId": "string",
148 "flagKey": "string"
149 }
150 ]
151 }
152 ],
153 "metrics": [
154 {
155 "key": "metric-key-123abc",
156 "_versionId": "string",
157 "name": "My metric",
158 "kind": "custom",
159 "_links": {
160 "self": {
161 "href": "/api/v2/metrics/my-project/my-metric",
162 "type": "application/json"
163 }
164 },
165 "isGroup": true,
166 "isNumeric": true,
167 "eventKey": "event-key-123abc",
168 "metrics": [
169 {
170 "key": "metric-key-123abc",
171 "name": "Example metric",
172 "kind": "custom",
173 "_links": {
174 "self": {
175 "href": "/api/v2/metrics/my-project/my-metric",
176 "type": "application/json"
177 }
178 },
179 "_versionId": "version-id-123abc",
180 "isNumeric": true,
181 "unitAggregationType": "sum",
182 "eventKey": "event-key-123abc",
183 "nameInGroup": "Step 1",
184 "analysisUnits": [
185 "user"
186 ],
187 "randomizationUnits": [
188 "user"
189 ]
190 }
191 ]
192 }
193 ],
194 "layerSnapshot": {
195 "key": "checkout-flow",
196 "name": "Checkout Flow",
197 "reservationPercent": 10,
198 "otherReservationPercent": 70
199 },
200 "covariateInfo": {
201 "id": "74a49a2b-4834-4246-917e-5d85231d8c2a",
202 "fileName": "covariate.csv",
203 "createdAt": 1654104600000
204 },
205 "secondaryMetrics": [
206 {
207 "key": "metric-key-123abc",
208 "name": "Example metric",
209 "kind": "custom",
210 "_links": {
211 "self": {
212 "href": "/api/v2/metrics/my-project/my-metric",
213 "type": "application/json"
214 }
215 },
216 "_versionId": "version-id-123abc",
217 "isNumeric": true,
218 "unitAggregationType": "sum",
219 "eventKey": "event-key-123abc"
220 }
221 ]
222 },
223 "type": "experiment",
224 "draftIteration": {
225 "hypothesis": "The new button placement will increase conversion",
226 "status": "running",
227 "createdAt": 1654104600000,
228 "_id": "12ab3c45de678910fgh12345",
229 "startedAt": 1655314200000,
230 "endedAt": 1656610200000,
231 "winningTreatmentId": "122c9f3e-da26-4321-ba68-e0fc02eced58",
232 "winningReason": "We ran this iteration for two weeks and the winning variation was clear",
233 "canReshuffleTraffic": true,
234 "flags": {},
235 "reallocationFrequencyMillis": 3600000,
236 "version": 0,
237 "primaryMetric": {
238 "key": "metric-key-123abc",
239 "_versionId": "string",
240 "name": "My metric",
241 "kind": "custom",
242 "_links": {
243 "self": {
244 "href": "/api/v2/metrics/my-project/my-metric",
245 "type": "application/json"
246 }
247 },
248 "isGroup": true,
249 "isNumeric": true,
250 "eventKey": "event-key-123abc",
251 "metrics": [
252 {
253 "key": "metric-key-123abc",
254 "name": "Example metric",
255 "kind": "custom",
256 "_links": {
257 "self": {
258 "href": "/api/v2/metrics/my-project/my-metric",
259 "type": "application/json"
260 }
261 },
262 "_versionId": "version-id-123abc",
263 "isNumeric": true,
264 "unitAggregationType": "sum",
265 "eventKey": "event-key-123abc",
266 "nameInGroup": "Step 1",
267 "analysisUnits": [
268 "user"
269 ],
270 "randomizationUnits": [
271 "user"
272 ]
273 }
274 ]
275 },
276 "primarySingleMetric": {
277 "key": "metric-key-123abc",
278 "name": "Example metric",
279 "kind": "custom",
280 "_links": {
281 "self": {
282 "href": "/api/v2/metrics/my-project/my-metric",
283 "type": "application/json"
284 }
285 },
286 "_versionId": "version-id-123abc",
287 "isNumeric": true,
288 "unitAggregationType": "sum",
289 "eventKey": "event-key-123abc"
290 },
291 "primaryFunnel": {
292 "key": "metric-group-key-123abc",
293 "name": "My metric group",
294 "kind": "funnel",
295 "_links": {
296 "parent": {
297 "href": "/api/v2/projects/my-project",
298 "type": "application/json"
299 },
300 "self": {
301 "href": "/api/v2/projects/my-project/metric-groups/my-metric-group",
302 "type": "application/json"
303 }
304 },
305 "metrics": [
306 {
307 "key": "metric-key-123abc",
308 "name": "Example metric",
309 "kind": "custom",
310 "_links": {
311 "self": {
312 "href": "/api/v2/metrics/my-project/my-metric",
313 "type": "application/json"
314 }
315 },
316 "_versionId": "version-id-123abc",
317 "isNumeric": true,
318 "unitAggregationType": "sum",
319 "eventKey": "event-key-123abc",
320 "nameInGroup": "Step 1",
321 "analysisUnits": [
322 "user"
323 ],
324 "randomizationUnits": [
325 "user"
326 ]
327 }
328 ]
329 },
330 "randomizationUnit": "user",
331 "attributes": [
332 "string"
333 ],
334 "treatments": [
335 {
336 "name": "Treatment 1",
337 "allocationPercent": "10",
338 "_id": "122c9f3e-da26-4321-ba68-e0fc02eced58",
339 "baseline": true,
340 "parameters": [
341 {
342 "variationId": "string",
343 "flagKey": "string"
344 }
345 ]
346 }
347 ],
348 "metrics": [
349 {
350 "key": "metric-key-123abc",
351 "_versionId": "string",
352 "name": "My metric",
353 "kind": "custom",
354 "_links": {
355 "self": {
356 "href": "/api/v2/metrics/my-project/my-metric",
357 "type": "application/json"
358 }
359 },
360 "isGroup": true,
361 "isNumeric": true,
362 "eventKey": "event-key-123abc",
363 "metrics": [
364 {
365 "key": "metric-key-123abc",
366 "name": "Example metric",
367 "kind": "custom",
368 "_links": {
369 "self": {
370 "href": "/api/v2/metrics/my-project/my-metric",
371 "type": "application/json"
372 }
373 },
374 "_versionId": "version-id-123abc",
375 "isNumeric": true,
376 "unitAggregationType": "sum",
377 "eventKey": "event-key-123abc",
378 "nameInGroup": "Step 1",
379 "analysisUnits": [
380 "user"
381 ],
382 "randomizationUnits": [
383 "user"
384 ]
385 }
386 ]
387 }
388 ],
389 "layerSnapshot": {
390 "key": "checkout-flow",
391 "name": "Checkout Flow",
392 "reservationPercent": 10,
393 "otherReservationPercent": 70
394 },
395 "covariateInfo": {
396 "id": "74a49a2b-4834-4246-917e-5d85231d8c2a",
397 "fileName": "covariate.csv",
398 "createdAt": 1654104600000
399 },
400 "secondaryMetrics": [
401 {
402 "key": "metric-key-123abc",
403 "name": "Example metric",
404 "kind": "custom",
405 "_links": {
406 "self": {
407 "href": "/api/v2/metrics/my-project/my-metric",
408 "type": "application/json"
409 }
410 },
411 "_versionId": "version-id-123abc",
412 "isNumeric": true,
413 "unitAggregationType": "sum",
414 "eventKey": "event-key-123abc"
415 }
416 ]
417 },
418 "previousIterations": [
419 {
420 "hypothesis": "The new button placement will increase conversion",
421 "status": "running",
422 "createdAt": 1654104600000,
423 "_id": "12ab3c45de678910fgh12345",
424 "startedAt": 1655314200000,
425 "endedAt": 1656610200000,
426 "winningTreatmentId": "122c9f3e-da26-4321-ba68-e0fc02eced58",
427 "winningReason": "We ran this iteration for two weeks and the winning variation was clear",
428 "canReshuffleTraffic": true,
429 "flags": {},
430 "reallocationFrequencyMillis": 3600000,
431 "version": 0,
432 "primaryMetric": {
433 "key": "metric-key-123abc",
434 "_versionId": "string",
435 "name": "My metric",
436 "kind": "custom",
437 "_links": {
438 "self": {
439 "href": "/api/v2/metrics/my-project/my-metric",
440 "type": "application/json"
441 }
442 },
443 "isGroup": true,
444 "isNumeric": true,
445 "eventKey": "event-key-123abc",
446 "metrics": [
447 {
448 "key": "metric-key-123abc",
449 "name": "Example metric",
450 "kind": "custom",
451 "_links": {
452 "self": {
453 "href": "/api/v2/metrics/my-project/my-metric",
454 "type": "application/json"
455 }
456 },
457 "_versionId": "version-id-123abc",
458 "isNumeric": true,
459 "unitAggregationType": "sum",
460 "eventKey": "event-key-123abc",
461 "nameInGroup": "Step 1",
462 "analysisUnits": [
463 "user"
464 ],
465 "randomizationUnits": [
466 "user"
467 ]
468 }
469 ]
470 },
471 "primarySingleMetric": {
472 "key": "metric-key-123abc",
473 "name": "Example metric",
474 "kind": "custom",
475 "_links": {
476 "self": {
477 "href": "/api/v2/metrics/my-project/my-metric",
478 "type": "application/json"
479 }
480 },
481 "_versionId": "version-id-123abc",
482 "isNumeric": true,
483 "unitAggregationType": "sum",
484 "eventKey": "event-key-123abc"
485 },
486 "primaryFunnel": {
487 "key": "metric-group-key-123abc",
488 "name": "My metric group",
489 "kind": "funnel",
490 "_links": {
491 "parent": {
492 "href": "/api/v2/projects/my-project",
493 "type": "application/json"
494 },
495 "self": {
496 "href": "/api/v2/projects/my-project/metric-groups/my-metric-group",
497 "type": "application/json"
498 }
499 },
500 "metrics": [
501 {
502 "key": "metric-key-123abc",
503 "name": "Example metric",
504 "kind": "custom",
505 "_links": {
506 "self": {
507 "href": "/api/v2/metrics/my-project/my-metric",
508 "type": "application/json"
509 }
510 },
511 "_versionId": "version-id-123abc",
512 "isNumeric": true,
513 "unitAggregationType": "sum",
514 "eventKey": "event-key-123abc",
515 "nameInGroup": "Step 1",
516 "analysisUnits": [
517 "user"
518 ],
519 "randomizationUnits": [
520 "user"
521 ]
522 }
523 ]
524 },
525 "randomizationUnit": "user",
526 "attributes": [
527 "string"
528 ],
529 "treatments": [
530 {
531 "name": "Treatment 1",
532 "allocationPercent": "10",
533 "_id": "122c9f3e-da26-4321-ba68-e0fc02eced58",
534 "baseline": true,
535 "parameters": [
536 {
537 "variationId": "string",
538 "flagKey": "string"
539 }
540 ]
541 }
542 ],
543 "metrics": [
544 {
545 "key": "metric-key-123abc",
546 "_versionId": "string",
547 "name": "My metric",
548 "kind": "custom",
549 "_links": {
550 "self": {
551 "href": "/api/v2/metrics/my-project/my-metric",
552 "type": "application/json"
553 }
554 },
555 "isGroup": true,
556 "isNumeric": true,
557 "eventKey": "event-key-123abc",
558 "metrics": [
559 {
560 "key": "metric-key-123abc",
561 "name": "Example metric",
562 "kind": "custom",
563 "_links": {
564 "self": {
565 "href": "/api/v2/metrics/my-project/my-metric",
566 "type": "application/json"
567 }
568 },
569 "_versionId": "version-id-123abc",
570 "isNumeric": true,
571 "unitAggregationType": "sum",
572 "eventKey": "event-key-123abc",
573 "nameInGroup": "Step 1",
574 "analysisUnits": [
575 "user"
576 ],
577 "randomizationUnits": [
578 "user"
579 ]
580 }
581 ]
582 }
583 ],
584 "layerSnapshot": {
585 "key": "checkout-flow",
586 "name": "Checkout Flow",
587 "reservationPercent": 10,
588 "otherReservationPercent": 70
589 },
590 "covariateInfo": {
591 "id": "74a49a2b-4834-4246-917e-5d85231d8c2a",
592 "fileName": "covariate.csv",
593 "createdAt": 1654104600000
594 },
595 "secondaryMetrics": [
596 {
597 "key": "metric-key-123abc",
598 "name": "Example metric",
599 "kind": "custom",
600 "_links": {
601 "self": {
602 "href": "/api/v2/metrics/my-project/my-metric",
603 "type": "application/json"
604 }
605 },
606 "_versionId": "version-id-123abc",
607 "isNumeric": true,
608 "unitAggregationType": "sum",
609 "eventKey": "event-key-123abc"
610 }
611 ]
612 }
613 ],
614 "analysisConfig": {
615 "bayesianThreshold": "string",
616 "significanceThreshold": "string",
617 "testDirection": "string",
618 "multipleComparisonCorrectionMethod": "bonferroni",
619 "multipleComparisonCorrectionScope": "variations",
620 "sequentialTestingEnabled": true
621 },
622 "mutableFieldsByStatus": {
623 "not_started": {},
624 "running": {},
625 "stopped": {}
626 }
627 }
628 ],
629 "total_count": 1,
630 "_links": {}
631}
Get details about all experiments in an environment. ### Filtering experiments LaunchDarkly supports the `filter` query param for filtering, with the following fields: - `flagKey` filters for only experiments that use the flag with the given key. - `metricKey` filters for only experiments that use the metric 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,metricKey:page-load-ms` filters for experiments for the given flag key and the given metric key which have a currently running iteration. ### Expanding the experiments response LaunchDarkly supports five fields for expanding the "Get 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 is included in the response. - `draftIteration` includes the 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 is not included in the response. - `analysisConfig` includes the analysis configuration for the experiment, such as the Bayesian threshold or significance threshold. For example, `expand=draftIteration,treatments` includes the `draftIteration` and `treatments` fields in the response. If fields that you request with the `expand` query parameter are empty, they are not included in the response.
Was this page helpful?
Previous

Get experiments any environment

Next
Built with

Get details about all experiments in an environment.

Filtering experiments

LaunchDarkly supports the filter query param for filtering, with the following fields:

  • flagKey filters for only experiments that use the flag with the given key.
  • metricKey filters for only experiments that use the metric 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,metricKey:page-load-ms filters for experiments for the given flag key and the given metric key which have a currently running iteration.

Expanding the experiments response

LaunchDarkly supports five fields for expanding the “Get 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 is included in the response.
  • draftIteration includes the 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 is not included in the response.
  • analysisConfig includes the analysis configuration for the experiment, such as the Bayesian threshold or significance threshold.

For example, expand=draftIteration,treatments includes the draftIteration and treatments fields in the response. If fields that you request with the expand query parameter are empty, they are not included in the response.

Authentication

Authorizationstring
API Key authentication via header

Path parameters

projectKeystringRequiredformat: "string"
The project key
environmentKeystringRequiredformat: "string"
The environment key

Query parameters

limitlongOptional
The maximum number of experiments to return. Defaults to 20.
offsetlongOptional

Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query limit.

filterstringOptionalformat: "string"

A comma-separated list of filters. Each filter is of the form field:value. Supported fields are explained above.

expandstringOptionalformat: "string"

A comma-separated list of properties that can reveal additional information in the response. Supported fields are explained above.

lifecycleStatestringOptionalformat: "string"

A comma-separated list of experiment archived states. Supports archived, active, or both. Defaults to active experiments.

Response

Experiment collection response
itemslist of objects
An array of experiments
total_countinteger
The total number of experiments in this project and environment. Does not include legacy experiments.
_linksmap from strings to objects
The location and content type of related resources

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
405
Method Not Allowed Error
429
Too Many Requests Error