analytics_metric_query
Compute declared metrics from the analytics semantic layer for the current product, bucketed by time and optionally grouped by one declared dimension.
Compute declared metrics from the analytics semantic layer for the current product, bucketed by time and optionally grouped by one declared dimension. Deterministic: entity, metric and dimension names are resolved against the semantic catalog, never generated. Prefer this over analytics_query_run whenever the question is a metric over time — no LLM, no SQL generation. Where the catalog gives an entity a `propertiesColumn`, `group_by` and a filter dimension also accept `props.<key>` to read one raw event property; property values always compare as strings.
Behavior
- HTTP
POST /analytics/metrics/query
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| to | string | • | Inclusive last day (UTC) |
| from | string | • | Inclusive first day (UTC) |
| grain | string | • | Time bucket size |
| entity | string | • | Semantic view name from the catalog |
| filters | array | — | Equality filters on declared dimensions, or on `props.<key>` event properties |
| metrics | array | • | Declared metric names to compute |
| group_by | string | — | One declared dimension, or `props.<key>`, to group by |
Response
| Field | Type | Always | Description |
|---|---|---|---|
| meta | object | • | |
| series | array | • |
Try it
Compute declared metrics from the analytics semantic layer for the current product, bucketed by time and optionally grouped by one declared dimension.