---
title: "Create notification rule"
method: POST
path: "/api/{cloudId}/v1/notification-rules"
tags: ["Notification rules"]
---

# Create notification rule

`POST /api/{cloudId}/v1/notification-rules`

Creates a notification rule with the given properties for the user.

## Request body

- NotificationRuleRequest
  - `name` string, required — Name of the notification rule.
  - `actionType` 'create-alert' | 'acknowledged-alert' | 'closed-alert' | 'assigned-alert' | 'add-note' | 'schedule-start' | 'schedule-end' | 'incoming-call-routing', required — Type of the action that notification rule will have.
  - `criteria` union — Defines the conditions that will be checked before applying notification rule and type of the operations that will be applied on conditions. Default value is matching all notification rules.
    - NotificationRulesMatchAllAnyConditionsFilter
      - `type` 'match-any-condition' | 'match-all-conditions', required — Type of the operation will be applied on conditions.
      - `conditions` NotificationRulesCondition[], required — List of conditions will be checked before applying team routing rule.
        - `field` 'message' | 'alias' | 'description' | 'source' | 'entity' | 'tags' | 'actions' | 'extra-properties' | 'priority' | 'details' | 'responders', required — Specifies which alert field will be used in condition.
        - `key` string — If field is set as extra-properties, key could be used for key-value pair.
        - `not` boolean — Indicates behaviour of the given operation.
        - `operation` 'matches' | 'contains' | 'starts-with' | 'ends-with' | 'equals' | 'contains-key' | 'contains-value' | 'greater-than' | 'less-than' | 'is-empty' | 'equals-ignore-whitespace', required — It is the operation that will be executed for the given field and key. Available operations changes according to the fields type: - String Operations: contains, equals, starts-with, ends-with, matches, is-empty, equals-ignore-whitespace - List Operations: contains, is-empty - Map Operations: contains, contains-key, contains-value, is-empty - Number Operations: matches, equals, greater-than, less-than - Boolean Operations: equals
        - `expectedValue` string — User defined value that will be compared with alert field according to the operation. Default value is empty string.
        - `order` integer — Order of the condition in conditions list.
    - NotificationRulesMatchAllFilter
      - `type` 'match-all', required — Type of the operation will be applied on conditions.
  - `notificationTime` string[] — List of Time Periods that notification for schedule start/end will be sent.
  - `timeRestriction` union — Time interval that notification rule will work. It can be just one restriction which will be applied all days, or list of restrictions will be applied to the specified days.
    - NotificationRulesTimeOfDayTimeRestrictionInterval
      - `type` string, required — This parameter should be set **time-of-day** (day-based).
      - `restriction` NotificationRulesDayTimeRestriction, required — It is a restriction object.
        - `startHour` integer, required — Value of the hour that frame will start.
        - `endHour` integer, required — Value of the hour that frame will end.
        - `startMin` integer, required — Value of the minute that frame will start.
        - `endMin` integer, required — Value of the minute that frame will end.
    - NotificationRulesWeekdayTimeRestrictionInterval
      - `type` string, required — This parameter should be set **weekday-and-time-of-day** (week-based).
      - `restrictions` NotificationRulesWeekTimeRestriction[], required — It is a list of restriction objects.
        - `startDay` 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday', required
        - `endDay` 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday', required
        - `startHour` integer, required — Value of the hour that frame will start.
        - `endHour` integer, required — Value of the hour that frame will end.
        - `startMin` integer, required — Value of the minute that frame will start.
        - `endMin` integer, required — Value of the minute that frame will end.
  - `schedules` string[] — This field is valid for Schedule Start/End rules. It can be list of schedule IDs that notification rule will be applied when on call of that schedule starts/ends. This field shall only be populated with the specified users' schedules.
  - `order` integer — The order of the notification rule within the notification rules with the same action type. Order value is actually the index of the notification rule whose minimum value is 0 and whose maximum value is n-1 (number of notification rules with the same action type is n).
  - `steps` NotificationRulesCreateNotificationRuleStepRequest[] — List of steps that will be added to notification rule.
    - `contact` NotificationRulesContact, required — Defines the contact that notification will be sent to.
      - `method` 'email' | 'sms' | 'voice' | 'mobile', required — This parameter is the contact method of user.
      - `to` string, required — Address of the contact notification will be sent to.
    - `sendAfter` integer — Time period when notification will be sent after in minutes.
    - `enabled` boolean, required — Specifies whether given step will be enabled or not when it is created.
  - `repeat` NotificationRuleRepeat — The amount of time in minutes that notification steps will be repeatedly apply.
    - `loopAfter` integer — This parameter is amount in minutes that notification steps will be repeatedly apply. It can not be less than 0.
    - `enabled` boolean — Determine whether loopAfter is enabled or not. If it is set to false, repeating will be disabled.
  - `enabled` boolean, required — If notification rule will be enabled or not when it is created.

## Response `201`

Returned if the request is successful.

- NotificationRuleResponse
  - `id` string — Identifier of the notification rule.
  - `name` string — Name of the notification rule.
  - `actionType` 'create-alert' | 'acknowledged-alert' | 'closed-alert' | 'assigned-alert' | 'add-note' | 'schedule-start' | 'schedule-end' | 'incoming-call-routing' — Type of the action that notification rule will have.
  - `criteria` union — Defines the conditions that will be checked before applying notification rule and type of the operations that will be applied on conditions. Default value is matching all notification rules.
    - NotificationRulesMatchAllAnyConditionsFilter
      - `type` 'match-any-condition' | 'match-all-conditions', required — Type of the operation will be applied on conditions.
      - `conditions` NotificationRulesCondition[], required — List of conditions will be checked before applying team routing rule.
        - `field` 'message' | 'alias' | 'description' | 'source' | 'entity' | 'tags' | 'actions' | 'extra-properties' | 'priority' | 'details' | 'responders', required — Specifies which alert field will be used in condition.
        - `key` string — If field is set as extra-properties, key could be used for key-value pair.
        - `not` boolean — Indicates behaviour of the given operation.
        - `operation` 'matches' | 'contains' | 'starts-with' | 'ends-with' | 'equals' | 'contains-key' | 'contains-value' | 'greater-than' | 'less-than' | 'is-empty' | 'equals-ignore-whitespace', required — It is the operation that will be executed for the given field and key. Available operations changes according to the fields type: - String Operations: contains, equals, starts-with, ends-with, matches, is-empty, equals-ignore-whitespace - List Operations: contains, is-empty - Map Operations: contains, contains-key, contains-value, is-empty - Number Operations: matches, equals, greater-than, less-than - Boolean Operations: equals
        - `expectedValue` string — User defined value that will be compared with alert field according to the operation. Default value is empty string.
        - `order` integer — Order of the condition in conditions list.
    - NotificationRulesMatchAllFilter
      - `type` 'match-all', required — Type of the operation will be applied on conditions.
  - `notificationTime` string[] — List of Time Periods that notification for schedule start/end will be sent. If actionType is **scheduleStart** or **scheduleEnd**, notificationTime is mandatory.
  - `timeRestriction` union — Time interval that notification rule will work. It can be just one restriction which will be applied all days, or list of restrictions will be applied to the specified days.
    - NotificationRulesTimeOfDayTimeRestrictionInterval
      - `type` string, required — This parameter should be set **time-of-day** (day-based).
      - `restriction` NotificationRulesDayTimeRestriction, required — It is a restriction object.
        - `startHour` integer, required — Value of the hour that frame will start.
        - `endHour` integer, required — Value of the hour that frame will end.
        - `startMin` integer, required — Value of the minute that frame will start.
        - `endMin` integer, required — Value of the minute that frame will end.
    - NotificationRulesWeekdayTimeRestrictionInterval
      - `type` string, required — This parameter should be set **weekday-and-time-of-day** (week-based).
      - `restrictions` NotificationRulesWeekTimeRestriction[], required — It is a list of restriction objects.
        - `startDay` 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday', required
        - `endDay` 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday', required
        - `startHour` integer, required — Value of the hour that frame will start.
        - `endHour` integer, required — Value of the hour that frame will end.
        - `startMin` integer, required — Value of the minute that frame will start.
        - `endMin` integer, required — Value of the minute that frame will end.
  - `schedules` string[] — This field is valid for Schedule Start/End rules. It can be list of schedule IDs that notification rule will be applied when on call of that schedule starts/ends. This field shall only be populated with the specified users' schedules.
  - `order` integer — The order of the notification rule within the notification rules with the same action type. Order value is actually the index of the notification rule whose minimum value is 0 and whose maximum value is n-1 (number of notification rules with the same action type is n).
  - `steps` NotificationRulesNotificationRuleStep[] — List of steps that will be added to notification rule.
    - `id` string — Id of the notification rule step.
    - `sendAfter` integer — Time period when notification will be sent after in minutes.
    - `contact` NotificationRulesContact — Defines the contact that notification will be sent to.
      - `method` 'email' | 'sms' | 'voice' | 'mobile', required — This parameter is the contact method of user.
      - `to` string, required — Address of the contact notification will be sent to.
    - `enabled` boolean — Specifies whether given step will be enabled or not when it is created.
  - `repeat` NotificationRuleRepeat — The amount of time in minutes that notification steps will be repeatedly apply.
    - `loopAfter` integer — This parameter is amount in minutes that notification steps will be repeatedly apply. It can not be less than 0.
    - `enabled` boolean — Determine whether loopAfter is enabled or not. If it is set to false, repeating will be disabled.
  - `enabled` boolean — If notification rule will be enabled or not when it is created.

## Other responses

- `401` — Returned if the authentication credentials are incorrect.
- `403` — Returned if the request user does not have permission to create notification rule.
- `422` — Returned if the payload cannot be validated.

---

[API](https://skmtc.net/atlassian/apis/jsm-operations-api.md) · [All operations](https://skmtc.net/atlassian/apis/jsm-operations-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/atlassian/jsm-operations-api/versions/ed65f017bcb8/schema)
