Skip to content
Docs GitHub

alert

Manage Sentry alert rules

List issue alert rules

Arguments:

ArgumentDescription
<org/project><org>/ (all projects), <org>/<project>, or <project> (search)

Options:

OptionDescription
-w, --webOpen in browser
-n, --limit <limit>Maximum number of issue alert rules to list (default: "25")
-q, --query <query>Filter rules by name
-c, --cursor <cursor>Pagination cursor (use "next" for next page, "prev" for previous)
-f, --freshBypass cache, re-detect projects, and fetch fresh data

sentry alert issues view <org/project/rule-id-or-name>

Section titled “sentry alert issues view <org/project/rule-id-or-name>”

View an issue alert rule

Arguments:

ArgumentDescription
<org/project/rule-id-or-name>Issue alert rule ID or name

Options:

OptionDescription
-w, --webOpen issue alert rules page in browser

Create an issue alert rule

Arguments:

ArgumentDescription
<target><org>/<project>, auto-detected project, or <project> (search)

Options:

OptionDescription
--name <name>Rule name
-c, --condition <condition>...Condition object JSON (repeatable, or pass one JSON array)
-a, --action <action>...Action object JSON (repeatable, or pass one JSON array)
-m, --action-match <action-match>Condition/action match mode: all or any
--frequency <frequency>Frequency in minutes (default: 30)
--environment <environment>Environment filter
--filter <filter>...Filter object JSON (repeatable, or pass one JSON array)
--filter-match <filter-match>Filter match mode: all or any
--owner <owner>Owner (team:user style value accepted by Sentry API)
-n, --dry-runShow what would happen without making changes

sentry alert issues delete <org/project/rule-id-or-name>

Section titled “sentry alert issues delete <org/project/rule-id-or-name>”

Delete an issue alert rule

Arguments:

ArgumentDescription
<org/project/rule-id-or-name>Rule id or name (same as view)

Options:

OptionDescription
-y, --yesSkip confirmation prompt
-f, --forceForce the operation without confirmation
-n, --dry-runShow what would happen without making changes

sentry alert issues edit <org/project/rule-id-or-name>

Section titled “sentry alert issues edit <org/project/rule-id-or-name>”

Edit an issue alert rule

Arguments:

ArgumentDescription
<org/project/rule-id-or-name>Rule id or name (same as view)

Options:

OptionDescription
--name <name>New rule name
--status <status>Rule status: active or disabled
-c, --condition <condition>...Condition object JSON (repeatable, or pass one JSON array)
-a, --action <action>...Action object JSON (repeatable, or pass one JSON array)
-m, --action-match <action-match>Condition/action match mode: all or any
--frequency <frequency>Frequency in minutes
--environment <environment>Environment value (pass empty string to clear)
--filter <filter>...Filter object JSON (repeatable, or pass one JSON array)
--filter-match <filter-match>Filter match mode: all or any
--owner <owner>Owner value (pass empty string to clear)

List metric alert rules

Arguments:

ArgumentDescription
<target><org>/, <org>/<project> (project ignored), or <project> (search)

Options:

OptionDescription
-w, --webOpen in browser
-n, --limit <limit>Maximum number of metric alert rules to list (default: "25")
-q, --query <query>Filter rules by name
-c, --cursor <cursor>Pagination cursor (use "next" for next page, "prev" for previous)
-f, --freshBypass cache, re-detect projects, and fetch fresh data

sentry alert metrics view <org/rule-id-or-name>

Section titled “sentry alert metrics view <org/rule-id-or-name>”

View a metric alert rule

Arguments:

ArgumentDescription
<org/rule-id-or-name>Metric alert rule ID or name

Options:

OptionDescription
-w, --webOpen metric alert rules page in browser

Create a metric alert rule

Arguments:

ArgumentDescription
<org>Target organization

Options:

OptionDescription
--name <name>Rule name
--query <query>Metric query filter string
--aggregate <aggregate>Aggregate expression (for example count(), p95(transaction.duration))
--dataset <dataset>Dataset (errors, transactions, sessions, events, spans, metrics)
--time-window <time-window>Evaluation window in minutes
-t, --trigger <trigger>...Trigger object JSON (repeatable, or pass one JSON array)
-p, --project <project>...Project slug filter (repeatable or comma-separated)
--environment <environment>Environment filter
--owner <owner>Owner value accepted by Sentry API
-n, --dry-runShow what would happen without making changes

sentry alert metrics delete <org/rule-id-or-name>

Section titled “sentry alert metrics delete <org/rule-id-or-name>”

Delete a metric alert rule

Arguments:

ArgumentDescription
<org/rule-id-or-name>Rule id or name (same as view)

Options:

OptionDescription
-y, --yesSkip confirmation prompt
-f, --forceForce the operation without confirmation
-n, --dry-runShow what would happen without making changes

sentry alert metrics edit <org/rule-id-or-name>

Section titled “sentry alert metrics edit <org/rule-id-or-name>”

Edit a metric alert rule

Arguments:

ArgumentDescription
<org/rule-id-or-name>Rule id or name (same as view)

Options:

OptionDescription
--name <name>New rule name
--status <status>active or disabled
--query <query>Metric query filter
--aggregate <aggregate>Aggregate expression
--dataset <dataset>Dataset (errors, transactions, sessions, events, spans, metrics)
--time-window <time-window>Evaluation window in minutes
-t, --trigger <trigger>...Trigger object JSON (repeatable, or pass one JSON array)
-p, --project <project>...Project slug filter (repeatable or comma-separated)
--environment <environment>Environment value (pass empty string to clear)
--owner <owner>Owner value (pass empty string to clear)

All commands support --json for machine-readable output and --fields to select specific JSON fields.

Terminal window
# Create an issue alert rule with inline JSON condition/action
sentry alert issues create my-org/my-project \
--name "Error Spike" \
--condition '{"id":"sentry.rules.conditions.first_seen_event.FirstSeenEventCondition"}' \
--action '{"id":"sentry.mail.actions.NotifyEmailAction","targetType":"Team","targetIdentifier":1}' \
--action-match any
Terminal window
# List issue alert rules for a project
sentry alert issues list my-org/my-project
# Filter rules by name
sentry alert issues list my-org/my-project --query "spike"
Terminal window
# View by ID
sentry alert issues view my-org/my-project/12345
# View by name
sentry alert issues view my-org/my-project/"Error Spike"
Terminal window
# Edit issue alert name/status
sentry alert issues edit my-org/my-project/12345 --name "Prod Error Spike" --status disabled
Terminal window
# Delete with preview
sentry alert issues delete my-org/my-project/12345 --dry-run
Terminal window
# Create an organization metric alert rule
sentry alert metrics create my-org \
--name "P95 Latency" \
--query "environment:prod" \
--aggregate "p95(transaction.duration)" \
--dataset transactions \
--time-window 5 \
--trigger '{"alertThreshold":500,"actions":[{"id":"sentry.mail.actions.NotifyEmailAction","targetType":"Team","targetIdentifier":1}]}'
Terminal window
# List metric alert rules for an organization
sentry alert metrics list my-org/
Terminal window
# View by ID
sentry alert metrics view my-org/67890
# View by name
sentry alert metrics view my-org/"P95 latency alert"
Terminal window
# Edit metric alert query/window
sentry alert metrics edit my-org/67890 --query "environment:prod event.type:error" --time-window 15
Terminal window
# Delete without prompt
sentry alert metrics delete my-org/67890 --yes