Skip to main content
POST
/
safari
/
automation
/
rule
/
create
Create Automation rule
curl --request POST \
  --url 'https://api.flashcat.cloud/safari/automation/rule/create?app_key=' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "name": "Weekly on-call review",
  "team_id": 123,
  "enabled": true,
  "cron_expr": "0 9 * * 1",
  "schedule_trigger_enabled": true,
  "prompt": "Summarize last week's alert noise and escalation load.",
  "http_post_trigger_enabled": true,
  "oncall_incident_trigger_enabled": true,
  "oncall_incident_channel_ids": [
    456
  ],
  "oncall_incident_severities": [
    "Critical",
    "Warning"
  ]
}
EOF
{
  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
  "data": {
    "rule_id": "auto_7NnLzY2Qp8xS4kUaV3mR6b",
    "account_id": 10023,
    "team_id": 123,
    "owner_id": 80011,
    "name": "Weekly on-call review",
    "enabled": true,
    "run_scope": "team",
    "cron_expr": "0 9 * * 1",
    "prompt": "Summarize last week's alert noise and escalation load.",
    "environment_kind": "",
    "environment_id": "",
    "schedule_trigger_id": "autotrg_6aKp3wT9mQ2xVc8bR1nY7z",
    "schedule_trigger_enabled": true,
    "http_post_trigger_id": "autotrg_2bLq4xT8mP1sWd9cN3rF6y",
    "http_post_trigger_url": "/safari/automation/triggers/autotrg_2bLq4xT8mP1sWd9cN3rF6y/fire",
    "http_post_trigger_enabled": true,
    "can_edit": true,
    "created_at": 1780367971228,
    "updated_at": 1780367971228,
    "http_post_token": "sat_yQ9p8V7n6M5k4J3h2G1f0E9d8C7b6A5z4Y3x2W1v0U",
    "schedule_next_fire_at_ms": 1780630800000,
    "oncall_incident_trigger_id": "autotrg_9cVb2mN7qKs4dEa8T1rY5p",
    "oncall_incident_trigger_enabled": true,
    "oncall_incident_channel_ids": [
      456
    ],
    "oncall_incident_severities": [
      "Critical",
      "Warning"
    ]
  }
}

Restrictions

AspectValue
Rate limits1,000 requests/minute; 50 requests/second per account
PermissionsValid app_key; management operations require the caller to manage the target rule

Usage

  • A caller may create personal rules and rules for any team in the current account; team_id is immutable after creation.
  • List visibility follows session-list visibility: owners/admins see all rules; ordinary members see rules they created and rules for their teams.
  • http_post_token is returned only when creating or rotating the token. Save it immediately.
  • To trigger from On-call incidents, send oncall_incident_trigger_enabled, oncall_incident_channel_ids, and oncall_incident_severities; matching events run with trigger_kind=oncall_incident.

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. 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.

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.