---
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 — Het value veld is verplicht wanneer <code>formulas</code> niet aanwezig is.
  - `calculation` string — Het value veld is verplicht wanneer <code>formulas</code> niet aanwezig is.
  - `comparator` string — Het value veld is verplicht wanneer <code>formulas</code> niet aanwezig is.
  - `comparison` string — Het value veld is verplicht wanneer <code>formulas</code> niet aanwezig is.
  - `threshold_value` number — Het value veld is verplicht wanneer <code>formulas</code> niet aanwezig is.
  - `formulas` object[]
    - `alert_rule_id` integer
    - `measurement_id` integer, required
    - `calculation` string, required
    - `comparator` string, required
    - `comparison` string, required
    - `period_minutes` integer, required — value dient minimaal 0 te zijn.
    - `threshold_value` number, required
    - `future` boolean, required
    - `logical` string
    - `*` object, required
      - `measurement_id` integer — The physical quantity / unit to alert for.
      - `calculation` string — Calculation to be done with measurement value(s): (min, max, ave, der, cnt) -> Minimum, Maximum, Average (mean), Derivative, Count.
      - `comparator` string — Logical comparator to perform with comparison calculation result and threshold_value (=, <, >, <=, >=).
      - `comparison` string — 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 — The threshold value beyond which the alert will be sent.
      - `period_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.
  - `calculation_minutes` string, required
  - `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'.

---

[API](https://skmtc.net/beepnl/apis/beep.md) · [All operations](https://skmtc.net/beepnl/apis/beep/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/beepnl/beep/versions/7f1e35deb524/schema)
