---
title: "Create alert rule"
method: POST
path: "/api/v1/projects/{projectId}/alerts/rules"
tags: ["Alerts"]
---

# Create alert rule

`POST /api/v1/projects/{projectId}/alerts/rules`

## Request

- Base URL: `http://localhost:8080`
- URL: `http://localhost:8080/api/v1/projects/{projectId}/alerts/rules`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Defines what to watch, the threshold that fires it, and where to send it.

## Path parameters

- `projectId` string, uuid, required

## Request body

- AlertRuleRequest
  - `name` string, required
  - `description` string
  - `alertType` string, required: The id of a condition listed by GET /api/v1/alert-conditions
  - `severity` 'INFO' | 'WARNING' | 'CRITICAL'
  - `channel` string: The id of a channel listed by GET /api/v1/alert-channels; IN_APP when left out
  - `channelConfig` object: Settings named by the channel's configSchema. On update a setting left out is kept; a blank one clears it, except a secret, which is kept so an edit need not re-enter it.
  - `thresholdValue` number, double: Required when the condition's configSchema lists it
  - `windowMinutes` integer
  - `endpointId` string, uuid
  - `enabled` boolean
  - `muted` boolean
  - `snoozedUntil` string, date-time

## Response `201`

Rule created

---

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