---
title: "Create metric group"
method: POST
path: "/api/v2/projects/{projectKey}/metric-groups"
tags: ["Metrics (beta)"]
---

# Create metric group

`POST /api/v2/projects/{projectKey}/metric-groups`

Create a new metric group in the specified project

## Path parameters

- `projectKey` string, string, required — The project key

## Request body

- MetricGroupPost
  - `key` string — A unique key to reference the metric group
  - `name` string, required — A human-friendly name for the metric group
  - `kind` 'funnel' | 'standard' | 'guardrail', required — The type of the metric group
  - `description` string — Description of the metric group
  - `maintainerId` string, required — The ID of the member who maintains this metric group
  - `tags` string[], required — Tags for the metric group
  - `metrics` MetricInMetricGroupInput[], required — An ordered list of the metrics in this metric group
    - `key` string, required — The metric key
    - `nameInGroup` string, required — Name of the metric when used within the associated metric group. Can be different from the original name of the metric

## Response `201`

Metric group response

- MetricGroupRep
  - `_id` string, required — The ID of this metric group
  - `key` string, required — A unique key to reference the metric group
  - `name` string, required — A human-friendly name for the metric group
  - `kind` 'funnel' | 'standard' | 'guardrail', required — The type of the metric group
  - `description` string — Description of the metric group
  - `_links` object, required — The location and content type of related resources
  - `_access` Access
    - `denied` AccessDenied[], required
      - `action` string, required
      - `reason` AccessDeniedReason, required
        - `resources` string[] — Resource specifier strings
        - `notResources` string[] — Targeted resources are the resources NOT in this list. The <code>resources</code> and <code>notActions</code> fields must be empty to use this field.
        - `actions` ActionSpecifier[] — Actions to perform on a resource
        - `notActions` ActionSpecifier[] — Targeted actions are the actions NOT in this list. The <code>actions</code> and <code>notResources</code> fields must be empty to use this field.
        - `effect` 'allow' | 'deny', required — Whether this statement should allow or deny actions on the resources.
        - `role_name` string
    - `allowed` AccessAllowedRep[], required
      - `action` string, required
      - `reason` AccessAllowedReason, required
        - `resources` string[] — Resource specifier strings
        - `notResources` string[] — Targeted resources are the resources NOT in this list. The <code>resources</code> and <code>notActions</code> fields must be empty to use this field.
        - `actions` ActionSpecifier[] — Actions to perform on a resource
        - `notActions` ActionSpecifier[] — Targeted actions are the actions NOT in this list. The <code>actions</code> and <code>notResources</code> fields must be empty to use this field.
        - `effect` 'allow' | 'deny', required — Whether this statement should allow or deny actions on the resources.
        - `role_name` string
  - `tags` string[], required — Tags for the metric group
  - `_creationDate` integer, required
  - `_lastModified` integer, required
  - `maintainer` MaintainerRep, required
    - `member` MemberSummary
      - `_links` object, required — The location and content type of related resources
      - `_id` string, required — The member's ID
      - `firstName` string — The member's first name
      - `lastName` string — The member's last name
      - `role` string, required — The member's base role. If the member has no additional roles, this role will be in effect.
      - `email` string, required — The member's email address
    - `team` MemberTeamSummaryRep
      - `customRoleKeys` string[], required — A list of keys of the custom roles this team has access to
      - `key` string, required — The team key
      - `_links` object
      - `name` string, required — The team name
  - `metrics` MetricInGroupRep[], required — An ordered list of the metrics in this metric group
    - `key` string, required — The metric key
    - `_versionId` string — The version ID of the metric
    - `name` string, required — The metric name
    - `kind` 'pageview' | 'click' | 'custom', required — The kind of event the metric tracks
    - `isNumeric` boolean — For custom metrics, whether to track numeric changes in value against a baseline (<code>true</code>) or to track a conversion when an end user takes an action (<code>false</code>).
    - `unitAggregationType` 'sum' | 'average' — The type of unit aggregation to use for the metric
    - `eventKey` string — The event key sent with the metric. Only relevant for custom metrics.
    - `_links` object, required — The location and content type of related resources
    - `nameInGroup` string — Name of the metric when used within the associated metric group. Can be different from the original name of the metric. Required if and only if the metric group is a <code>funnel</code>.
    - `randomizationUnits` string[] — The randomization units for the metric
  - `_version` integer, required — The version of this metric group
  - `experiments` DependentExperimentRep[]
    - `key` string, required — The experiment key
    - `name` string, required — The experiment name
    - `environmentId` string, required — The environment ID
    - `environmentKey` string, required — The environment key
    - `creationDate` integer, required
    - `archivedDate` integer
    - `_links` object, required — The location and content type of related resources
  - `experimentCount` integer — The number of experiments using this metric group
  - `activeExperimentCount` integer — The number of active experiments using this metric group
  - `activeGuardedRolloutCount` integer — The number of active guarded rollouts using this metric group

## Other responses

- `400` — Invalid request
- `401` — Invalid access token
- `403` — Forbidden
- `404` — Invalid resource identifier
- `405` — Method not allowed
- `429` — Rate limited

## Changes

- **2026-02-28** `69c5c9aafe78` — 3 info
  - added the optional property `activeExperimentCount` to the response with the `201` status
  - added the optional property `activeGuardedRolloutCount` to the response with the `201` status
  - added the optional property `metrics/items/eventKey` to the response with the `201` status
- **2025-07-08** `b2724c5174d1` — 1 warning, 3 info
  - added the new `guardrail` enum value to the `kind` response property for the response status `201`
  - the request property `key` became optional
  - added the new `guardrail` enum value to the request property `kind`
  - added the new `standard` enum value to the request property `kind`

[Change history](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api/changes/api/v2/projects/:projectKey/metric-groups/post.md)

---

[API](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api.md) · [All operations](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/launchdarkly/launchdarkly-rest-api/revisions/69c5c9aafe78/schema)
