Skip to content

Reference

Alarms

REST API reference for Alarms: manage alarm rules and alarm instances, and test rules and their notifications. 18 operations.

Reference17 min read

For the base URL, authentication and errors, see the REST API overview.

GET /v1/users/{user}/alarms/instances ​

  • Request: GET /v1/users/{user}/alarms/instances
  • Operation: ListAlarmInstances
  • Operation ID: Alarm_ListInstances
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes

Example request

bash
curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

POST /v1/users/{user}/alarms/instances ​

  • Request: POST /v1/users/{user}/alarms/instances
  • Operation: CreateAlarmInstance
  • Operation ID: Alarm_CreateInstance
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes

Request body (application/json, required)

FieldTypeRequiredConstraintsDescription
alarmobjectyes
alarm.rulestringnoPattern: ^[a-zA-Z0-9_-]{1,32}$A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters.
annotationstringnoMaximum length: 512
asset_groupstringnoPattern: ^[a-zA-Z0-9_-]{1,32}$A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters.
asset_typestringnoPattern: ^[a-zA-Z0-9_-]{1,32}$A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters.
descriptionstringnoMaximum length: 255A brief description of the resource, providing context or additional information, limited to 255 characters.
evaluationobjectyes
evaluation.last_completednumberno
evaluation.last_valuesobjectno
evaluation.total_durationnumberno
instancestringyesPattern: ^[a-zA-Z0-9_-]{1,32}$A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters.
namestringyesMaximum length: 255The name of the resource, limited to 255 characters. It can include any character.
originobjectyes
origin.idstringyesPattern: ^[a-zA-Z0-9_-]{1,32}$A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters.
origin.namestringyesMaximum length: 255The name of the resource, limited to 255 characters. It can include any character.
origin.sourcestringyesOne of: device, user
reactivationobjectno
reactivation.timespanobjectno
reactivation.timespan.magnitudestringnoOne of: second, minute, hour, day, week, month, year
reactivation.timespan.valuenumbernoMinimum: 0
reactivation.typestringnoOne of: none, timespan
severitynumberyesRange: 0 to 4
statenumberyesRange: 0 to 4

Example request (skeleton generated from the schema: required fields only, neutral values)

bash
curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "instance": "",
  "alarm": {},
  "name": "",
  "state": 0,
  "severity": 0,
  "origin": {
    "source": "device",
    "id": "",
    "name": ""
  },
  "evaluation": {}
}'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

GET /v1/users/{user}/alarms/instances/stats ​

  • Request: GET /v1/users/{user}/alarms/instances/stats
  • Operation: ReadAlarmInstanceStats
  • Operation ID: Alarm_ReadInstanceStats
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes

Example request

bash
curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances/stats' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

GET /v1/users/{user}/alarms/instances/{instance} ​

  • Request: GET /v1/users/{user}/alarms/instances/
  • Operation: ReadAlarmInstanceConfig
  • Operation ID: Alarm_ReadInstanceConfig
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
instancepathstringyes

Example request

bash
curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances/YOUR_INSTANCE' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

PUT /v1/users/{user}/alarms/instances/{instance} ​

  • Request: PUT /v1/users/{user}/alarms/instances/
  • Operation: UpdateAlarmInstance
  • Operation ID: Alarm_UpdateInstance
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
instancepathstringyes

Request body (application/json, required)

Mostly used to change the state of an alarm instance: 0 none, 1 activated, 2 acknowledged, 3 latched, 4 shelved, 5 cleared (final). 'reactivation' sets when an acknowledged, shelved or latched alarm becomes active again if the condition persists.

FieldTypeRequiredConstraintsDescription
annotationstringnoMaximum length: 512
descriptionstringnoMaximum length: 255A brief description of the resource, providing context or additional information, limited to 255 characters.
namestringnoMaximum length: 255The name of the resource, limited to 255 characters. It can include any character.
reactivationobjectno
reactivation.timespanobjectno
reactivation.timespan.magnitudestringnoOne of: second, minute, hour, day, week, month, year
reactivation.timespan.valuenumbernoMinimum: 0
reactivation.typestringnoOne of: none, timespan
statenumbernoRange: 0 to 6

Example request: Acknowledge

bash
curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances/YOUR_INSTANCE' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "annotation": "Technician on the way",
  "state": 2
}'

Example body: Clear

json
{
  "annotation": "Fan replaced",
  "state": 5
}

Example body: Shelve for 4 hours

json
{
  "annotation": "Planned maintenance",
  "reactivation": {
    "timespan": {
      "magnitude": "hour",
      "value": 4
    },
    "type": "timespan"
  },
  "state": 4
}

Responses

StatusDescription
200ok
401unauthorized
403forbidden

DELETE /v1/users/{user}/alarms/instances/{instance} ​

  • Request: DELETE /v1/users/{user}/alarms/instances/
  • Operation: DeleteAlarmInstance
  • Operation ID: Alarm_DeleteInstance
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
instancepathstringyes

Example request

bash
curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances/YOUR_INSTANCE' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

PUT /v1/users/{user}/alarms/instances/{instance}/projects ​

  • Request: PUT /v1/users/{user}/alarms/instances/{instance}/projects
  • Operation: UpdateAlarmInstanceProjects
  • Operation ID: Alarm_UpdateInstanceProjects
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
instancepathstringyes

Request body (application/json, required)

FieldTypeRequiredConstraintsDescription
(body)array of stringnoProjects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; [] removes it from every project.

Example request: No projects

bash
curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/instances/YOUR_INSTANCE/projects' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '[]'

Example body: One project

json
[
  "YOUR_USER@greenhouse"
]

Example body: Two projects

json
[
  "YOUR_USER@greenhouse",
  "YOUR_USER@maintenance"
]

Responses

StatusDescription
200ok
401unauthorized
403forbidden

GET /v1/users/{user}/alarms/rules ​

  • Request: GET /v1/users/{user}/alarms/rules
  • Operation: ListAlarmRules
  • Operation ID: Alarm_ListRules
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes

Example request

bash
curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

Response example (200)

json
[
  {
    "created": 1792263090787,
    "description": "Mean temperature above 30 for 3 checks in a row, per device",
    "enabled": true,
    "modified": 1792263090787,
    "name": "Greenhouse too hot",
    "rule": "greenhouse_hot"
  },
  {
    "created": 1792263090787,
    "description": "Any device of the smart_meter product disconnected",
    "enabled": true,
    "modified": 1792263090787,
    "name": "Meter offline",
    "rule": "meter_offline"
  },
  {
    "created": 1792263090787,
    "description": "Hourly max depth of each well above its own limit: the 'limits' property of the device, or of its asset type, asset group or product when the device has none",
    "enabled": true,
    "modified": 1792263090787,
    "name": "Water table too deep",
    "rule": "well_too_deep"
  },
  {
    "created": 1792263090787,
    "description": "Battery level reported in the 'battery' property below 15%, devices of the 'field_sensors' group",
    "enabled": true,
    "modified": 1792263090787,
    "name": "Low battery",
    "rule": "low_battery"
  }
]

POST /v1/users/{user}/alarms/rules ​

  • Request: POST /v1/users/{user}/alarms/rules
  • Operation: CreateAlarmRule
  • Operation ID: Alarm_CreateRule
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes

Request body (application/json, required)

An alarm rule checks its data sources every check_interval and raises one alarm instance per device that meets the activation conditions. Sources: 'bucket' (bucket data, optionally aggregated and grouped by device), 'device_property' (a device property, resolved with type / group / product inheritance) and 'device_status' (connection.active, connection.ts). Sources can be narrowed with project, product, asset_type, asset_group or device. Conditions read '<source name>.<field>' and compare it with above, below, equal, not_equal (value), inside, outside (min, max), present or absent; a comparison on a field the device does not have is false (a bucket source with several mapping fields keeps a device that only has some of them), so 'a above 5 or b above 5' works on devices without b, and a device is skipped only when it has none of the fields the conditions read or misses a whole source (unless present / absent are used); values are strings, and can be expressions over other sources of the same device (e.g. 'limits.value.max_depth_m', a per-device threshold from a device_property source). device_property fields are paths in the property document: 'value.<field>'. Confirmation: immediate, sequence (N detections in a row) or timespan. Notifications call endpoints.

FieldTypeRequiredConstraintsDescription
configobjectno
config.activationobjectno
config.check_intervalobjectno
config.check_interval.magnitudestringnoOne of: second, minute, hour, day, week, month, year
config.check_interval.valuenumbernoMinimum: 0
config.dataobjectno
config.descriptionstringnoMaximum length: 255A brief description of the resource, providing context or additional information, limited to 255 characters.
config.namestringnoMaximum length: 255The name of the resource, limited to 255 characters. It can include any character.
config.normalizationobjectno
config.reminderobjectno
config.rulestringnoPattern: ^[a-zA-Z0-9_-]{1,32}$A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters.
config.severitynumbernoRange: 0 to 4
descriptionstringnoMaximum length: 255A brief description of the resource, providing context or additional information, limited to 255 characters.
enabledbooleanyes
namestringyesMaximum length: 255The name of the resource, limited to 255 characters. It can include any character.
rulestringyesPattern: ^[a-zA-Z0-9_-]{1,32}$A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters.

Example request: Bucket threshold

bash
curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "above",
          "field": "climate.temperature",
          "operator": "and",
          "type": "value_check",
          "value": "30"
        }
      ],
      "confirmation": {
        "mode": "sequence",
        "sequence": {
          "value": 3
        }
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "minute",
      "value": 5
    },
    "data": {
      "sources": [
        {
          "bucket": {
            "aggregation": {
              "period": "5m",
              "type": "mean"
            },
            "group_by": [
              "device"
            ],
            "id": "greenhouse_climate",
            "mapping": [
              "temperature"
            ]
          },
          "name": "climate",
          "source": "bucket"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "below",
          "field": "climate.temperature",
          "operator": "and",
          "type": "value_check",
          "value": "28"
        }
      ],
      "confirmation": {
        "mode": "timespan",
        "timespan": {
          "magnitude": "minute",
          "value": 15
        }
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "reminder": {
      "interval": {
        "magnitude": "day",
        "value": 1
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ],
      "type": "interval"
    },
    "severity": 3
  },
  "description": "Mean temperature above 30 for 3 checks in a row, per device",
  "enabled": true,
  "name": "Greenhouse too hot",
  "rule": "greenhouse_hot"
}'

Example body: Device offline

json
{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "equal",
          "field": "status.connection.active",
          "operator": "and",
          "type": "value_check",
          "value": "0"
        }
      ],
      "confirmation": {
        "mode": "timespan",
        "timespan": {
          "magnitude": "minute",
          "value": 10
        }
      },
      "notifications": [
        {
          "id": "support_webhook",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "minute",
      "value": 1
    },
    "data": {
      "sources": [
        {
          "device_status": {
            "fields": [
              "connection.active",
              "connection.ts"
            ],
            "product": "smart_meter"
          },
          "name": "status",
          "source": "device_status"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "equal",
          "field": "status.connection.active",
          "operator": "and",
          "type": "value_check",
          "value": "1"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": []
    },
    "reminder": {
      "notifications": [],
      "type": "none"
    },
    "severity": 2
  },
  "description": "Any device of the smart_meter product disconnected",
  "enabled": true,
  "name": "Meter offline",
  "rule": "meter_offline"
}

Example body: Per-device threshold

json
{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "above",
          "field": "well.depth_m",
          "operator": "and",
          "type": "value_check",
          "value": "limits.value.max_depth_m"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "minute",
      "value": 15
    },
    "data": {
      "sources": [
        {
          "bucket": {
            "aggregation": {
              "period": "1h",
              "type": "max"
            },
            "group_by": [
              "device"
            ],
            "id": "well_levels",
            "mapping": [
              "depth_m"
            ]
          },
          "name": "well",
          "source": "bucket"
        },
        {
          "device_property": {
            "fields": [
              "value.max_depth_m"
            ],
            "product": "piezometer",
            "property": "limits"
          },
          "name": "limits",
          "source": "device_property"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "below",
          "field": "well.depth_m",
          "operator": "and",
          "type": "value_check",
          "value": "limits.value.max_depth_m * 0.9"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": []
    },
    "reminder": {
      "notifications": [],
      "type": "none"
    },
    "severity": 2
  },
  "description": "Hourly max depth of each well above its own limit: the 'limits' property of the device, or of its asset type, asset group or product when the device has none",
  "enabled": true,
  "name": "Water table too deep",
  "rule": "well_too_deep"
}

Example body: Property condition

json
{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "below",
          "field": "battery.value.level",
          "operator": "and",
          "type": "value_check",
          "value": "15"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "hour",
      "value": 1
    },
    "data": {
      "sources": [
        {
          "device_property": {
            "asset_group": "field_sensors",
            "fields": [
              "value.level"
            ],
            "property": "battery"
          },
          "name": "battery",
          "source": "device_property"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "above",
          "field": "battery.value.level",
          "operator": "and",
          "type": "value_check",
          "value": "50"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": []
    },
    "reminder": {
      "notifications": [],
      "type": "none"
    },
    "severity": 1
  },
  "description": "Battery level reported in the 'battery' property below 15%, devices of the 'field_sensors' group",
  "enabled": true,
  "name": "Low battery",
  "rule": "low_battery"
}

Responses

StatusDescription
200ok
401unauthorized
403forbidden

GET /v1/users/{user}/alarms/rules/{rule} ​

  • Request: GET /v1/users/{user}/alarms/rules/
  • Operation: ReadAlarmRuleConfig
  • Operation ID: Alarm_ReadRuleConfig
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
rulepathstringyes

Example request

bash
curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

Response example (200, Bucket threshold)

json
{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "above",
          "field": "climate.temperature",
          "operator": "and",
          "type": "value_check",
          "value": "30"
        }
      ],
      "confirmation": {
        "mode": "sequence",
        "sequence": {
          "value": 3
        }
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "minute",
      "value": 5
    },
    "data": {
      "sources": [
        {
          "bucket": {
            "aggregation": {
              "period": "5m",
              "type": "mean"
            },
            "group_by": [
              "device"
            ],
            "id": "greenhouse_climate",
            "mapping": [
              "temperature"
            ]
          },
          "name": "climate",
          "source": "bucket"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "below",
          "field": "climate.temperature",
          "operator": "and",
          "type": "value_check",
          "value": "28"
        }
      ],
      "confirmation": {
        "mode": "timespan",
        "timespan": {
          "magnitude": "minute",
          "value": 15
        }
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "reminder": {
      "interval": {
        "magnitude": "day",
        "value": 1
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ],
      "type": "interval"
    },
    "severity": 3
  },
  "created": 1792263090787,
  "description": "Mean temperature above 30 for 3 checks in a row, per device",
  "enabled": true,
  "modified": 1792263090787,
  "name": "Greenhouse too hot",
  "rule": "greenhouse_hot"
}

Response example (200, Device offline)

json
{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "equal",
          "field": "status.connection.active",
          "operator": "and",
          "type": "value_check",
          "value": "0"
        }
      ],
      "confirmation": {
        "mode": "timespan",
        "timespan": {
          "magnitude": "minute",
          "value": 10
        }
      },
      "notifications": [
        {
          "id": "support_webhook",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "minute",
      "value": 1
    },
    "data": {
      "sources": [
        {
          "device_status": {
            "fields": [
              "connection.active",
              "connection.ts"
            ],
            "product": "smart_meter"
          },
          "name": "status",
          "source": "device_status"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "equal",
          "field": "status.connection.active",
          "operator": "and",
          "type": "value_check",
          "value": "1"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": []
    },
    "reminder": {
      "notifications": [],
      "type": "none"
    },
    "severity": 2
  },
  "created": 1792263090787,
  "description": "Any device of the smart_meter product disconnected",
  "enabled": true,
  "modified": 1792263090787,
  "name": "Meter offline",
  "rule": "meter_offline"
}

Response example (200, Per-device threshold)

json
{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "above",
          "field": "well.depth_m",
          "operator": "and",
          "type": "value_check",
          "value": "limits.value.max_depth_m"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "minute",
      "value": 15
    },
    "data": {
      "sources": [
        {
          "bucket": {
            "aggregation": {
              "period": "1h",
              "type": "max"
            },
            "group_by": [
              "device"
            ],
            "id": "well_levels",
            "mapping": [
              "depth_m"
            ]
          },
          "name": "well",
          "source": "bucket"
        },
        {
          "device_property": {
            "fields": [
              "value.max_depth_m"
            ],
            "product": "piezometer",
            "property": "limits"
          },
          "name": "limits",
          "source": "device_property"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "below",
          "field": "well.depth_m",
          "operator": "and",
          "type": "value_check",
          "value": "limits.value.max_depth_m * 0.9"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": []
    },
    "reminder": {
      "notifications": [],
      "type": "none"
    },
    "severity": 2
  },
  "created": 1792263090787,
  "description": "Hourly max depth of each well above its own limit: the 'limits' property of the device, or of its asset type, asset group or product when the device has none",
  "enabled": true,
  "modified": 1792263090787,
  "name": "Water table too deep",
  "rule": "well_too_deep"
}

Response example (200, Property condition)

json
{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "below",
          "field": "battery.value.level",
          "operator": "and",
          "type": "value_check",
          "value": "15"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "hour",
      "value": 1
    },
    "data": {
      "sources": [
        {
          "device_property": {
            "asset_group": "field_sensors",
            "fields": [
              "value.level"
            ],
            "property": "battery"
          },
          "name": "battery",
          "source": "device_property"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "above",
          "field": "battery.value.level",
          "operator": "and",
          "type": "value_check",
          "value": "50"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": []
    },
    "reminder": {
      "notifications": [],
      "type": "none"
    },
    "severity": 1
  },
  "created": 1792263090787,
  "description": "Battery level reported in the 'battery' property below 15%, devices of the 'field_sensors' group",
  "enabled": true,
  "modified": 1792263090787,
  "name": "Low battery",
  "rule": "low_battery"
}

PUT /v1/users/{user}/alarms/rules/{rule} ​

  • Request: PUT /v1/users/{user}/alarms/rules/
  • Operation: UpdateAlarmRule
  • Operation ID: Alarm_UpdateRule
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
rulepathstringyes

Request body (application/json, required)

Fields sent replace the stored ones; config replaces the whole rule configuration (read it first to change part of it).

FieldTypeRequiredConstraintsDescription
configobjectno
config.activationobjectno
config.check_intervalobjectno
config.check_interval.magnitudestringnoOne of: second, minute, hour, day, week, month, year
config.check_interval.valuenumbernoMinimum: 0
config.dataobjectno
config.descriptionstringnoMaximum length: 255A brief description of the resource, providing context or additional information, limited to 255 characters.
config.namestringnoMaximum length: 255The name of the resource, limited to 255 characters. It can include any character.
config.normalizationobjectno
config.reminderobjectno
config.rulestringnoPattern: ^[a-zA-Z0-9_-]{1,32}$A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters.
config.severitynumbernoRange: 0 to 4
descriptionstringnoMaximum length: 255A brief description of the resource, providing context or additional information, limited to 255 characters.
enabledbooleanno
namestringnoMaximum length: 255The name of the resource, limited to 255 characters. It can include any character.

Example request: Disable the rule

bash
curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "enabled": false
}'

Example body: Rename

json
{
  "description": "Zone A sensors only",
  "name": "Greenhouse too hot - zone A"
}

Responses

StatusDescription
200ok
401unauthorized
403forbidden

DELETE /v1/users/{user}/alarms/rules/{rule} ​

  • Request: DELETE /v1/users/{user}/alarms/rules/
  • Operation: DeleteAlarmRule
  • Operation ID: Alarm_DeleteRule
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
rulepathstringyes

Example request

bash
curl -X DELETE 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

GET /v1/users/{user}/alarms/rules/{rule}/clone ​

  • Request: GET /v1/users/{user}/alarms/rules/{rule}/clone
  • Operation: CloneAlarmRuleConfig
  • Operation ID: Alarm_CloneRuleConfig
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
rulepathstringyes

Example request

bash
curl 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/clone' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

POST /v1/users/{user}/alarms/rules/{rule}/clone ​

  • Request: POST /v1/users/{user}/alarms/rules/{rule}/clone
  • Operation: CloneAlarmRule
  • Operation ID: Alarm_CloneRule
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
rulepathstringyes

Request body (application/json, required)

FieldTypeRequiredConstraintsDescription
descriptionstringnoMaximum length: 255A brief description of the resource, providing context or additional information, limited to 255 characters.
enabledbooleanno
namestringnoMaximum length: 255The name of the resource, limited to 255 characters. It can include any character.
rulestringyesPattern: ^[a-zA-Z0-9_-]{1,32}$A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters.

Example request: Copy with a new id

bash
curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/clone' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "rule": "copy_of_rule"
}'

Example body: Copy with name and description

json
{
  "description": "Same configuration as the original, for production line 2",
  "name": "Line 2 copy",
  "rule": "line_2_rule"
}

Responses

StatusDescription
200ok
401unauthorized
403forbidden

PUT /v1/users/{user}/alarms/rules/{rule}/projects ​

  • Request: PUT /v1/users/{user}/alarms/rules/{rule}/projects
  • Operation: UpdateAlarmRuleProjects
  • Operation ID: Alarm_UpdateRuleProjects
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
rulepathstringyes

Request body (application/json, required)

FieldTypeRequiredConstraintsDescription
(body)array of stringnoProjects the resource belongs to, as <owner>@<project> ids. Replaces the whole list: read the current one first to add or remove a single project; [] removes it from every project.

Example request: No projects

bash
curl -X PUT 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/projects' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '[]'

Example body: One project

json
[
  "YOUR_USER@greenhouse"
]

Example body: Two projects

json
[
  "YOUR_USER@greenhouse",
  "YOUR_USER@maintenance"
]

Responses

StatusDescription
200ok
401unauthorized
403forbidden

POST /v1/users/{user}/alarms/rules/{rule}/test-notification ​

  • Request: POST /v1/users/{user}/alarms/rules/{rule}/test-notification
  • Operation: TestRuleNotification
  • Operation ID: Alarm_TestRuleNotificationTest-notification
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
rulepathstringyes

Request body (application/json, required)

Simulates an alarm event of a device and SENDS the notifications configured for that event type (config.<type>.notifications) to their endpoints, so real emails or webhooks go out. Returns the notifications and the alarm payload they carried. Nothing is stored.

FieldTypeRequiredConstraintsDescription
configobjectno
config.activationobjectno
config.check_intervalobjectno
config.check_interval.magnitudestringnoOne of: second, minute, hour, day, week, month, year
config.check_interval.valuenumbernoMinimum: 0
config.dataobjectno
config.descriptionstringnoMaximum length: 255A brief description of the resource, providing context or additional information, limited to 255 characters.
config.namestringnoMaximum length: 255The name of the resource, limited to 255 characters. It can include any character.
config.normalizationobjectno
config.reminderobjectno
config.rulestringnoPattern: ^[a-zA-Z0-9_-]{1,32}$A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters.
config.severitynumbernoRange: 0 to 4
descriptionstring or nullno
eventobjectyes
event.originstring or nullnoDevice id.
event.typestringyesOne of: activation, normalization, reminder
event.valuesanynoSource values that triggered the event, by source name.
namestring or nullno

Example request: Activation of a device

bash
curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/test-notification' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "config": {
    "activation": {
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "severity": 3
  },
  "description": "Mean temperature above 30",
  "event": {
    "origin": "greenhouse_01",
    "type": "activation",
    "values": {
      "climate": {
        "temperature": 31.2
      }
    }
  },
  "name": "Greenhouse too hot"
}'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

POST /v1/users/{user}/alarms/rules/{rule}/test-rule ​

  • Request: POST /v1/users/{user}/alarms/rules/{rule}/test-rule
  • Operation: TestRule
  • Operation ID: Alarm_TestRuleTest-rule
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
rulepathstringyes

Request body (application/json, required)

Fields sent replace the stored ones; config replaces the whole rule configuration (read it first to change part of it).

FieldTypeRequiredConstraintsDescription
configobjectno
config.activationobjectno
config.check_intervalobjectno
config.check_interval.magnitudestringnoOne of: second, minute, hour, day, week, month, year
config.check_interval.valuenumbernoMinimum: 0
config.dataobjectno
config.descriptionstringnoMaximum length: 255A brief description of the resource, providing context or additional information, limited to 255 characters.
config.namestringnoMaximum length: 255The name of the resource, limited to 255 characters. It can include any character.
config.normalizationobjectno
config.reminderobjectno
config.rulestringnoPattern: ^[a-zA-Z0-9_-]{1,32}$A unique identifier for resources, consisting of alphanumeric characters, underscores, or hyphens, and limited to 32 characters.
config.severitynumbernoRange: 0 to 4
descriptionstringnoMaximum length: 255A brief description of the resource, providing context or additional information, limited to 255 characters.
enabledbooleanno
namestringnoMaximum length: 255The name of the resource, limited to 255 characters. It can include any character.

Example request: Bucket threshold

bash
curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/test-rule' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "above",
          "field": "climate.temperature",
          "operator": "and",
          "type": "value_check",
          "value": "30"
        }
      ],
      "confirmation": {
        "mode": "sequence",
        "sequence": {
          "value": 3
        }
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "minute",
      "value": 5
    },
    "data": {
      "sources": [
        {
          "bucket": {
            "aggregation": {
              "period": "5m",
              "type": "mean"
            },
            "group_by": [
              "device"
            ],
            "id": "greenhouse_climate",
            "mapping": [
              "temperature"
            ]
          },
          "name": "climate",
          "source": "bucket"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "below",
          "field": "climate.temperature",
          "operator": "and",
          "type": "value_check",
          "value": "28"
        }
      ],
      "confirmation": {
        "mode": "timespan",
        "timespan": {
          "magnitude": "minute",
          "value": 15
        }
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "reminder": {
      "interval": {
        "magnitude": "day",
        "value": 1
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ],
      "type": "interval"
    },
    "severity": 3
  },
  "description": "Mean temperature above 30 for 3 checks in a row, per device",
  "enabled": true,
  "name": "Greenhouse too hot"
}'

Example body: Device offline

json
{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "equal",
          "field": "status.connection.active",
          "operator": "and",
          "type": "value_check",
          "value": "0"
        }
      ],
      "confirmation": {
        "mode": "timespan",
        "timespan": {
          "magnitude": "minute",
          "value": 10
        }
      },
      "notifications": [
        {
          "id": "support_webhook",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "minute",
      "value": 1
    },
    "data": {
      "sources": [
        {
          "device_status": {
            "fields": [
              "connection.active",
              "connection.ts"
            ],
            "product": "smart_meter"
          },
          "name": "status",
          "source": "device_status"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "equal",
          "field": "status.connection.active",
          "operator": "and",
          "type": "value_check",
          "value": "1"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": []
    },
    "reminder": {
      "notifications": [],
      "type": "none"
    },
    "severity": 2
  },
  "description": "Any device of the smart_meter product disconnected",
  "enabled": true,
  "name": "Meter offline"
}

Example body: Per-device threshold

json
{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "above",
          "field": "well.depth_m",
          "operator": "and",
          "type": "value_check",
          "value": "limits.value.max_depth_m"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "minute",
      "value": 15
    },
    "data": {
      "sources": [
        {
          "bucket": {
            "aggregation": {
              "period": "1h",
              "type": "max"
            },
            "group_by": [
              "device"
            ],
            "id": "well_levels",
            "mapping": [
              "depth_m"
            ]
          },
          "name": "well",
          "source": "bucket"
        },
        {
          "device_property": {
            "fields": [
              "value.max_depth_m"
            ],
            "product": "piezometer",
            "property": "limits"
          },
          "name": "limits",
          "source": "device_property"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "below",
          "field": "well.depth_m",
          "operator": "and",
          "type": "value_check",
          "value": "limits.value.max_depth_m * 0.9"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": []
    },
    "reminder": {
      "notifications": [],
      "type": "none"
    },
    "severity": 2
  },
  "description": "Hourly max depth of each well above its own limit: the 'limits' property of the device, or of its asset type, asset group or product when the device has none",
  "enabled": true,
  "name": "Water table too deep"
}

Example body: Property condition

json
{
  "config": {
    "activation": {
      "conditions": [
        {
          "comparison": "below",
          "field": "battery.value.level",
          "operator": "and",
          "type": "value_check",
          "value": "15"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": [
        {
          "id": "ops_email",
          "type": "endpoint"
        }
      ]
    },
    "check_interval": {
      "magnitude": "hour",
      "value": 1
    },
    "data": {
      "sources": [
        {
          "device_property": {
            "asset_group": "field_sensors",
            "fields": [
              "value.level"
            ],
            "property": "battery"
          },
          "name": "battery",
          "source": "device_property"
        }
      ]
    },
    "normalization": {
      "conditions": [
        {
          "comparison": "above",
          "field": "battery.value.level",
          "operator": "and",
          "type": "value_check",
          "value": "50"
        }
      ],
      "confirmation": {
        "mode": "immediate"
      },
      "notifications": []
    },
    "reminder": {
      "notifications": [],
      "type": "none"
    },
    "severity": 1
  },
  "description": "Battery level reported in the 'battery' property below 15%, devices of the 'field_sensors' group",
  "enabled": true,
  "name": "Low battery"
}

Responses

StatusDescription
200ok
401unauthorized
403forbidden

POST /v1/users/{user}/alarms/rules/{rule}/test-source ​

  • Request: POST /v1/users/{user}/alarms/rules/{rule}/test-source
  • Operation: TestRuleSource
  • Operation ID: Alarm_TestRuleSourceTest-source
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
userpathstringyes
rulepathstringyes

Request body (application/json, required)

One data source, as in config.data.sources: returns the data it produces now, per device. The rule id in the path does not need to exist yet.

FieldTypeRequiredConstraintsDescription
bucketobjectno
check_intervalobjectnoWindow read by a bucket source without aggregation, as in config.check_interval (default: the rule's, or 1 minute). The rule does not need to exist.
device_propertyobjectno
device_statusobjectno
namestring or nullno
sourcestringyesOne of: bucket, device_property, device_status

Example request: Bucket source

bash
curl -X POST 'https://YOUR_SERVER/v1/users/YOUR_USER/alarms/rules/YOUR_RULE/test-source' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "bucket": {
    "aggregation": {
      "period": "5m",
      "type": "mean"
    },
    "group_by": [
      "device"
    ],
    "id": "greenhouse_climate",
    "mapping": [
      "temperature"
    ]
  },
  "name": "climate",
  "source": "bucket"
}'

Example body: Device property source

json
{
  "device_property": {
    "asset_group": "field_sensors",
    "fields": [
      "value.level"
    ],
    "property": "battery"
  },
  "name": "battery",
  "source": "device_property"
}

Example body: Device status source

json
{
  "device_status": {
    "fields": [
      "connection.active",
      "connection.ts"
    ],
    "product": "smart_meter"
  },
  "name": "status",
  "source": "device_status"
}

Responses

StatusDescription
200ok
401unauthorized
403forbidden