curl -X POST https://api.growthbook.io/api/v1/metrics \
-d '{ "datasourceId": "ds_abc123", ... }'
-u secret_abc123DEF456:{
"metric": {
"id": "<string>",
"managedBy": "",
"dateCreated": "<string>",
"dateUpdated": "<string>",
"owner": "<string>",
"datasourceId": "<string>",
"name": "<string>",
"description": "<string>",
"type": "binomial",
"tags": [
"<string>"
],
"projects": [
"<string>"
],
"archived": true,
"behavior": {
"goal": "increase",
"windowSettings": {
"type": "none",
"delayValue": 123,
"delayUnit": "minutes",
"windowValue": 123,
"windowUnit": "minutes"
},
"riskThresholdSuccess": 123,
"riskThresholdDanger": 123,
"minPercentChange": 123,
"maxPercentChange": 123,
"minSampleSize": 123,
"targetMDE": 123,
"cappingSettings": {
"type": "none",
"value": 123,
"ignoreZeros": true
},
"cap": 123,
"capping": "absolute",
"capValue": 123,
"priorSettings": {
"override": true,
"proper": true,
"mean": 123,
"stddev": 123
},
"conversionWindowStart": 123,
"conversionWindowEnd": 123
},
"sql": {
"identifierTypes": [
"<string>"
],
"conversionSQL": "<string>",
"userAggregationSQL": "<string>",
"denominatorMetricId": "<string>"
},
"sqlBuilder": {
"identifierTypeColumns": [
{
"identifierType": "<string>",
"columnName": "<string>"
}
],
"tableName": "<string>",
"valueColumnName": "<string>",
"timestampColumnName": "<string>",
"conditions": [
{
"column": "<string>",
"operator": "<string>",
"value": "<string>"
}
]
},
"mixpanel": {
"eventName": "<string>",
"eventValue": "<string>",
"userAggregation": "<string>",
"conditions": [
{
"property": "<string>",
"operator": "<string>",
"value": "<string>"
}
]
}
}
}Documentation Index
Fetch the complete documentation index at: https://growthbook-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
If using Bearer auth, pass the Secret Key as the token:
curl https://api.growthbook.io/api/v1 \
-H "Authorization: Bearer secret_abc123DEF456"ID for the DataSource
Name of the metric
Type of metric. See Metrics documentation
binomial, count, duration, revenue Where this metric must be managed from. If not set (empty string), it can be managed from anywhere. If set to "api", it can be managed via the API only.
, api Description of the metric
List of tags
List of project IDs for projects that can access this metric
Show child attributes
Preferred way to define SQL. Only one of sql, sqlBuilder or mixpanel allowed, and at least one must be specified.
Show child attributes
An alternative way to specify a SQL metric, rather than a full query. Using sql is preferred to sqlBuilder. Only one of sql, sqlBuilder or mixpanel allowed, and at least one must be specified.
Show child attributes
Only use for MixPanel (non-SQL) Data Sources. Only one of sql, sqlBuilder or mixpanel allowed, and at least one must be specified.
Show child attributes
Success
Show child attributes
curl -X POST https://api.growthbook.io/api/v1/metrics \
-d '{ "datasourceId": "ds_abc123", ... }'
-u secret_abc123DEF456:{
"metric": {
"id": "<string>",
"managedBy": "",
"dateCreated": "<string>",
"dateUpdated": "<string>",
"owner": "<string>",
"datasourceId": "<string>",
"name": "<string>",
"description": "<string>",
"type": "binomial",
"tags": [
"<string>"
],
"projects": [
"<string>"
],
"archived": true,
"behavior": {
"goal": "increase",
"windowSettings": {
"type": "none",
"delayValue": 123,
"delayUnit": "minutes",
"windowValue": 123,
"windowUnit": "minutes"
},
"riskThresholdSuccess": 123,
"riskThresholdDanger": 123,
"minPercentChange": 123,
"maxPercentChange": 123,
"minSampleSize": 123,
"targetMDE": 123,
"cappingSettings": {
"type": "none",
"value": 123,
"ignoreZeros": true
},
"cap": 123,
"capping": "absolute",
"capValue": 123,
"priorSettings": {
"override": true,
"proper": true,
"mean": 123,
"stddev": 123
},
"conversionWindowStart": 123,
"conversionWindowEnd": 123
},
"sql": {
"identifierTypes": [
"<string>"
],
"conversionSQL": "<string>",
"userAggregationSQL": "<string>",
"denominatorMetricId": "<string>"
},
"sqlBuilder": {
"identifierTypeColumns": [
{
"identifierType": "<string>",
"columnName": "<string>"
}
],
"tableName": "<string>",
"valueColumnName": "<string>",
"timestampColumnName": "<string>",
"conditions": [
{
"column": "<string>",
"operator": "<string>",
"value": "<string>"
}
]
},
"mixpanel": {
"eventName": "<string>",
"eventValue": "<string>",
"userAggregation": "<string>",
"conditions": [
{
"property": "<string>",
"operator": "<string>",
"value": "<string>"
}
]
}
}
}