Alert Rules
Alert rules define what triggers an alert. Threshold rules watch a single metric, composite rules combine several conditions, and escalation policies re-notify when critical alerts go unresolved. All endpoints require a bearer JWT. Threshold rules need the Alert Rules settings tab, composite rules the Composite Rules tab, and escalation policies the Notifications tab. To review the alerts these rules produce, see Alerts.
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /api/v1/alert-rules | Create a threshold rule |
GET | /api/v1/alert-rules | List threshold rules |
PUT | /api/v1/alert-rules/{rule_id} | Update a threshold rule |
DELETE | /api/v1/alert-rules/{rule_id} | Delete a threshold rule |
GET | /api/v1/alert-rules/suggestions | Suggested thresholds |
POST | /api/v1/composite-rules | Create a composite rule |
GET | /api/v1/composite-rules | List composite rules |
PUT | /api/v1/composite-rules/{rule_id} | Update a composite rule |
DELETE | /api/v1/composite-rules/{rule_id} | Delete a composite rule |
GET | /api/v1/escalation-policies | List escalation policies |
POST | /api/v1/escalation-policies | Create an escalation policy |
PUT | /api/v1/escalation-policies/{policy_id} | Update an escalation policy |
DELETE | /api/v1/escalation-policies/{policy_id} | Delete an escalation policy |
Threshold rules
A threshold rule defines a warning and a critical threshold for one metric. Set warning below critical for high-side alerts (value too high), or critical below warning for low-side alerts (value too low); the two thresholds must differ.
An alert is raised once the metric reads past a threshold three readings in a row, counted across batches; a reading back in range starts the count again. One stray reading raises nothing, so a noisy metric does not alert and clear within a second. The same applies to the baseline alerts Haltless raises without a rule. Once an alert is open it escalates to critical on the next critical reading, and closes when the metric is clearly back in range.
Create a threshold rule
POST /api/v1/alert-rules
Requires an account administrator role.
| Field | Type | Required | Description |
|---|---|---|---|
machine_id | uuid | No | Target machine; omit to apply across machines |
metric_name | string | Yes | Metric to monitor (1–100 chars) |
warning_threshold | number | Yes | Warning-level threshold |
critical_threshold | number | Yes | Critical-level threshold |
opens_work_order | boolean | No | Open a work order when the rule's alert turns critical (default false). See below. |
{
"machine_id": "550e8400-e29b-41d4-a716-446655440000",
"metric_name": "temperature",
"warning_threshold": 75.0,
"critical_threshold": 85.0
}
Response: 201 Created
{
"id": "f0a1...",
"tenant_id": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"machine_id": "550e8400-e29b-41d4-a716-446655440000",
"metric_name": "temperature",
"warning_threshold": 75.0,
"critical_threshold": 85.0,
"is_active": true,
"opens_work_order": false,
"created_by": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"created_at": "2026-08-07T10:00:00Z"
}
List threshold rules
GET /api/v1/alert-rules
Accepts an optional machine_id query parameter to filter by machine. Returns an array of rules.
Update and delete
PUT /api/v1/alert-rules/{rule_id} updates the thresholds, the active flag, or opens_work_order. DELETE /api/v1/alert-rules/{rule_id} removes the rule (204 No Content). Both require an account administrator role.
{
"warning_threshold": 78.0,
"critical_threshold": 88.0,
"is_active": true
}
Suggested thresholds
GET /api/v1/alert-rules/suggestions
Returns suggested warning and critical thresholds derived from recent alert patterns. Accepts an optional language query parameter (default en). The suggestions are written with a language model, so they are one of the optional AI features: while an administrator has those switched off, this returns 403 (see Assistant). It also returns 403 when AI Insights is not included for your company, and 429 when your company has made too many AI requests in a short time or used its monthly AI allowance (see Assistant). language is a language code of up to 10 characters.
{
"suggestions": [
{
"metric_name": "temperature",
"suggested_warning": 76.0,
"suggested_critical": 86.0,
"reason": "Based on recent readings and prior alerts.",
"existing_rule_id": null
}
],
"message": null
}
Composite rules
A composite rule combines up to ten conditions with AND or OR logic, so an alert only fires when the whole expression is satisfied.
Create a composite rule
POST /api/v1/composite-rules
Requires an account administrator role.
| Field | Type | Required | Description |
|---|---|---|---|
machine_id | uuid | Yes | Target machine |
name | string | Yes | Rule name (1–255 chars) |
description | string | No | Free-text description |
expression | object | Yes | The condition expression |
expression.operator | string | No | AND or OR (default AND) |
expression.conditions | array | Yes | 1–10 conditions |
severity | string | Yes | One of info, warning, critical |
is_active | boolean | No | Whether the rule is active (default true) |
opens_work_order | boolean | No | Open a work order when the rule raises a critical alert (default false); only a critical rule does |
Each condition has a metric, a comparison op (>, >=, <, <=, ==), a value, and an optional duration_seconds (how long the condition must hold, 0 to 86400; 0 checks instantaneously).
{
"machine_id": "550e8400-e29b-41d4-a716-446655440000",
"name": "High temp and vibration",
"severity": "critical",
"expression": {
"operator": "AND",
"conditions": [
{ "metric": "temperature", "op": ">", "value": 80.0, "duration_seconds": 60 },
{ "metric": "vibration", "op": ">", "value": 7.0, "duration_seconds": 0 }
]
},
"is_active": true
}
Response: 201 Created
{
"id": "aa11...",
"machine_id": "550e8400-e29b-41d4-a716-446655440000",
"name": "High temp and vibration",
"description": null,
"expression": {
"operator": "AND",
"conditions": [
{ "metric": "temperature", "op": ">", "value": 80.0, "duration_seconds": 60 },
{ "metric": "vibration", "op": ">", "value": 7.0, "duration_seconds": 0 }
]
},
"severity": "critical",
"is_active": true,
"opens_work_order": false,
"created_at": "2026-08-07T10:00:00Z"
}
List, update, and delete
GET /api/v1/composite-rules lists composite rules and accepts an optional machine_id filter. PUT /api/v1/composite-rules/{rule_id} updates a rule and DELETE /api/v1/composite-rules/{rule_id} removes it. Update and delete require an account administrator role.
Open a work order on a critical alert
With opens_work_order: true, a threshold rule opens a work order when it raises a critical alert or its open alert turns critical, and a composite rule when it raises a (critical) alert. Nobody has to be watching.
The work order is critical, has opened_by_rule: true, and carries the evidence (the machine, the reading, the threshold and when) in its description. Like any work order from an alert, its first steps are the alert's playbook, and once completed it gets a fix check.
It opens once per condition: not for an alert that already has a work order, and not while a work order for the same machine and the same metric (or composite rule) is still open or in_progress. Once that work is done, the next occurrence opens a new one. A work order that cannot be opened is logged; it never costs the alert or its readings.
Escalation policies
An escalation policy re-notifies a chosen notification channel when an alert of a given severity remains open past a wait period.
List and create
GET /api/v1/escalation-policies returns all policies. POST /api/v1/escalation-policies creates one and requires an account administrator role.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Policy name (1–200 chars) |
severity | string | Yes | One of critical, warning, info |
wait_minutes | integer | Yes | Delay before escalating (1–1440) |
channel_id | uuid | Yes | Notification channel to escalate to |
is_active | boolean | No | Whether the policy is active (default true) |
{
"name": "Critical after 15 minutes",
"severity": "critical",
"wait_minutes": 15,
"channel_id": "bb22...",
"is_active": true
}
Response: 201 Created
{
"id": "cc33...",
"tenant_id": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"name": "Critical after 15 minutes",
"severity": "critical",
"wait_minutes": 15,
"channel_id": "bb22...",
"is_active": true,
"created_at": "2026-08-07T10:00:00Z",
"updated_at": "2026-08-07T10:00:00Z"
}
The channel_id references a notification channel; a channel that is not yours returns 404. A company can have up to 50 escalation policies (422 beyond that). See Notifications.
Update and delete
PUT /api/v1/escalation-policies/{policy_id} updates a policy and DELETE /api/v1/escalation-policies/{policy_id} removes it (204 No Content). Both require an account administrator role.