Alert rules

Update alert rule

PUT
/workspaces/{workspaceId}/alert-rules/{alertRuleId}

Authorization

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

Path Parameters

workspaceId*string
Formatuuid
alertRuleId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

name*string
description?null|string
state*AlertRuleState

Value in

  • "Enabled"
  • "Disabled"
condition*
evaluationFrequency*EvaluationFrequency

Value in

  • "5m"
  • "10m"
  • "30m"
  • "1h"
  • "2h"
  • "3h"
  • "6h"
  • "12h"
  • "24h"
notificationTargetIds?null|array<string>
queryType?null||

Response Body

application/json

application/problem+json

application/problem+json

curl -X PUT "https://example.com/workspaces/00000000-0000-0000-0000-000000000001/alert-rules/a7Kd93mQx2Lp" \  -H "Content-Type: application/json" \  -d '{    "name": "High CPU usage",    "description": "Fires when the average CPU usage of a device exceeds 95 %.",    "state": "Enabled",    "condition": {      "fixed": {        "query": "metrics | where metric_name == \'cpu\' | summarize avg(value) by device_id",        "thresholdValue": 95,        "minimalTimeSeriesCount": 1,        "thresholdType": "HigherThan",        "evaluationWindow": "5m"      }    },    "evaluationFrequency": "5m",    "notificationTargetIds": [      "n4Tg81vBz6Rw"    ],    "queryType": "RawQuery"  }'

Updated 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"}