---
title: "Tạo quy tắc cảnh báo"
method: POST
path: "/ir/{symbol}/alert-rules"
tags: ["IRAnalytics"]
---

# Tạo quy tắc cảnh báo

`POST /ir/{symbol}/alert-rules`

## Request

- Base URL: `https://api.fireant.vn`
- URL: `https://api.fireant.vn/ir/{symbol}/alert-rules`
- Auth: OAuth 2
  - Implicit: `https://accounts.fireant.vn/connect/authorize`
  - Scopes: `user-data-write`
- TypeScript: <https://skmtc.dev/fireant/apis/fireant-restful-api/docs/ir/:symbol/alert-rules/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `symbol` string, required

## Request body

- FireAntApiModelsIRIRAlertRuleChangeRequest: Tạo hoặc sửa quy tắc cảnh báo
  - `name` string, required: Tên quy tắc
  - `metric` string, required: Chỉ số theo dõi
  - `condition` 1 | 2 | 3 | 4: Điều kiện kích hoạt (1 = SpikeSigma, 2 = Above, 3 = Below, 4 = PercentChange)
  - `threshold` number, double: Ngưỡng (bắt buộc trừ khi dùng phát hiện đột biến)
  - `windowHours` integer: Cửa sổ quan sát (giờ)
  - `channels` string: Kênh gửi: push, email, lark
  - `recipients` string: Người nhận
  - `cooldownMinutes` integer: Thời gian nghỉ giữa hai lần cảnh báo (phút)
  - `isActive` boolean: Đang bật

## Response `200`

OK

- FireAntApiModelsIRIRAlertRuleItem: Quy tắc cảnh báo tự động
  - `ruleId` integer: ID quy tắc
  - `companyId` integer: ID công ty
  - `name` string: Tên quy tắc
  - `metric` string: Chỉ số theo dõi: mentions, negative_ratio, severity_high, watchlist_net, sentiment_score, oa_followers
  - `condition` 1 | 2 | 3 | 4: Điều kiện kích hoạt (1 = SpikeSigma, 2 = Above, 3 = Below, 4 = PercentChange)
  - `threshold` number, double: Ngưỡng
  - `windowHours` integer: Cửa sổ quan sát (giờ)
  - `channels` string: Kênh gửi: push, email, lark
  - `recipients` string: Người nhận (danh sách tên đăng nhập, phân tách bằng dấu phẩy)
  - `cooldownMinutes` integer: Thời gian nghỉ giữa hai lần cảnh báo (phút)
  - `isActive` boolean: Đang bật
  - `lastTriggeredDate` string, date-time: Lần kích hoạt gần nhất
  - `createdBy` string: Người tạo
  - `createdDate` string, date-time: Ngày tạo

## Changes

- **2026-09-25** `a481789cd81c`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/fireant/apis/fireant-restful-api/changes/ir/:symbol/alert-rules/post.md)

---

[API](https://skmtc.dev/fireant/apis/fireant-restful-api.md) - [All operations](https://skmtc.dev/fireant/apis/fireant-restful-api/llms.txt) - [OpenAPI document](https://skmtc.dev/fireant/apis/fireant-restful-api/revisions/c9b3aa855f95?raw)
