Alert rules

Preview alert rule condition

POST
/workspaces/{workspaceId}/alert-rules/preview-condition

Authorization

API key Alerts: 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: Alerts: read

Path Parameters

workspaceId*string
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

condition*
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/alert-rules/preview-condition" \  -H "Content-Type: application/json" \  -d '{    "condition": {      "fixed": {        "query": "metrics | where metric_name == \'cpu\' | summarize avg(value) by device_id",        "thresholdValue": 90,        "minimalTimeSeriesCount": 1,        "thresholdType": "HigherThan",        "evaluationWindow": "5m"      }    },    "from": "2026-01-12T12:00:00+00:00",    "to": "2026-01-12T14:00:00+00:00"  }'

Simulated evaluation of the condition over the requested time range.

{  "evaluationSimulation": [    {      "timestamp": "2026-01-12T13:00:00+00:00",      "isFiring": false    },    {      "timestamp": "2026-01-12T13:30:00+00:00",      "isFiring": true    },    {      "timestamp": "2026-01-12T14:00:00+00:00",      "isFiring": true    }  ]}