Alert rules
Create alert rule
Authorization
API key Alerts: writeAuthorizationBearer <token>
API key (sf_...) with any of the required scopes. Generate it in the Spotflow portal on the settings page.
In: header
Scope: Alerts: write
Path Parameters
workspaceId*string
Format
uuidRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
name*string
description?null|string
condition*
evaluationFrequency*EvaluationFrequency
Value in
- "5m"
- "10m"
- "30m"
- "1h"
- "2h"
- "3h"
- "6h"
- "12h"
- "24h"
firstEvaluationAt*string
Format
date-timenotificationTargetIds?null|array<string>
queryType?null||
Response Body
application/json
application/problem+json
curl -X POST "https://example.com/workspaces/00000000-0000-0000-0000-000000000001/alert-rules" \ -H "Content-Type: application/json" \ -d '{ "name": "High CPU usage", "description": "Fires when the average CPU usage of a device exceeds 90 %.", "condition": { "fixed": { "query": "metrics | where metric_name == \'cpu\' | summarize avg(value) by device_id", "thresholdValue": 90, "minimalTimeSeriesCount": 1, "thresholdType": "HigherThan", "evaluationWindow": "5m" } }, "evaluationFrequency": "5m", "firstEvaluationAt": "2026-01-12T10:00:00+00:00", "notificationTargetIds": [ "n4Tg81vBz6Rw" ], "queryType": "RawQuery" }'Created alert rule.
{ "id": "a7Kd93mQx2Lp", "name": "High CPU usage", "description": "Fires when the average CPU usage of a device exceeds 90 %.", "state": "Enabled", "type": "MetricFixedThreshold", "condition": { "fixed": { "query": "metrics | where metric_name == 'cpu' | summarize avg(value) by device_id", "thresholdValue": 90, "minimalTimeSeriesCount": 1, "thresholdType": "HigherThan", "evaluationWindow": "5m" } }, "evaluationFrequency": "5m", "createdAt": "2026-01-12T09:30:00+00:00", "firstEvaluationAt": "2026-01-12T10:00:00+00:00", "lastEvaluatedAt": "2026-01-12T14:05:12+00:00", "creatorSubjectId": "00000000-0000-0000-0000-0000000000aa", "targets": [ { "id": "n4Tg81vBz6Rw", "name": "On-call e-mail" } ], "evaluations": [ { "id": "e2Wq58hNc4Yt", "evaluatedAt": "2026-01-12T14:05:12+00:00", "evaluationScheduledAt": "2026-01-12T14:05:00+00:00", "evaluationWindowStart": "2026-01-12T14:00:00+00:00", "evaluationWindowEnd": "2026-01-12T14:05:00+00:00", "status": "Firing" } ], "hasFiringAlert": true, "queryType": "RawQuery"}