---
title: "Create or Update Alarm (saveAlarm)"
method: POST
path: "/api/alarm"
tags: ["alarm-controller"]
---

# Create or Update Alarm (saveAlarm)

`POST /api/alarm`

Creates or Updates the Alarm. When creating alarm, platform generates Alarm Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm id will be present in the response. Specify existing Alarm id to update the alarm. Referencing non-existing Alarm Id will cause 'Not Found' error. 

Platform also deduplicate the alarms based on the entity id of originator and alarm 'type'. For example, if the user or system component create the alarm with the type 'HighTemperature' for device 'Device A' the new active alarm is created. If the user tries to create 'HighTemperature' alarm for the same device again, the previous alarm will be updated (the 'end_ts' will be set to current timestamp). If the user clears the alarm (see 'Clear Alarm(clearAlarm)'), than new alarm with the same type and same device may be created. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Alarm entity. 

Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority.

## Request body

- Alarm
  - `tenantId` TenantId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'TENANT', required — string
  - `customerId` CustomerId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'CUSTOMER', required — string
  - `type` string, required — representing type of the Alarm
  - `originator` EntityId, required
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'TENANT' | 'CUSTOMER' | 'USER' | 'DASHBOARD' | 'ASSET' | 'DEVICE' | 'ALARM' | 'RULE_CHAIN' | 'RULE_NODE' | 'ENTITY_VIEW' | 'WIDGETS_BUNDLE' | 'WIDGET_TYPE' | 'TENANT_PROFILE' | 'DEVICE_PROFILE' | 'ASSET_PROFILE' | 'API_USAGE_STATE' | 'TB_RESOURCE' | 'OTA_PACKAGE' | 'EDGE' | 'RPC' | 'QUEUE' | 'NOTIFICATION_TARGET' | 'NOTIFICATION_TEMPLATE' | 'NOTIFICATION_REQUEST' | 'NOTIFICATION' | 'NOTIFICATION_RULE' | 'QUEUE_STATS' | 'OAUTH2_CLIENT' | 'DOMAIN' | 'MOBILE_APP' | 'MOBILE_APP_BUNDLE' | 'CALCULATED_FIELD' | 'JOB' | 'ADMIN_SETTINGS' | 'AI_MODEL' | 'API_KEY', required
  - `severity` 'CRITICAL' | 'MAJOR' | 'MINOR' | 'WARNING' | 'INDETERMINATE', required — Alarm severity
  - `acknowledged` boolean, required — Acknowledged
  - `cleared` boolean, required — Cleared
  - `assigneeId` UserId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'USER', required — string
  - `startTs` integer — Timestamp of the alarm start time, in milliseconds
  - `endTs` integer — Timestamp of the alarm end time(last time update), in milliseconds
  - `ackTs` integer — Timestamp of the alarm acknowledgement, in milliseconds
  - `clearTs` integer — Timestamp of the alarm clearing, in milliseconds
  - `assignTs` integer — Timestamp of the alarm assignment, in milliseconds
  - `details` unknown
  - `propagate` boolean — Propagation flag to specify if alarm should be propagated to parent entities of alarm originator
  - `propagateToOwner` boolean — Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator
  - `propagateToTenant` boolean — Propagation flag to specify if alarm should be propagated to the tenant entity
  - `propagateRelationTypes` string[] — JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored.
  - `id` AlarmId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'ALARM', required — string
  - `createdTime` integer — Timestamp of the alarm creation, in milliseconds
  - `name` string, required — representing type of the Alarm
  - `status` 'ACTIVE_UNACK' | 'ACTIVE_ACK' | 'CLEARED_UNACK' | 'CLEARED_ACK', required — status of the Alarm

## Response `200`

OK

- Alarm
  - `tenantId` TenantId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'TENANT', required — string
  - `customerId` CustomerId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'CUSTOMER', required — string
  - `type` string, required — representing type of the Alarm
  - `originator` EntityId, required
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'TENANT' | 'CUSTOMER' | 'USER' | 'DASHBOARD' | 'ASSET' | 'DEVICE' | 'ALARM' | 'RULE_CHAIN' | 'RULE_NODE' | 'ENTITY_VIEW' | 'WIDGETS_BUNDLE' | 'WIDGET_TYPE' | 'TENANT_PROFILE' | 'DEVICE_PROFILE' | 'ASSET_PROFILE' | 'API_USAGE_STATE' | 'TB_RESOURCE' | 'OTA_PACKAGE' | 'EDGE' | 'RPC' | 'QUEUE' | 'NOTIFICATION_TARGET' | 'NOTIFICATION_TEMPLATE' | 'NOTIFICATION_REQUEST' | 'NOTIFICATION' | 'NOTIFICATION_RULE' | 'QUEUE_STATS' | 'OAUTH2_CLIENT' | 'DOMAIN' | 'MOBILE_APP' | 'MOBILE_APP_BUNDLE' | 'CALCULATED_FIELD' | 'JOB' | 'ADMIN_SETTINGS' | 'AI_MODEL' | 'API_KEY', required
  - `severity` 'CRITICAL' | 'MAJOR' | 'MINOR' | 'WARNING' | 'INDETERMINATE', required — Alarm severity
  - `acknowledged` boolean, required — Acknowledged
  - `cleared` boolean, required — Cleared
  - `assigneeId` UserId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'USER', required — string
  - `startTs` integer — Timestamp of the alarm start time, in milliseconds
  - `endTs` integer — Timestamp of the alarm end time(last time update), in milliseconds
  - `ackTs` integer — Timestamp of the alarm acknowledgement, in milliseconds
  - `clearTs` integer — Timestamp of the alarm clearing, in milliseconds
  - `assignTs` integer — Timestamp of the alarm assignment, in milliseconds
  - `details` unknown
  - `propagate` boolean — Propagation flag to specify if alarm should be propagated to parent entities of alarm originator
  - `propagateToOwner` boolean — Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator
  - `propagateToTenant` boolean — Propagation flag to specify if alarm should be propagated to the tenant entity
  - `propagateRelationTypes` string[] — JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored.
  - `id` AlarmId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'ALARM', required — string
  - `createdTime` integer — Timestamp of the alarm creation, in milliseconds
  - `name` string, required — representing type of the Alarm
  - `status` 'ACTIVE_UNACK' | 'ACTIVE_ACK' | 'CLEARED_UNACK' | 'CLEARED_ACK', required — status of the Alarm

---

[API](https://skmtc.net/thingsboard/apis/thingsboard-rest-api.md) · [All operations](https://skmtc.net/thingsboard/apis/thingsboard-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/thingsboard/thingsboard-rest-api/revisions/40169ccdec5c/schema)
