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

Short display name (e.g. Purchases per user). Put the definition in description.

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

Markdown. Put context here, not in the name.

Maximum string length: 10000
tags
string[]

Tags for filtering and grouping. Use these instead of encoding groups in names.

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

Resource created

metric
object
required