> For the complete documentation index, see [llms.txt](https://docs.visualsentinel.com/llms.txt)

# Alert Rules API

Configure alerting conditions and thresholds. This page lists all 5 endpoints in the Alert Rules area of the Visual Sentinel REST API.

Base URL: `https://visualsentinel.com`. Unless an endpoint says otherwise it accepts an API key or a session cookie, see [Authentication](https://docs.visualsentinel.com/guides/authentication.md). Most error responses use the [ErrorResponse](https://docs.visualsentinel.com/reference/models/error-response.md) shape, see [Errors](https://docs.visualsentinel.com/guides/errors.md) and [Rate limits](https://docs.visualsentinel.com/guides/rate-limits.md).

## Endpoints

- [List alert rules](#list-alert-rules): `GET /api/alert-rules`
- [Create alert rule](#create-alert-rule): `POST /api/alert-rules`
- [Get alert rule](#get-alert-rule): `GET /api/alert-rules/{id}`
- [Update alert rule](#update-alert-rule): `PUT /api/alert-rules/{id}`
- [Delete alert rule](#delete-alert-rule): `DELETE /api/alert-rules/{id}`

## List alert rules

`GET /api/alert-rules`

Get all alert rules for the organization. Each rule carries supported and unsupportedReason; unsupported rules are never evaluated.

**Parameters**

- `page` (query, integer, optional): Default: `1`.
- `limit` (query, integer, optional): Default: `20`.

**Responses**

- `200`: List of alert rules. Body: [AlertRuleListResponse](https://docs.visualsentinel.com/reference/models/alert-rule-list-response.md).

## Create alert rule

`POST /api/alert-rules`

Create a rule that alerts when one monitor's response time or uptime crosses a threshold. monitorId is required. Down alerts, repeated failures and SSL expiry are built-in alerts, so rules do not accept those conditions.

Request body (required): [CreateAlertRuleRequest](https://docs.visualsentinel.com/reference/models/create-alert-rule-request.md).

**Responses**

- `201`: Alert rule created. Body: [AlertRuleResponse](https://docs.visualsentinel.com/reference/models/alert-rule-response.md).
- `400`: Validation failed, or the request uses a condition alert rules do not support (status_change, consecutive_failures, ssl_expiry). Those are covered by the built-in alerts. Body: [AlertRuleConditionNotSupportedResponse](https://docs.visualsentinel.com/reference/models/alert-rule-condition-not-supported-response.md) or `ErrorResponse`.
- `404`: Monitor not found in this organization.

## Get alert rule

`GET /api/alert-rules/{id}`

Get details of a specific alert rule.

**Parameters**

- `id` (path, string (uuid), required)

**Responses**

- `200`: Alert rule details. Body: [AlertRuleResponse](https://docs.visualsentinel.com/reference/models/alert-rule-response.md).

## Update alert rule

`PUT /api/alert-rules/{id}`

Update an existing alert rule.

**Parameters**

- `id` (path, string (uuid), required)

Request body (required): [UpdateAlertRuleRequest](https://docs.visualsentinel.com/reference/models/update-alert-rule-request.md).

**Responses**

- `200`: Alert rule updated. Body: [AlertRuleResponse](https://docs.visualsentinel.com/reference/models/alert-rule-response.md).
- `400`: Validation failed, or the request uses a condition alert rules do not support (status_change, consecutive_failures, ssl_expiry). Those are covered by the built-in alerts. Body: [AlertRuleConditionNotSupportedResponse](https://docs.visualsentinel.com/reference/models/alert-rule-condition-not-supported-response.md) or `ErrorResponse`.
- `404`: Alert rule or monitor not found.

## Delete alert rule

`DELETE /api/alert-rules/{id}`

Delete an alert rule.

**Parameters**

- `id` (path, string (uuid), required)

**Responses**

- `200`: Alert rule deleted.

## Data models

Request and response shapes these endpoints use: [AlertRuleListResponse](https://docs.visualsentinel.com/reference/models/alert-rule-list-response.md), [CreateAlertRuleRequest](https://docs.visualsentinel.com/reference/models/create-alert-rule-request.md), [AlertRuleResponse](https://docs.visualsentinel.com/reference/models/alert-rule-response.md), [AlertRuleConditionNotSupportedResponse](https://docs.visualsentinel.com/reference/models/alert-rule-condition-not-supported-response.md), [UpdateAlertRuleRequest](https://docs.visualsentinel.com/reference/models/update-alert-rule-request.md).

Generated from the OpenAPI 3.1 specification at [https://docs.visualsentinel.com/openapi.json](https://docs.visualsentinel.com/openapi.json), the same file the interactive reference reads.
