Metrics

Query metrics

POST
/workspaces/{workspaceId}/metrics/custom

Aggregates any ingested metric, system or custom, with a query written in a subset of the Kusto Query Language (KQL). See Metrics Query Syntax for the supported operators, functions, and limits.

Authorization

API key Metrics: read
AuthorizationBearer <token>

API key (sf_...) with any of the required scopes. Generate it in the Spotflow portal on the settings page.

In: header

Scope: Metrics: read

Path Parameters

workspaceId*string
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

query*string
from*string
Formatdate-time
to*string
Formatdate-time

Response Body

application/json

application/problem+json

curl -X POST "https://example.com/workspaces/00000000-0000-0000-0000-000000000001/metrics/custom" \  -H "Content-Type: application/json" \  -d '{    "query": "metrics | where metric_name == \'unlock_duration_ms\' | summarize avg(value) by bin(timestamp, 1h)",    "from": "2026-01-12T00:00:00+00:00",    "to": "2026-01-13T00:00:00+00:00"  }'

Query result as columns and rows.

{  "columns": [    {      "name": "timestamp",      "type": "DateTimeOffset"    },    {      "name": "value",      "type": "Number"    }  ],  "rows": [    [      "2026-01-12T12:00:00+00:00",      412.7    ],    [      "2026-01-12T13:00:00+00:00",      398.2    ]  ]}