---
title: "Create alert rule"
method: POST
path: "/api/v1/sdk/alerts/rules"
tags: ["public-api", "public-alerts"]
---

# Create alert rule

`POST /api/v1/sdk/alerts/rules`

## Request

- Base URL: `http://localhost:8000`
- URL: `http://localhost:8000/api/v1/sdk/alerts/rules`
- Auth: none declared

Create a new alert rule.

**SDK Usage:**
```python
from anomalyarmor import Client

client = Client()
rule = client.alerts.create_rule(
    name="Critical Freshness Alerts",
    destination_ids=["dest-uuid-1"],
    event_types=["freshness_alert"],
    severities=["critical"]
)
```

## Headers

- `Authorization` string

## Request body

- AppSharedApiV1PublicAlertsCreateAlertRuleRequest: Request to create an alert rule.
  - `name` string, required: Rule name
  - `description` string, nullable: Rule description
  - `is_active` boolean: Whether the rule is active
  - `event_types` string[], nullable: Event types to alert on
  - `severities` string[], nullable: Severity levels
  - `destination_ids` string[], required: Destination IDs
  - `tag_filter_mode` string, nullable: Tag filter mode: any or all
  - `tag_filter_tags` string[], nullable: Tags to filter by
  - `is_notify_code_authors` boolean: Whether to notify code authors when this rule triggers
  - `code_author_min_confidence` number: Minimum git blame confidence to notify (0.0-1.0)

## Response `200`

Successful Response

- StandardResponse: Standard API response wrapper.
  - `success` boolean, required
  - `data` unknown
  - `message` string, nullable
  - `error` string, nullable
  - `meta` object, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/anomalyarmor/apis/anomalyarmor-api.md) · [All operations](https://skmtc.dev/anomalyarmor/apis/anomalyarmor-api/llms.txt) · [OpenAPI document](https://skmtc.dev/anomalyarmor/apis/anomalyarmor-api/revisions/51c755fb5d0b?raw)
