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
    • 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
      • POSTCreate metric
      • DELDelete metric
      • GETGet metric
      • GETList metrics
      • PATCHUpdate metric
    • 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 overviewMetrics

List metrics

GET
/api/v2/metrics/:projectKey
GET
/api/v2/metrics/:projectKey
$curl https://app.launchdarkly.com/api/v2/metrics/projectKey \
> -H "Authorization: <apiKey>"
1{
2 "items": [
3 {
4 "_id": "5902deadbeef667524a01290",
5 "_versionId": "version-id-123abc",
6 "key": "metric-key-123abc",
7 "name": "My metric",
8 "kind": "custom",
9 "_links": {
10 "parent": {
11 "href": "/api/v2/metrics/my-project",
12 "type": "application/json"
13 },
14 "self": {
15 "href": "/api/v2/metrics/my-project/my-metric",
16 "type": "application/json"
17 }
18 },
19 "tags": [],
20 "_creationDate": 1628192791148,
21 "dataSource": {
22 "key": "string",
23 "environmentKey": "string",
24 "_name": "string",
25 "_integrationKey": "string"
26 },
27 "experimentCount": 0,
28 "metricGroupCount": 0,
29 "activeExperimentCount": 2,
30 "activeGuardedRolloutCount": 1,
31 "_version": 1,
32 "_attachedFlagCount": 0,
33 "_site": {},
34 "_access": {
35 "denied": [
36 {
37 "action": "string",
38 "reason": {
39 "effect": "allow",
40 "resources": [
41 "proj/*:env/*;qa_*:/flag/*"
42 ],
43 "notResources": [
44 "string"
45 ],
46 "actions": [
47 "*"
48 ],
49 "notActions": [
50 "string"
51 ],
52 "role_name": "string"
53 }
54 }
55 ],
56 "allowed": [
57 {
58 "action": "string",
59 "reason": {
60 "effect": "allow",
61 "resources": [
62 "proj/*:env/*;qa_*:/flag/*"
63 ],
64 "notResources": [
65 "string"
66 ],
67 "actions": [
68 "*"
69 ],
70 "notActions": [
71 "string"
72 ],
73 "role_name": "string"
74 }
75 }
76 ]
77 },
78 "lastModified": {
79 "date": "2021-08-05T19:46:31.148082Z"
80 },
81 "maintainerId": "569fdeadbeef1644facecafe",
82 "_maintainer": {
83 "_links": {
84 "self": {
85 "href": "/api/v2/members/569f183514f4432160000007",
86 "type": "application/json"
87 }
88 },
89 "_id": "569f183514f4432160000007",
90 "role": "admin",
91 "email": "ariel@acme.com"
92 },
93 "description": "string",
94 "category": "Error monitoring",
95 "isNumeric": true,
96 "successCriteria": "HigherThanBaseline",
97 "unit": "string",
98 "eventKey": "Order placed",
99 "analysisUnits": [
100 "user"
101 ],
102 "filters": {
103 "type": "contextAttribute",
104 "op": "in",
105 "values": [
106 "JP"
107 ],
108 "negate": false
109 },
110 "unitAggregationType": "average",
111 "analysisType": "mean",
112 "percentileValue": 95,
113 "eventDefault": {
114 "disabled": true,
115 "value": 0
116 },
117 "lastSeen": 1,
118 "archived": true,
119 "archivedAt": 1609459200000,
120 "selector": "string",
121 "urls": [
122 "[{\"kind\":\"exact\",\"url\":\"https://www.example.com/page1\"}]"
123 ],
124 "windowStartOffset": 1,
125 "windowEndOffset": 1,
126 "winsorLowerPercentile": 1,
127 "winsorUpperPercentile": 99.5,
128 "winsorExcludeImputed": false,
129 "traceQuery": "service.name = \"checkout\"",
130 "traceValueLocation": "duration",
131 "randomizationUnits": [
132 "user"
133 ]
134 }
135 ],
136 "_links": {
137 "self": {
138 "href": "/api/v2/metrics/my-project?limit=20",
139 "type": "application/json"
140 }
141 },
142 "totalCount": 1
143}
Get a list of all metrics for the specified project. ### Filtering metrics The `filter` parameter supports the following operators: `contains`, `equals`, `anyOf`. #### Supported fields and operators You can only filter certain fields in metrics when using the `filter` parameter. Additionally, you can only filter some fields with certain operators. When you search for metrics, the `filter` parameter supports the following fields and operators: |<div style="width:120px">Field</div> |Description |Supported operators | |---|---|---| | `dataSourceKeys` | The data source that provides events for this metric (for example, "launchdarkly-hosted"). | `anyOf`, `notEquals` | | `eventKeys` | The metric event key. | `anyOf` | | `eventKind` | The metric event kind. One of `custom`, `pageview`, `click`. | `equals` | | `hasConnections` | Whether the metric has connections to experiments or guarded rollouts. One of `true`, `false`. | `equals` | | `isNumeric` | Whether the metric is numeric. One of `true`, `false`. | `equals` | | `maintainerIds` | A comma-separated list of metric maintainer IDs. | `anyOf` | | `maintainerTeamKey` | The metric maintainer team key. | `equals` | | `metricUsedIn` | Filter by where the metric is used. One of `experiments`, `guarded_rollouts`, `any`, `none`. | `equals` | | `query` | A "fuzzy" search across metric key and name. Supply a string or list of strings to the operator. | `equals` | | `tags` | The metric tags. | `contains` | | `unitAggregationType` | The metric's unit aggregation type. One of `sum`, `average`. | `equals` | | `versionIds` | The metric version number. | `anyOf` | | `view` | The view used to restrict access to the metric. | `equals` | For example, the filter `?filter=tags contains ["tag1", "tag2", "tag3"]` matches metrics that have all three tags. The documented values for `filter` query parameters are prior to URL encoding. For example, the `[` in `?filter=tags contains ["tag1", "tag2", "tag3"]` must be encoded to `%5B`. ### Expanding the metric list response LaunchDarkly supports expanding the "List metrics" response. By default, the expandable field is **not** included in the response. To expand the response, append the `expand` query parameter and add the following supported field: - `experimentCount` includes the number of experiments from the specific project that use the metric For example, `expand=experimentCount` includes the `experimentCount` field for each metric in the response.
Was this page helpful?
Previous

Update metric

Next
Built with

Get a list of all metrics for the specified project.

Filtering metrics

The filter parameter supports the following operators: contains, equals, anyOf.

Supported fields and operators

You can only filter certain fields in metrics when using the filter parameter. Additionally, you can only filter some fields with certain operators.

When you search for metrics, the filter parameter supports the following fields and operators:

Field
DescriptionSupported operators
dataSourceKeysThe data source that provides events for this metric (for example, “launchdarkly-hosted”).anyOf, notEquals
eventKeysThe metric event key.anyOf
eventKindThe metric event kind. One of custom, pageview, click.equals
hasConnectionsWhether the metric has connections to experiments or guarded rollouts. One of true, false.equals
isNumericWhether the metric is numeric. One of true, false.equals
maintainerIdsA comma-separated list of metric maintainer IDs.anyOf
maintainerTeamKeyThe metric maintainer team key.equals
metricUsedInFilter by where the metric is used. One of experiments, guarded_rollouts, any, none.equals
queryA “fuzzy” search across metric key and name. Supply a string or list of strings to the operator.equals
tagsThe metric tags.contains
unitAggregationTypeThe metric’s unit aggregation type. One of sum, average.equals
versionIdsThe metric version number.anyOf
viewThe view used to restrict access to the metric.equals

For example, the filter ?filter=tags contains ["tag1", "tag2", "tag3"] matches metrics that have all three tags.

The documented values for filter query parameters are prior to URL encoding. For example, the [ in ?filter=tags contains ["tag1", "tag2", "tag3"] must be encoded to %5B.

Expanding the metric list response

LaunchDarkly supports expanding the “List metrics” response. By default, the expandable field is not included in the response.

To expand the response, append the expand query parameter and add the following supported field:

  • experimentCount includes the number of experiments from the specific project that use the metric

For example, expand=experimentCount includes the experimentCount field for each metric in the response.

Authentication

Authorizationstring
API Key authentication via header

Path parameters

projectKeystringRequiredformat: "string"
The project key

Query parameters

expandstringOptionalformat: "string"

A comma-separated list of properties that can reveal additional information in the response.

limitlongOptional
The number of metrics to return in the response. Defaults to 20. Maximum limit is 50.
offsetlongOptional

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

sortstringOptionalformat: "string"

A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by createdAt or name.

filterstringOptionalformat: "string"
A comma-separated list of filters. This endpoint accepts filtering by `query`, `tags`, `eventKind`, `isNumeric`, `unitAggregationType`, `hasConnections`, `maintainerIds`, `maintainerTeamKey`, `view`, `dataSourceKeys`, `metricUsedIn`, `eventKeys`, and `versionIds`. To learn more about the filter syntax, read the 'Filtering metrics' section above.

Response

Metrics collection response
itemslist of objects
An array of metrics
_linksmap from strings to objects
The location and content type of related resources
totalCountinteger

Errors

401
Unauthorized Error
404
Not Found Error

A comma-separated list of filters. This endpoint accepts filtering by query, tags, eventKind, isNumeric, unitAggregationType, hasConnections, maintainerIds, maintainerTeamKey, view, dataSourceKeys, metricUsedIn, eventKeys, and versionIds. To learn more about the filter syntax, read the ‘Filtering metrics’ section above.