---
title: "Create a new alert rule"
method: POST
path: "/projects/{project_id}/error-alert-rules"
tags: ["error-alert-rules"]
---

# Create a new alert rule

`POST /projects/{project_id}/error-alert-rules`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/error-alert-rules`
- Auth: none declared

## Path parameters

- `project_id` integer, required

## Request body

- CreateAlertRuleRequest
  - `cooldown_minutes` integer: Minimum minutes between notifications for same rule+group
  - `enabled` boolean
  - `environment_filter` integer, nullable: Optional environment ID to filter alerts
  - `error_level_filter` string, nullable: Optional error type/level filter
  - `name` string, required
  - `notification_priority` string: Notification priority: Low, Normal, High, Critical
  - `trigger_config` unknown
  - `trigger_type` string, required: Trigger type: new_issue, regression, frequency, new_user, user_count, status_change

## Response `201`

Alert rule created

- AlertRuleResponse
  - `cooldown_minutes` integer, required
  - `created_at` string, required
  - `enabled` boolean, required
  - `environment_filter` integer, nullable
  - `error_level_filter` string, nullable
  - `id` integer, required
  - `name` string, required
  - `notification_priority` string, required
  - `project_id` integer, required
  - `trigger_config` unknown, required
  - `trigger_type` string, required
  - `updated_at` string, required

## Other responses

- `400`: Validation error
- `404`: Project not found
- `409`: Project already holds the maximum number of error alert rules
- `500`: Internal server error

## Changes

- **2026-10-07** `2e9a6212c4d0`: 1 info
  - added the non-success response with the status `404`
- **2026-10-07** `1e241f2b228c`: 1 info
  - added the non-success response with the status `409`
- **2026-04-25** `774be20905f2`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/error-alert-rules/post.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)
