---
title: "api/alert-rules/{id} POST
Create the specified user alert rule."
method: POST
path: "/api/alert-rules"
tags: ["Api\\AlertRuleController"]
---

# api/alert-rules/{id} POST
Create the specified user alert rule.

`POST /api/alert-rules`

## Headers

- `Authorization` string
- `Content-Type` string
- `Accept` string
- `Accept-language` string

## Request body

- object
  - `name` string — The name of the alert rule.
  - `description` string — The description of the alert rule.
  - `measurement_id` integer, required — The physical quantity / unit to alert for.
  - `calculation` string, required — Calculation to be done with measurement value(s): (min, max, ave, der, cnt) -> Minimum, Maximum, Average (mean), Derivative, Count.
  - `comparator` string, required — Logical comparator to perform with comparison calculation result and threshold_value (=, <, >, <=, >=).
  - `comparison` string, required — Comparison function to perform with measurement value(s): (val, dif, abs, abs_dif) -> Value, Difference, Absolute value, Absolute value of the difference.
  - `threshold_value` number, required — The threshold value beyond which the alert will be sent.
  - `calculation_minutes` integer — The amount of minutes used for calculating the (min, max, ave, der, cnt) of the measurement value(s). If not provided, the last recorded value is used as a reference.
  - `alert_on_occurrences` integer — Amount of occurences that a calculated value goed beyond the threshold_value. If not filled the standard is 1 (immediate alert).
  - `alert_via_email` boolean — Set to false (0) if an e-mail should NOT be sent on alert. Default: true (1).
  - `webhook_url` string — URL of optional endpoint to call on alert for web hook integration.
  - `active` boolean — Set to false (0) if the alert should NOT be active. Default: true (1).
  - `exclude_months` string[] — Array of month indexes (1-12). If not filled the standard alert is 'always on'.
  - `exclude_hours` string[] — Array of hour indexes (0-23). If not filled the standard alert is 'always on'.
  - `exclude_hive_ids` string[] — Array of Hive ids. If not filled the standard alert is evaluated on 'all hives'.

## Changes

- **2022-06-20** `a87569f002e1` — 1 info
  - added the new optional `header` request parameter `Accept-language`
- **2022-06-10** `568ca15f3476` — 6 breaking, 2 warning, 1 info
  - the request property `calculation` became required
  - the request property `comparator` became required
  - the request property `comparison` became required
  - the request property `measurement_id` became required
  - …5 more

[Change history](https://skmtc.dev/beepnl/apis/beep/changes/api/alert-rules/post.md)

---

[API](https://skmtc.dev/beepnl/apis/beep.md) · [All operations](https://skmtc.dev/beepnl/apis/beep/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/beepnl/beep/revisions/f514370b41c6/schema)
