---
title: "POST /eventAlertConditionRules"
method: POST
path: "/eventAlertConditionRules"
tags: ["Event Alert Rules"]
---

# POST /eventAlertConditionRules

`POST /eventAlertConditionRules`

## Request

- Base URL: `https://api.cxxx.eagleeyenetworks.com/api/v3.0`
- URL: `https://api.cxxx.eagleeyenetworks.com/api/v3.0/eventAlertConditionRules`
- Auth: HTTP bearer

Create a new rule that produces alerts based on certain conditions. Specifically, the user specifies alert conditions that indicate when the alert is produced based on following:
  * Which resources can produce the alert
  * What is the schedule for the alert.
  * What event types can produce the alert.

Resellers may create rules on behalf of an end user account by setting `endUserAccountId` in the request body. The reseller must have permission to edit automations on that end user account.

## Request body

- ApiEventAlertConditionRuleCreate: Encompasses all the user specified properties of a rule used to generate alerts.
  - `name` string: Name for the rule
  - `priority` integer: Defines the priority of the alert
  - `notes` string: A verbose explanation of the rule
  - `enabled` boolean: Whether rule is enabled
  - `cooldownSeconds` integer: Cooldown period (in seconds). If two events for the same actor and event type have event timestamps within this duration, only the first will trigger an alert while the second event will be suppressed. A value of 0 disables the cooldown checks.
  - `humanValidation` object
    - `enabled` boolean: If set to true, the alert will be validated by a human before being applied. This is useful for rules that are not 100% reliable and need human confirmation.
    - `service` 'eenV1': The service that will be used for human validation. Currently, the only supported service is Eagle Eye Human Review, which is the default.
    - `maxWaitTimeSeconds` integer: The maximum time (in seconds) to wait for human validation before the alert is applied. If the human validation is not completed within this time, the alert will be applied automatically.
  - `eventFilter` EventFilter: A list of attributes of the event used to funnel down a specific set of events for any downstream action.
    - `eventTypes` string[]: Specifies the types of events that this rule should evaluate. Only events matching one of the specified types will trigger the rule. For example, if this field includes `een.personDetectionEvent.v1`, but the incoming event is a `een.motionDetectionEvent.v1`, the rule will not be triggered.
    - `data` object: A key-value map used to filter events based on fields defined in event data schemas. Keys must follow the format: `{schema}.{field}__{operator}`. Refer to the event descriptions and corresponding data schemas to determine the available schema names and their respective fields. If the operator is omitted, equality is assumed. The `schema` and `field` names used in the keys must match the `dataSchemas` associated with the filtered `eventTypes`. If any schema or field is invalid for the given event type(s), the API will return a validation error. Supported operators: - `__in`: Match if the field value is in the provided list - `__gte`: Match if the field value is greater than or equal to the given value (number or date-time) - `__lte`: Match if the field value is less than or equal to the given value (number or date-time)
      - `and` object[]: All conditions must match
    - `schedule` WeeklyIntervalSchedule: It signifies a week long alert schedule. This schedule is effective according to actor's (user/camera/account) timezone. It allows setting different times for different days.
      - `sunday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `monday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `tuesday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `wednesday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `thursday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `friday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `saturday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
    - `resourceFilter` ResourceFilter: List of actors against which filtering has to happen
      - `actors` string[]: Actors that can trigger alerts for this rule, in the format `actorType:actorId`. Wildcard Support: Use `<actorType>:*` to match all actors of a specific type (e.g., `camera:*` matches all cameras). Only full wildcards (`<actorType>:*`) are supported. Partial wildcards like `camera:123*` are not allowed. Only admin users can use wildcard actors.

## Response `201`

Response on successful creation of the rule.

- ApiEventAlertConditionRule: Encompasses all the user specified properties of a rule used to generate alerts.
  - `name` string: Name for the rule
  - `priority` integer: Defines the priority of the alert
  - `notes` string: A verbose explanation of the rule
  - `enabled` boolean: Whether rule is enabled
  - `cooldownSeconds` integer: Cooldown period (in seconds). If two events for the same actor and event type have event timestamps within this duration, only the first will trigger an alert while the second event will be suppressed. A value of 0 disables the cooldown checks.
  - `humanValidation` object
    - `enabled` boolean: If set to true, the alert will be validated by a human before being applied. This is useful for rules that are not 100% reliable and need human confirmation.
    - `service` 'eenV1': The service that will be used for human validation. Currently, the only supported service is Eagle Eye Human Review, which is the default.
    - `maxWaitTimeSeconds` integer: The maximum time (in seconds) to wait for human validation before the alert is applied. If the human validation is not completed within this time, the alert will be applied automatically.
  - `eventFilter` EventFilter: A list of attributes of the event used to funnel down a specific set of events for any downstream action.
    - `eventTypes` string[]: Specifies the types of events that this rule should evaluate. Only events matching one of the specified types will trigger the rule. For example, if this field includes `een.personDetectionEvent.v1`, but the incoming event is a `een.motionDetectionEvent.v1`, the rule will not be triggered.
    - `data` object: A key-value map used to filter events based on fields defined in event data schemas. Keys must follow the format: `{schema}.{field}__{operator}`. Refer to the event descriptions and corresponding data schemas to determine the available schema names and their respective fields. If the operator is omitted, equality is assumed. The `schema` and `field` names used in the keys must match the `dataSchemas` associated with the filtered `eventTypes`. If any schema or field is invalid for the given event type(s), the API will return a validation error. Supported operators: - `__in`: Match if the field value is in the provided list - `__gte`: Match if the field value is greater than or equal to the given value (number or date-time) - `__lte`: Match if the field value is less than or equal to the given value (number or date-time)
      - `and` object[]: All conditions must match
    - `schedule` WeeklyIntervalSchedule: It signifies a week long alert schedule. This schedule is effective according to actor's (user/camera/account) timezone. It allows setting different times for different days.
      - `sunday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `monday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `tuesday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `wednesday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `thursday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `friday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
      - `saturday` Interval[]
        - `start` string, required: Starting point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for a day
        - `end` string, required: End point of the interval. It should be in the range of 00:00 to 23:59 since this is the range for the day
    - `resourceFilter` ResourceFilter: List of actors against which filtering has to happen
      - `actors` string[]: Actors that can trigger alerts for this rule, in the format `actorType:actorId`. Wildcard Support: Use `<actorType>:*` to match all actors of a specific type (e.g., `camera:*` matches all cameras). Only full wildcards (`<actorType>:*`) are supported. Partial wildcards like `camera:123*` are not allowed. Only admin users can use wildcard actors.
  - `id` string: The system generated id of this rule resource
  - `createTimeStamp` string, date-time: Time at which the Alert Condition Rule was created.
  - `updateTimeStamp` string, date-time: Time at which the Alert Condition Rule was last updated.
  - `outputAlertTypes` string[]: Possible Alert Types that are producible by this rule. For a given event, what alert is produced depends on the configuration parameters of the rule and the event properties.
  - `endUserAccountId` string, nullable: The end user account this rule targets. Available only for a rule created by a reseller targeting an end user; `null` otherwise.

## Other responses

- `400`: The supplied object is invalid. Error detail will contain the validation error.
- `401`: You are not authenticated. Please authenticate and try again.
- `403`: You have no permission to access the specified resource.
- `500`: Something went wrong in the server. Please try again.

---

[API](https://skmtc.dev/eagleeyenetworks/apis/automations.md) - [All operations](https://skmtc.dev/eagleeyenetworks/apis/automations/llms.txt) - [OpenAPI document](https://skmtc.dev/eagleeyenetworks/apis/automations/revisions/4d5e8b5071b5?raw)
