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
    • Metrics Beta
      • POSTCreate metric group
      • DELDelete metric group
      • GETGet metric group
      • GETList metric groups
      • PATCHPatch metric group
    • 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 Beta

Create metric group

POST
/api/v2/projects/:projectKey/metric-groups
POST
/api/v2/projects/:projectKey/metric-groups
$curl -X POST https://app.launchdarkly.com/api/v2/projects/projectKey/metric-groups \
> -H "Authorization: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "name": "My metric group",
> "kind": "funnel",
> "maintainerId": "569fdeadbeef1644facecafe",
> "tags": [
> "ops"
> ],
> "metrics": [
> {
> "key": "metric-key-123abc",
> "nameInGroup": "Step 1"
> }
> ]
>}'
1{
2 "_id": "bc3e5be1-02d2-40c7-9926-26d0aacd7aab",
3 "key": "metric-group-key-123abc",
4 "name": "My metric group",
5 "kind": "funnel",
6 "_links": {
7 "parent": {
8 "href": "/api/v2/projects/my-project",
9 "type": "application/json"
10 },
11 "self": {
12 "href": "/api/v2/projects/my-project/metric-groups/my-metric-group",
13 "type": "application/json"
14 }
15 },
16 "tags": [
17 "ops"
18 ],
19 "_creationDate": 1628192791148,
20 "_lastModified": 1628192791148,
21 "maintainer": {
22 "key": "569fdeadbeef1644facecafe",
23 "kind": "member",
24 "_member": {
25 "_links": {
26 "self": {
27 "href": "/api/v2/members/569f183514f4432160000007",
28 "type": "application/json"
29 }
30 },
31 "_id": "569f183514f4432160000007",
32 "role": "admin",
33 "email": "ariel@acme.com",
34 "firstName": "Ariel",
35 "lastName": "Flores"
36 },
37 "_team": {
38 "customRoleKeys": [
39 "access-to-test-projects"
40 ],
41 "key": "team-key-123abc",
42 "name": "QA Team",
43 "_links": {}
44 }
45 },
46 "metrics": [
47 {
48 "key": "metric-key-123abc",
49 "name": "Example metric",
50 "kind": "custom",
51 "_links": {
52 "self": {
53 "href": "/api/v2/metrics/my-project/my-metric",
54 "type": "application/json"
55 }
56 },
57 "_versionId": "version-id-123abc",
58 "isNumeric": true,
59 "unitAggregationType": "sum",
60 "eventKey": "event-key-123abc",
61 "nameInGroup": "Step 1",
62 "analysisUnits": [
63 "user"
64 ],
65 "randomizationUnits": [
66 "user"
67 ]
68 }
69 ],
70 "_version": 1,
71 "description": "Description of the metric group",
72 "_access": {
73 "denied": [
74 {
75 "action": "string",
76 "reason": {
77 "effect": "allow",
78 "resources": [
79 "proj/*:env/*;qa_*:/flag/*"
80 ],
81 "notResources": [
82 "string"
83 ],
84 "actions": [
85 "*"
86 ],
87 "notActions": [
88 "string"
89 ],
90 "role_name": "string"
91 }
92 }
93 ],
94 "allowed": [
95 {
96 "action": "string",
97 "reason": {
98 "effect": "allow",
99 "resources": [
100 "proj/*:env/*;qa_*:/flag/*"
101 ],
102 "notResources": [
103 "string"
104 ],
105 "actions": [
106 "*"
107 ],
108 "notActions": [
109 "string"
110 ],
111 "role_name": "string"
112 }
113 }
114 ]
115 },
116 "experiments": [
117 {
118 "key": "experiment-key-123abc",
119 "name": "Example experiment",
120 "environmentId": "1234a56b7c89d012345e678f",
121 "environmentKey": "production",
122 "creationDate": 1654104600000,
123 "_links": {
124 "parent": {
125 "href": "/api/v2/projects/my-project/environments/my-environment",
126 "type": "application/json"
127 },
128 "self": {
129 "href": "/api/v2/projects/my-project/environments/my-environment/experiments/example-experiment",
130 "type": "application/json"
131 }
132 },
133 "archivedDate": 1654104600000
134 }
135 ],
136 "experimentCount": 0,
137 "activeExperimentCount": 0,
138 "activeGuardedRolloutCount": 0
139}
Create a new metric group in the specified project
Was this page helpful?
Previous

Delete metric group

Next
Built with

Authentication

Authorizationstring
API Key authentication via header

Path parameters

projectKeystringRequiredformat: "string"
The project key

Request

This endpoint expects an object.
namestringRequired

A human-friendly name for the metric group

kindenumRequired
The type of the metric group
Allowed values:
maintainerIdstringRequired
The ID of the member who maintains this metric group
tagslist of stringsRequired
Tags for the metric group
metricslist of objectsRequired
An ordered list of the metrics in this metric group
keystringOptional
A unique key to reference the metric group
descriptionstringOptional
Description of the metric group

Response

Metric group response
_idstring
The ID of this metric group
keystring
A unique key to reference the metric group
namestring

A human-friendly name for the metric group

kindenum
The type of the metric group
Allowed values:
_linksmap from strings to objects
The location and content type of related resources
tagslist of strings
Tags for the metric group
_creationDatelong
Timestamp of when the metric group was created
_lastModifiedlong
Timestamp of when the metric group was last modified
maintainerobject
The maintainer of this metric
metricslist of objects
An ordered list of the metrics in this metric group
_versioninteger
The version of this metric group
descriptionstring
Description of the metric group
_accessobject
Details on the allowed and denied actions for this metric group
experimentslist of objects

Experiments that use this metric group. Only included if specified in the expand query parameter in a getMetricGroup request.

experimentCountinteger
The number of experiments using this metric group
activeExperimentCountinteger
The number of active experiments using this metric group
activeGuardedRolloutCountinteger
The number of active guarded rollouts using this metric group

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