Skip to content

Creates instance of alarm rules
Stable

Request

⚠️ Android only.

Creates a new alarm rule in the enterprise, defining the conditions under which a device metric alert is triggered and where notifications are sent. Alarm rules combine a monitored metric, a threshold condition, a set of target devices or groups, and one or more notification destinations into a single automated monitoring configuration.

An alert channel must already exist before it can be referenced in a new alarm rule. Create channels first via POST /v1/enterprise/{enterprise_id}/alertchannels/ if needed.

Request body fields

Required

enterprise — UUID of the enterprise

name — Display name for the rule

metric — The device metric to monitor (e.g., battery level, connectivity status)

conditions — Threshold definition object containing

value — Numeric threshold value

unit — Unit of measurement for the threshold

comparator — Comparison operator (e.g., less than, greater than, equals)

toggle_state — Boolean for toggle-based metrics (e.g., connectivity on/off)

realert_interval — Interval in minutes before re-alerting if the condition continues to be met

Optional

description — Human-readable description of the rule's purpose

devices — Array of specific device IDs to monitor; omit to target groups instead

groups — Array of device group IDs to monitor

alert_channels — Array of alert channel IDs (UUIDs) to notify when the rule fires

action_emails — Array of email addresses to notify directly, independent of alert channels

actions — Array of actions to perform when the rule fires

is_active — Whether the rule is active immediately on creation (defaults to active if omitted)

repeat_times — Number of times to repeat the alert

Workflow

Create alert channels via POST /alertchannels/ if they don't already exist

Create the alarm rule using this endpoint, referencing the channel IDs in alert_channels

Store the UUID id from the 201 response for future get, update, or delete operations

Monitor firing activity via GET /alarmrules/{alarm_id}/alarmhistory/

Common use cases

Setting up automated alerts for low battery thresholds across a device group

Monitoring connectivity status for devices in a specific location or fleet segment

Configuring re-alert intervals for persistent conditions that require ongoing attention

Best practices

Target groups rather than individual devices where possible — group-scoped rules automatically apply to new devices added to the group

Supply both alert_channels and action_emails if notifications need to reach both a shared channel and specific individuals

Set a sensible realert_interval to avoid alert fatigue — too short an interval on frequently triggered conditions can flood notification recipients

Use a descriptive name and description so the rule's purpose is clear when auditing via GET /alarmrules/

Security
esper_cloud_api_apiKey
Path
enterprise_idstringrequired

A UUID string identifying this enterprise.

Bodyapplication/jsonrequired
idstring, (uuid)
enterprisestring, (uuid)required
devicesArray of any, (string)
groupsArray of strings
namestringrequired
descriptionstring
metricstringrequired
conditionsobjectrequired
action_emailsArray of strings, (email)
actionsArray of strings
alert_channelsArray of strings
created_onstring, (date-time)
updated_onstring, (date-time)
is_activeboolean
realert_intervalintegerrequired
repeat_timesinteger
trigger_countinteger
daily_trigger_countinteger
cURL
curl -i -X POST \
  'https://api.esper.io/_mock/openapi/v1/enterprise/{enterprise_id}/alarmrules/' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "enterprise": "796caaf9-a7de-4817-9ffa-39d04bf83de9",
    "devices": [
      null
    ],
    "groups": [
      "string"
    ],
    "name": "string",
    "description": "string",
    "metric": "string",
    "conditions": {
      "value": 0.1,
      "unit": "string",
      "comparator": "string",
      "toggle_state": true
    },
    "action_emails": [
      "user@example.com"
    ],
    "actions": [
      "string"
    ],
    "alert_channels": [
      "string"
    ],
    "created_on": "2019-08-24T14:15:22Z",
    "updated_on": "2019-08-24T14:15:22Z",
    "is_active": true,
    "realert_interval": 0,
    "repeat_times": 0,
    "trigger_count": 0,
    "daily_trigger_count": 0
  }'

Responses

successful operation

Bodyapplication/json
idstring, (uuid)
enterprisestring, (uuid)
devicesobject
groupsArray of strings
namestring
descriptionstring
metricstring
conditionsobject
action_emailsArray of strings, (email)
actionsArray of strings
alert_channelsArray of strings
created_onstring, (date-time)
updated_onstring, (date-time)
is_activeboolean
realert_intervalinteger
repeat_timesinteger
trigger_countinteger
daily_trigger_countinteger
Response
{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "enterprise": "796caaf9-a7de-4817-9ffa-39d04bf83de9", "devices": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "device_name": "string", "alias_name": "string" }, "groups": [ "string" ], "name": "string", "description": "string", "metric": "string", "conditions": { "value": 0.1, "unit": "string", "comparator": "string", "toggle_state": true }, "action_emails": [ "user@example.com" ], "actions": [ "string" ], "alert_channels": [ "string" ], "created_on": "2019-08-24T14:15:22Z", "updated_on": "2019-08-24T14:15:22Z", "is_active": true, "realert_interval": 0, "repeat_times": 0, "trigger_count": 0, "daily_trigger_count": 0 }