Skip to main content
POST
Import alert rules

Restrictions

Usage

  • The request body is a JSON array of rule export objects (compatible with the output of POST /monit/rule/export).
  • Each object must include folder_id, ds_type, and either ds_list or ds_ids.
  • Some rules may fail (e.g. duplicate name). Check each result for individual status.
  • Every call is recorded in the account audit log. Don’t put secrets in request fields.

Authorizations

app_key
string
query
required

App key issued from the Flashduty console under Account → APP Keys. Required on every public API call. Keep it secret — it grants the same access as the owning account.

Body

application/json
id
integer<uint64>

Rule ID. Required for update; omit for create (assigned by the server).

account_id
integer<uint64>

Account ID. Filled by the server from the authenticated identity; do not provide.

folder_id
integer<uint64>

ID of the folder the rule belongs to. Obtainable via POST /monit/folder/list.

name
string

Rule name. Must be unique within the same folder.

labels
object

Custom labels.

ds_type
string

Datasource type identifier; allowed values are listed by POST /monit/rule/dstypes (e.g. prometheus, elasticsearch).

ds_list
string[]

Data source name patterns (supports wildcards).

ds_ids
integer<uint64>[]

Datasource IDs, merged with ds_list to decide which datasources the rule monitors; IDs survive datasource renames. At least one of ds_list and ds_ids must be provided.

enabled
boolean

Whether the rule is enabled. Updating to false makes the server clean up the rule's active alerts.

debug_log_enabled
boolean

Whether to enable debug logging; the edge emits detailed evaluation logs, useful for troubleshooting rules that do not trigger as expected.

rule_configs
object

Check configuration: query list plus trigger/recovery conditions. Structure see RuleConfigs.

cron_pattern
string

Schedule expression: a 6-field cron (with seconds) or an @every 30s interval descriptor. Must not start with CRON_TZ= or TZ=; use the timezone field instead.

timezone
string
default:Asia/Shanghai

Timezone in which the rule executes. Determines how the cron schedule and effective time windows are interpreted. Only IANA timezone names are accepted (e.g. Asia/Shanghai, UTC, Europe/London); shortcuts and offsets such as Local, UTC+8, or CST are rejected. Treated as Asia/Shanghai if empty.

delay_seconds
integer

Seconds to shift the evaluation query window backward, compensating for data ingestion latency.

enabled_times
object[]

Time windows when the rule is active. Defaults to all days from 00:00 to 23:59 when omitted or empty.

annotations
object

Annotation key-value pairs delivered with alert events; keys must not start with $ (reserved for query fields).

description_type
enum<string>
default:text

Format for the description. Defaults to text when omitted or empty. text = plain text; markdown = Markdown, rendered as Markdown in alert details.

Available options:
text,
markdown
description
string

Rule description, in Markdown.

channel_ids
integer<uint64>[]

Channel IDs to send alerts to.

repeat_interval
integer<int64>

Notification repeat interval in seconds.

repeat_total
integer<int64>

Max number of repeat notifications.

creator_id
integer<uint64>

Creator user ID. Filled by the server from the current user; do not provide.

creator_name
string

Creator name. Filled by the server; do not provide.

updater_id
integer<uint64>

Last updater user ID. Filled by the server; do not provide.

updater_name
string

Last updater name. Filled by the server; do not provide.

created_at
integer<int64>

Creation time as a Unix timestamp in seconds. Generated by the server; do not provide.

updated_at
integer<int64>

Last update time as a Unix timestamp in seconds. Generated by the server; do not provide.

Response

Success

Success response envelope. On every 2xx response, request_id identifies the call (also mirrored in the Flashcat-Request-Id header) and data holds the endpoint-specific payload. Failure responses use a different shape — see ErrorResponse.

request_id
string
required

Unique ID for this request. Mirrored in the Flashcat-Request-Id response header. Include it when reporting issues.

Example:

"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"

data
object[]
required

Import result for each rule.