Skip to main content
POST
cURL

Authorizations

Authorization
string
header
required

If using Bearer auth, pass the Secret Key as the token:

Body

application/json
datasourceId
string
required

ID for the DataSource

name
string
required

Name of the metric

type
enum<string>
required

Type of metric. See Metrics documentation

Available options:
binomial,
count,
duration,
revenue
managedBy
enum<string>

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.

Available options:
,
api
owner
string

The userId or email address of the owner. If an email address is provided, it will be used to look up the userId of the matching organization member. If an ID is provided, it will be validated as existing in the organization.

description
string

Description of the metric

Maximum string length: 10000
tags
string[]

List of tags

projects
string[]

List of project IDs for projects that can access this metric

archived
boolean
behavior
object
sql
object

Preferred way to define SQL. Only one of sql, sqlBuilder or mixpanel allowed, and at least one must be specified.

sqlBuilder
object

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.

mixpanel
object

Only use for MixPanel (non-SQL) Data Sources. Only one of sql, sqlBuilder or mixpanel allowed, and at least one must be specified.

Response

200 - application/json

Resource created

metric
object
required