v49

latestOpenAPI 3.1.0raw.githubusercontent.com2026-07-081445491.8 MB
Metric

Create metric

This endpoint is used to create a metric using a SQL string. See SQL support for a description of constructing SQL queries with examples.

post/metrics

Request body

metadataobject nullable

User-specified key/value pairs for the resource. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

sqlstring required

A sql string defining the metric.

namestring required

The name of the metric.

item_idstring required

The id of the item

descriptionstring nullable required

A description of the metric.

Example request

{
  "sql": "SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'",
  "name": "Bytes downloaded",
  "description": "Sum of bytes downloaded in fast mode"
}

Response

Created

metadataobject required

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

idstring required
namestring required
descriptionstring nullable required
status'active' | 'draft' | 'archived' required
parameter_definitionsobject[] nullable