v2

latestOpenAPI 3.0.02026-08-073221853.1 MB
Metrics
Metrics

Create Metric

post/console/v1/metrics

Request body

namestring required

The name of the new metric, which identifies it within the system.

type'ratio' | 'mean' | 'event_count_custom' | 'event_user' | 'funnel' | 'composite' | 'composite_sum' | 'sum' | 'user_warehouse' | 'percentile' | 'latest_value' required
isVerifiedboolean

Marks the metric as verified for internal trustworthiness.

isReadOnlyboolean

Set to true to make the metric definition editable only from the Console API.

unitTypesstring[]

Array of unit types associated with the metric, such as stableID or userID.

descriptionstring

A description of the new metric, providing context and purpose.

directionality'increase' | 'decrease'

Indicates the desired change direction for the metric. Use "increase" for positive changes and "decrease" for negative changes.

isPermanentboolean

Indicates whether the metric is permanent and should not be deleted.

rollupTimeWindowstring

Time window for the metric rollup. Specify "custom" for a customized time window.

customRollUpStartnumber double

Custom time window start date in days since exposure.

customRollUpEndnumber double

Custom time window end date in days since exposure.

percentilenumber double

Percentile value for percentile metrics.

funnelCountDistinct'events' | 'users'

Specifies whether to count events or distinct users for the funnel metric.

teamstring nullable

The team associated with the metric, applicable for enterprise environments.

teamIDstring nullable

The team ID associated with the metric, applicable for enterprise environments.

dryRunboolean

Skips persisting the metric (used to validate that inputs are correct)

Example request

{
  "name": "metricName",
  "type": "sum",
  "unitTypes": [
    "stableID",
    "userID"
  ],
  "metricEvents": [
    {
      "name": "event1",
      "type": "value"
    }
  ],
  "metricComponentMetrics": [],
  "directionality": "increase",
  "rollupTimeWindow": "custom",
  "customRollUpStart": 1,
  "customRollUpEnd": 1,
  "percentile": 0.95,
  "funnelEventList": [
    {
      "name": "event1",
      "type": "event_dau"
    }
  ],
  "warehouseNative": {
    "metricDimensionLimits": [
      {
        "limit": 10
      }
    ],
    "loadingWindow": 90
  }
}

Response

Create metric response

messagestring required

A simple string explaining the result of the operation.

Example response

{
  "message": "Metric created successfully.",
  "data": {
    "id": "TestMetricCapi::sum",
    "name": "TestMetricCapi",
    "directionality": "increase",
    "type": "sum",
    "description": "Capi Metric",
    "isPermanent": false,
    "isReadOnly": false,
    "isHidden": false,
    "isVerified": false,
    "tags": [],
    "creatorName": "CONSOLE API",
    "creatorEmail": null,
    "createdTime": 1720218271796,
    "owner": {
      "name": "John Doe",
      "ownerID": "user123",
      "ownerType": "USER",
      "ownerName": "John Doe",
      "ownerEmail": "owner123@test.com"
    },
    "lineage": {
      "events": [
        "add_to_cart"
      ],
      "metrics": []
    },
    "team": "Console Team",
    "unitTypes": [
      "userID"
    ],
    "metricEvents": [
      {
        "name": "add_to_cart",
        "type": "metadata",
        "criteria": []
      }
    ],
    "permalink": "https://console.statsig.com/company_id/metrics/metrics_catalog/TestMetricCapi/sum"
  }
}