---
title: "Update a node-scoped monitoring alert rule."
method: PATCH
path: "/nodes/{id}/metrics/alert-rules/{rule_id}"
tags: ["Metrics"]
---

# Update a node-scoped monitoring alert rule.

`PATCH /nodes/{id}/metrics/alert-rules/{rule_id}`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/nodes/{id}/metrics/alert-rules/{rule_id}`
- Auth: HTTP bearer

Worker rules can be deleted. Control-plane defaults are update-only because
they are re-seeded on every startup (`ON CONFLICT DO NOTHING`), so a deleted
rule would silently reappear on the next restart, whereas `enabled: false`
survives re-seeding — disabling is the operation that actually means
"stop alerting on this".

## Path parameters

- `id` integer, required
- `rule_id` integer, required

## Request body

- ServiceUpdateAlertRuleRequest: Request body for updating an existing alert rule. Domain-prefixed schema name — see [`AlertRuleResponse`] for why.
  - `comparator` string, nullable
  - `enabled` boolean, nullable
  - `for_duration_secs` integer, nullable
  - `metric_name` string, nullable
  - `name` string, nullable
  - `severity` string, nullable
  - `threshold` number, double, nullable

## Response `200`

Updated alert rule

- ServiceAlertRuleResponse: Wire representation of a monitoring alert rule. Registered under a domain-prefixed OpenAPI schema name to avoid colliding with `temps-error-tracking`'s unrelated `AlertRuleResponse` (utoipa keys schemas by their bare struct name, so without `as = ...` the last crate to register would silently shadow this one in the merged spec / generated SDK).
  - `comparator` string, required
  - `deployment_id` integer, nullable
  - `enabled` boolean, required
  - `for_duration_secs` integer, required
  - `id` integer, required
  - `metric_name` string, required
  - `name` string, required
  - `node_id` integer, nullable: Node the rule is scoped to. `0` is the synthetic control-plane node (see `CONTROL_PLANE_NODE_ID`), which owns the `proxy.*` and `node.*` rules. Exactly one of `service_id`/`deployment_id`/`node_id` is set.
  - `service_id` integer, nullable
  - `severity` string, required
  - `silenced_until` string, nullable
  - `threshold` number, double, required

## Other responses

- `400`: Invalid request
- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Alert rule not found
- `500`: Internal server error

## Changes

- **2026-09-07** `cdc1afae1752`: 1 info
  - endpoint added
- **2026-09-07** `f7404eb7ac98`: 1 breaking
  - api path removed without deprecation
- **2026-08-18** `bcffda059c0d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/nodes/:id/metrics/alert-rules/:rule_id/patch.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
