---
title: "Update an alert rule"
method: PUT
path: "/alert-policies/{policyId}/rules/{ruleId}"
tags: ["Alert"]
---

# Update an alert rule

`PUT /alert-policies/{policyId}/rules/{ruleId}`

Update the state of an alert rule. Users can obtain a rule ID by calling #_get_alert_policy first.If all changes adhere to a predetermined rule, a new rule will be duplicated from the predefined one, and all changes will be applied to the newly cloned rule. As a result, users might receive a new rule ID that differs from the one provided as a path parameter.

## Path parameters

- `policyId` integer, required
- `ruleId` integer, required

## Request body

- XiqUpdateAlertRuleRequest
  - `description` string — This is a description for the alert rule.
  - `severity_id` integer — The severity identifier. The currently supported severity IDs are 1 for critical, 2 for warning, and 3 for info.
  - `trigger_type` string — The configured trigger type of the rule.
  - `duration` integer — Has value when trigger_type is "DEFERRED". The deferred duration, in seconds.
  - `time_window` integer — Has value when trigger_type is "REPEATED". The time window to count the number of repeated messages, in seconds.
  - `count` integer — Has value when trigger_type is "REPEATED". The lower bound of the number of messages required to trigger this rule.
  - `threshold` number, double — Has value when type is "METRIC". The threshold for the message.
  - `operator` string — Has value when message_metadata_type is "METRIC". The operator to compare against the threshold.

## Response `200`

OK

- XiqAlertRule — The state for a configured alert rule
  - `id` integer, required — The unique identifier
  - `message_metadata_id` integer, required — The identifier for the unique message type that corresponds to this rule.
  - `message_metadata_name` string — The display name for the message.
  - `message_metadata_type` string — The type of the message.
  - `description` string — This is a description for the alert rule.
  - `severity_id` integer, required — The severity identifier. The currently supported severity IDs are 1 for critical, 2 for warning, and 3 for info.
  - `severity_name` string — The display name for the alert severity.
  - `is_enabled` boolean, required — True if this rule is active and enabled.
  - `trigger_type` string, required — The configured trigger type of the rule.
  - `duration` integer — Has value when trigger_type is "DEFERRED". The deferred duration, in seconds.
  - `time_window` integer — Has value when trigger_type is "REPEATED". The time window to count the number of repeated messages, in seconds.
  - `count` integer — Has value when trigger_type is "REPEATED". The lower bound of the number of messages required to trigger this rule.
  - `threshold` number, double — Has value when type is "METRIC". The threshold for the message.
  - `unit` string — The unit of this threshold
  - `operator` string — Has value when message_metadata_type is "METRIC". The operator to compare against the threshold.

---

[API](https://skmtc.net/extremecloudiq/apis/extremecloud-iq-api.md) · [All operations](https://skmtc.net/extremecloudiq/apis/extremecloud-iq-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/extremecloudiq/extremecloud-iq-api/versions/5ff7ab84e8e8/schema)
