Skip to main content
POST
Create Automation rule

Restrictions

Usage

  • A caller may create personal rules and rules for any team in the current account; team_id is immutable after creation.
  • cron_expr is evaluated in timezone if provided, else the caller’s member timezone, else the account timezone, else UTC.
  • http_post_trigger_enabled=true creates and enables an HTTP POST trigger; the response’s http_post_token is a one-time value returned only on creation — save it immediately.
  • oncall_incident_trigger_enabled=true requires at least one oncall_incident_channel_ids entry and one oncall_incident_severities value; matching incidents run with trigger_kind=oncall_incident.
  • Every call is recorded in the account audit log.

Authorizations

app_key
string
query
required

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

Body

application/json

Create an Automation rule.

name
string
required

Rule name.

Required string length: 1 - 255
cron_expr
string
required

Run cadence. Supports 4 fields (hour day month weekday, minute defaults to 0) and 5 fields (minute hour day month weekday). The minute must be one fixed integer; 6-field seconds are not supported. A cron that sets both day-of-month and day-of-week is rejected. The create API currently requires this field even for HTTP-POST-only rules; send a valid cron and set schedule_trigger_enabled=false.

Example:

"15 9 * * *"

prompt
string
required

Task prompt sent to the AI SRE agent on each run.

Minimum string length: 1
team_id
integer<int64>

Scope team ID. 0 or omitted means a personal rule; >0 means a team in the account. Immutable after creation.

Required range: x >= 0
enabled
boolean

Whether the rule is enabled after creation. Omitted API value is false; Chat/CLI create sends true by default unless the user asks for disabled.

timezone
string

IANA timezone cron_expr is evaluated in, e.g. Asia/Shanghai. Must be a timezone name loadable by the server; an invalid value is rejected. Defaults to the caller's member timezone, then the account timezone, then UTC when omitted.

schedule_trigger_enabled
boolean | null

Whether the schedule trigger is enabled. Defaults to true when omitted; HTTP-POST-only rules should send false.

environment_kind
enum<string>

Runtime environment kind. Omit or send an empty value for automatic selection.

Available options:
,
cloud,
byoc
environment_id
string

BYOC Runner ID. Used only when environment_kind=byoc.

http_post_trigger_enabled
boolean

Whether to create and enable an HTTP POST trigger. When enabled, the response includes a one-time token.

oncall_incident_trigger_enabled
boolean

Whether the On-call incident trigger is enabled.

oncall_incident_channel_ids
integer<int64>[]

On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID.

Required range: x >= 1
oncall_incident_severities
enum<string>[]

Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value.

Available options:
Critical,
Warning,
Info

Response

Success

Standard response envelope used by every Flashduty public API. On success data contains the endpoint-specific payload and error is absent. On failure error is present and data is absent. request_id is always present and is also mirrored in the Flashcat-Request-Id response header.

request_id
string
required

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

Example:

"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"

error
object

Error payload inside the response envelope. Present only on non-2xx responses.

data
object

Automation rule.