curl --request POST \
--url https://statsigapi.net/console/v1/metrics \
--header 'Content-Type: application/json' \
--header 'STATSIG-API-KEY: <api-key>' \
--data '
{
"name": "metricName",
"type": "sum",
"isVerified": false,
"isReadOnly": false,
"unitTypes": [
"stableID",
"userID"
],
"metricEvents": [
{
"name": "event1",
"type": "value"
}
],
"metricComponentMetrics": [],
"description": "<string>",
"directionality": "increase",
"tags": [
"tag1",
"tag2"
],
"isPermanent": false,
"rollupTimeWindow": "custom",
"customRollUpStart": 1,
"customRollUpEnd": 1,
"funnelEventList": [
{
"name": "event1",
"type": "event_dau"
}
],
"funnelCountDistinct": "events",
"warehouseNative": {
"aggregation": "count",
"metricSourceName": "<string>",
"criteria": [
{
"type": "value",
"condition": "in",
"column": "<string>",
"values": [
"<string>"
],
"nullVacuousOverride": true
}
],
"waitForCohortWindow": true,
"denominatorCriteria": [
{
"type": "value",
"condition": "in",
"column": "<string>",
"values": [
"<string>"
],
"nullVacuousOverride": true
}
],
"denominatorAggregation": "count",
"denominatorCustomRollupEnd": 123,
"denominatorCustomRollupStart": 123,
"denominatorMetricSourceName": "<string>",
"denominatorRollupTimeWindow": "<string>",
"denominatorValueColumn": "<string>",
"funnelCalculationWindow": 123,
"funnelCountDistinct": "sessions",
"funnelEvents": [
{
"criteria": [
{
"type": "value",
"condition": "in",
"column": "<string>",
"values": [
"<string>"
],
"nullVacuousOverride": true
}
],
"metricSourceName": "<string>",
"name": "<string>",
"sessionIdentifierField": "<string>"
}
],
"funnelStartCriteria": "start_event",
"metricDimensionColumns": [
"<string>"
],
"metricBakeDays": 123,
"numeratorAggregation": "count",
"valueColumn": "<string>",
"winsorizationHigh": 0.5,
"winsorizationLow": 0.5,
"cupedAttributionWindow": 123,
"onlyIncludeUsersWithConversionEvent": true,
"percentile": 123,
"valueThreshold": 123,
"cap": 123,
"rollupTimeWindow": "<string>",
"customRollUpStart": 123,
"customRollUpEnd": 123,
"allowNullRatioDenominator": true
},
"team": "<string>",
"teamID": "<string>",
"dryRun": true
}
'{
"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": "CONSOLE API"
},
"lineage": {
"events": [
"add_to_cart"
],
"metrics": []
},
"team": "Console Team",
"unitTypes": [
"userID"
],
"metricEvents": [
{
"name": "add_to_cart",
"type": "metadata",
"criteria": []
}
]
}
}curl --request POST \
--url https://statsigapi.net/console/v1/metrics \
--header 'Content-Type: application/json' \
--header 'STATSIG-API-KEY: <api-key>' \
--data '
{
"name": "metricName",
"type": "sum",
"isVerified": false,
"isReadOnly": false,
"unitTypes": [
"stableID",
"userID"
],
"metricEvents": [
{
"name": "event1",
"type": "value"
}
],
"metricComponentMetrics": [],
"description": "<string>",
"directionality": "increase",
"tags": [
"tag1",
"tag2"
],
"isPermanent": false,
"rollupTimeWindow": "custom",
"customRollUpStart": 1,
"customRollUpEnd": 1,
"funnelEventList": [
{
"name": "event1",
"type": "event_dau"
}
],
"funnelCountDistinct": "events",
"warehouseNative": {
"aggregation": "count",
"metricSourceName": "<string>",
"criteria": [
{
"type": "value",
"condition": "in",
"column": "<string>",
"values": [
"<string>"
],
"nullVacuousOverride": true
}
],
"waitForCohortWindow": true,
"denominatorCriteria": [
{
"type": "value",
"condition": "in",
"column": "<string>",
"values": [
"<string>"
],
"nullVacuousOverride": true
}
],
"denominatorAggregation": "count",
"denominatorCustomRollupEnd": 123,
"denominatorCustomRollupStart": 123,
"denominatorMetricSourceName": "<string>",
"denominatorRollupTimeWindow": "<string>",
"denominatorValueColumn": "<string>",
"funnelCalculationWindow": 123,
"funnelCountDistinct": "sessions",
"funnelEvents": [
{
"criteria": [
{
"type": "value",
"condition": "in",
"column": "<string>",
"values": [
"<string>"
],
"nullVacuousOverride": true
}
],
"metricSourceName": "<string>",
"name": "<string>",
"sessionIdentifierField": "<string>"
}
],
"funnelStartCriteria": "start_event",
"metricDimensionColumns": [
"<string>"
],
"metricBakeDays": 123,
"numeratorAggregation": "count",
"valueColumn": "<string>",
"winsorizationHigh": 0.5,
"winsorizationLow": 0.5,
"cupedAttributionWindow": 123,
"onlyIncludeUsersWithConversionEvent": true,
"percentile": 123,
"valueThreshold": 123,
"cap": 123,
"rollupTimeWindow": "<string>",
"customRollUpStart": 123,
"customRollUpEnd": 123,
"allowNullRatioDenominator": true
},
"team": "<string>",
"teamID": "<string>",
"dryRun": true
}
'{
"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": "CONSOLE API"
},
"lineage": {
"events": [
"add_to_cart"
],
"metrics": []
},
"team": "Console Team",
"unitTypes": [
"userID"
],
"metricEvents": [
{
"name": "add_to_cart",
"type": "metadata",
"criteria": []
}
]
}
}Optional header to respect review settings for mutation endpoints.
The name of the new metric, which identifies it within the system.
4 - 200^[a-zA-Z0-9_.\-()/ %:]*$"metricName"
The type of the metric. Allowed values include sum, ratio, mean, event_count_sum, composite, composite_sum, undefined, funnel, user_warehouse.
ratio, sum, composite, mean, event_count_custom, event_user, funnel, undefined, setup_incomplete, composite_sum, import_window, user_warehouse "sum"
Marks the metric as verified for internal trustworthiness.
false
Set to true to make the metric definition editable only from the Console API.
false
Array of unit types associated with the metric, such as stableID or userID.
["stableID", "userID"]An array of event definitions used to compute the metric.
Show child attributes
[{ "name": "event1", "type": "value" }]List of input metrics used to calculate the new metric for composite types.
Show child attributes
[]A description of the new metric, providing context and purpose.
1000Indicates the desired change direction for the metric. Use "increase" for positive changes and "decrease" for negative changes.
increase, decrease "increase"
Tags associated with the metric for categorization and searchability.
["tag1", "tag2"]Indicates whether the metric is permanent and should not be deleted.
false
Time window for the metric rollup. Specify "custom" for a customized time window.
"custom"
Custom time window start date in days since exposure.
1
Custom time window end date in days since exposure.
1
List of events used to create funnel metrics.
Show child attributes
Specifies whether to count events or distinct users for the funnel metric.
events, users Defines warehouse native metrics for advanced configurations.
Show child attributes
The team associated with the metric, applicable for enterprise environments.
The team ID associated with the metric, applicable for enterprise environments.
Skips persisting the metric (used to validate that inputs are correct)