For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Metrics

A focused interface for reading approved KPI time series.

Use the Metric API when the business question starts with one approved KPI: total revenue, units sold, average order value, or another named metric. A metric fixes the governed measure and time axis; the caller chooses the time grain, optional dimensions, filters, and result window.

This is the smallest and safest query contract for KPI tiles, alerts, scorecards, and repeated reporting.

Endpoint: GET or POST /api/v1/query/metric/{metric_name}

Discover metrics

Call GET /api/v1/metadata/semantic and find entries with kind: METRIC. Use the exact metric name in the URL and its declared dimension aliases in dimensions.

Every metric exposes:

Member
Purpose

measure

The metric's governed KPI. Always included.

ts

The metric's time axis. Always included and bucketed.

Other dimensions

Optional slices, such as product_category or store_region.

Segments

Optional predefined filters. Automatically applied when declared by the metric.

The metric's default_granularity is used when the caller does not provide one.

Simple query with GET

Use GET when you only need a grain, dimension slices, timezone, and pagination.

{
  "name": "store_revenue",
  "kind": "METRIC",
  "default_granularity": "day",
  "columns": [
    { "name": "measure", "kind": "measure", "ltype": "number" },
    { "name": "ts", "kind": "dimension", "ltype": "time" },
    { "name": "product_category", "kind": "dimension", "ltype": "string" },
    { "name": "sales_channel", "kind": "dimension", "ltype": "string" },
    { "name": "orders_delivered", "kind": "segment", "ltype": "boolean" }
  ]
}

Slice dimensions use plain names in the Metric API (product_category) but qualified names in REST and SQL (store_revenue.product_category).

You cannot turn off auto-included measure, ts, or metric segments. For period-over-period comparison, cross-model mixing, or queries without time bucketing, use REST directly.

GET: no filters

Param
Default
Description

dimensions

(none)

Comma-separated alias names (not qualified)

granularity

model's default_granularity

Time bucket

timezone

UTC

IANA timezone

limit

10,000

Max 50,000

offset

0

Rows to skip

POST: with filters

Dimensions use alias names (product_category). Filter member fields always use qualified names (store_revenue.sales_channel). Filter syntax matches REST.

What GET expands to

GET /api/v1/query/metric/store_revenue?dimensions=product_category&granularity=day is equivalent to:

Guardrails

  • The metric name must exist; otherwise the API returns 404.

  • Dimension aliases belong to that metric; arbitrary semantic dimensions are rejected.

  • An unknown dimension or invalid order member returns 400 and lists available values.

  • Consumers cannot replace or suppress the metric's measure, time axis, or declared segments.

  • Both GET and POST return 202 Accepted and use the shared query lifecycle.

If a consumer needs multiple independent measures in one result, use REST, Semantic SQL, or GraphQL.

Next steps

  • Use REST when a KPI request needs broader query control.

  • Create a Perspectives to share a successful result through a stable URL.

Last updated

Was this helpful?