Metrics

Run a built-in metric query

POST
/workspaces/{workspaceId}/metrics/system

Runs one of the built-in queries behind the Spotflow dashboards. See Built-in Metric Queries for the available query names and the parameters each one takes.

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.

queryName*string
parameters?null|

Response Body

application/json

application/problem+json

curl -X POST "https://example.com/workspaces/00000000-0000-0000-0000-000000000001/metrics/system" \  -H "Content-Type: application/json" \  -d '{    "queryName": "DeviceCountPerFirmware",    "parameters": {      "from": "2026-01-05T00:00:00+00:00",      "to": "2026-01-12T00:00:00+00:00",      "aggregation": "1d"    }  }'

Query result as columns and rows.

{  "effectiveAggregation": "1d",  "columns": [    {      "name": "Timestamp",      "type": "DateTimeOffset"    },    {      "name": "Firmware",      "type": "String"    },    {      "name": "Version",      "type": "String"    },    {      "name": "DeviceCount",      "type": "Number"    }  ],  "rows": [    [      "2026-01-10T00:00:00+00:00",      "Thermostat application",      "2.4.0",      1622    ],    [      "2026-01-10T00:00:00+00:00",      "Thermostat application",      "2.4.1",      218    ],    [      "2026-01-11T00:00:00+00:00",      "Thermostat application",      "2.4.1",      1840    ]  ]}