Create Project Issue Alert Rule
POST https://sentry.io/api/0/projects/{{organization_slug}}/:project_slug/rules/
Create an Issue Alert Rule for a Project
https://docs.sentry.io/api/alerts/create-an-issue-alert-rule-for-a-project/
POST/api/0/projects/{organizationslug}/{projectslug}/rules/
Create a new issue alert rule for the given project.
An issue alert rule triggers whenever a new event is received for any issue in a project that matches the specified alert conditions. These conditions can include a resolved issue re-appearing or an issue affecting many users. Alert conditions have three parts:
Triggers: specify what type of activity you'd like monitored or when an alert should be triggered.
Filters: help control noise by triggering an alert only if the issue matches the specified criteria.
Actions: specify what should happen when the trigger conditions are met and the filters match.
Path Parameters
organization_slug
(string)REQUIRED
The slug of the organization the resource belongs to.
project_slug
(string)REQUIRED
The slug of the project the resource belongs to.
Body Parameters
name
(string)REQUIRED
The name for the rule.
actionMatch
(string)REQUIRED
A string determining which of the conditions need to be true before any filters are evaluated.
all
- All conditions must evaluate to true.any
- At least one of the conditions must evaluate to true.none
- All conditions must evaluate to false.
conditions
(array(object))REQUIRED
A list of triggers that determine when the rule fires. See below for a list of possible conditions.
A new issue is created
JSONCopied
{
"id": "sentry.rules.conditions.first_seen_event.FirstSeenEventCondition"
}
The issue changes state from resolved to unresolved
JSONCopied
{
"id": "sentry.rules.conditions.regression_event.RegressionEventCondition"
}
The issue is seen more than value
times in interval
value
- An integerinterval
- Valid values are1m
,5m
,15m
,1h
,1d
,1w
and30d
(m
for minutes,h
for hours,d
for days, andw
for weeks).
JSONCopied
{
"id": "sentry.rules.conditions.event_frequency.EventFrequencyCondition",
"value": 500,
"interval": "1h"
}
The issue is seen by more than value
users in interval
value
- An integerinterval
- Valid values are1m
,5m
,15m
,1h
,1d
,1w
and30d
(m
for minutes,h
for hours,d
for days, andw
for weeks).
JSONCopied
{
"id": "sentry.rules.conditions.event_frequency.EventUniqueUserFrequencyCondition",
"value": 1000,
"interval": "15m"
}
The issue affects more than value
percent of sessions in interval
value
- An integer from 0 to 100interval
- Valid values are5m
,10m
,30m
, and1h
(m
for minutes,h
for hours).
JSONCopied
{
"id": "sentry.rules.conditions.event_frequency.EventFrequencyPercentCondition",
"value": 50,
"interval": "10m"
}
actions
(array(object))REQUIRED
A list of actions that take place when all required conditions and filters for the rule are met. See below for a list of possible actions.
Send a notification to Suggested Assignees
fallthroughType
- Who the notification should be sent to if there are no suggested assignees. Valid values areActiveMembers
,AllMembers
, andNoOne
.
JSONCopied
{
"id" - "sentry.mail.actions.NotifyEmailAction",
"targetType" - "IssueOwners",
"fallthroughType" - "ActiveMembers"
}
Send a notification to a Member or a Team
targetType
- One ofMember
orTeam
.fallthroughType
- Who the notification should be sent to if it cannot be sent to the original target. Valid values areActiveMembers
,AllMembers
, andNoOne
.targetIdentifier
- The ID of the Member or Team the notification should be sent to.
JSONCopied
{
"id": "sentry.mail.actions.NotifyEmailAction",
"targetType": "Team"
"fallthroughType": "AllMembers"
"targetIdentifier": 4524986223
}
Send a Slack notification
workspace
- The integration ID associated with the Slack workspace.channel
- The name of the channel to send the notification to (e.g., #critical, Jane Schmidt).channel_id
(optional) - The ID of the channel to send the notification to.tags
- A string of tags to show in the notification, separated by commas (e.g.,environment, user, my_tag
).
JSONCopied
{
"id": "sentry.integrations.slack.notify_action.SlackNotifyServiceAction",
"workspace": 293854098,
"channel": "#warning",
"tags": "environment,level"
}
Send a Microsoft Teams notification
team
- The integration ID associated with the Microsoft Teams team.channel
- The name of the channel to send the notification to.
JSONCopied
{
"id": "sentry.integrations.msteams.notify_action.MsTeamsNotifyServiceAction",
"team": 23465424,
"channel": "General"
}
Send a Discord notification
server
- The integration ID associated with the Discord server.channel_id
- The ID of the channel to send the notification to.tags
- A string of tags to show in the notification, separated by commas (e.g.,environment, user, my_tag
).
JSONCopied
{
"id": "sentry.integrations.discord.notify_action.DiscordNotifyServiceAction",
"server": 63408298,
"channel_id": 94732897,
"tags": "browser,user"
}
Create a Jira Ticket
integration
- The integration ID associated with Jira.project
- The ID of the Jira project.issuetype
- The ID of the type of issue that the ticket should be created as.dynamic_form_fields
(optional) - A list of any custom fields you want to include in the ticket as objects.
JSONCopied
{
"id": "sentry.integrations.jira.notify_action.JiraCreateTicketAction",
"integration": 321424,
"project": "349719"
"issueType": "1"
}
Create a Jira Server Ticket
integration
- The integration ID associated with Jira Server.project
- The ID of the Jira Server project.issuetype
- The ID of the type of issue that the ticket should be created as.dynamic_form_fields
(optional) - A list of any custom fields you want to include in the ticket as objects.
JSONCopied
{
"id": "sentry.integrations.jira_server.notify_action.JiraServerCreateTicketAction",
"integration": 321424,
"project": "349719"
"issueType": "1"
}
Create a GitHub Issue
integration
- The integration ID associated with GitHub.repo
- The name of the repository to create the issue in.title
- The title of the issue.body
(optional) - The contents of the issue.assignee
(optional) - The GitHub user to assign the issue to.labels
(optional) - A list of labels to assign to the issue.
JSONCopied
{
"id": "sentry.integrations.github.notify_action.GitHubCreateTicketAction",
"integration": 93749,
"repo": default,
"title": "My Test Issue",
"assignee": "Baxter the Hacker",
"labels": ["bug", "p1"]
""
}
Create an Azure DevOps work item
integration
- The integration ID.project
- The ID of the Azure DevOps project.work_item_type
- The type of work item to create.dynamic_form_fields
(optional) - A list of any custom fields you want to include in the work item as objects.
JSONCopied
{
"id": "sentry.integrations.vsts.notify_action.AzureDevopsCreateTicketAction",
"integration": 294838,
"project": "0389485",
"work_item_type": "Microsoft.VSTS.WorkItemTypes.Task",
}
Send a PagerDuty notification
account
- The integration ID associated with the PagerDuty account.service
- The ID of the service to send the notification to.
JSONCopied
{
"id": "sentry.integrations.pagerduty.notify_action.PagerDutyNotifyServiceAction",
"account": 92385907,
"service": 9823924
}
Send an Opsgenie notification
account
- The integration ID associated with the Opsgenie account.team
- The ID of the Opsgenie team to send the notification to.
JSONCopied
{
"id": "sentry.integrations.opsgenie.notify_action.OpsgenieNotifyTeamAction",
"account": 8723897589,
"team": "9438930258-fairy"
}
Send a notification to a service
service
- The plugin slug.
JSONCopied
{
"id": "sentry.rules.actions.notify_event_service.NotifyEventServiceAction",
"service": "mail"
}
Send a notification to a Sentry app with a custom webhook payload
settings
- A list of objects denoting the settings each action will be created with. All required fields must be included.sentryAppInstallationUuid
- The ID for the Sentry app
JSONCopied
{
"id": "sentry.rules.actions.notify_event_sentry_app.NotifyEventSentryAppAction",
"settings": [
{"name": "title", "value": "Team Rocket"},
{"name": "summary", "value": "We're blasting off again."},
],
"sentryAppInstallationUuid": 643522
"hasSchemaFormConfig": true
}
Send a notification (for all legacy integrations)
JSONCopied
{
"id": "sentry.rules.actions.notify_event.NotifyEventAction"
}
frequency
(integer)REQUIRED
How often to perform the actions once for an issue, in minutes. The valid range is 5
to 43200
.
environment
(string)
The name of the environment to filter by.
filterMatch
(string)
A string determining which filters need to be true before any actions take place. Required when a value is provided for filters
.
all
- All filters must evaluate to true.any
- At least one of the filters must evaluate to true.none
- All filters must evaluate to false.
filters
(array(object))
A list of filters that determine if a rule fires after the necessary conditions have been met. See below for a list of possible filters.
The issue is comparison_type
than value
time
comparison_type
- One ofolder
ornewer
value
- An integertime
- The unit of time. Valid values areminute
,hour
,day
, andweek
.
JSONCopied
{
"id": "sentry.rules.filters.age_comparison.AgeComparisonFilter",
"comparison_type": "older",
"value": 3,
"time": "week"
}
The issue has happened at least value
times
value
- An integer
JSONCopied
{
"id": "sentry.rules.filters.issue_occurrences.IssueOccurrencesFilter",
"value": 120
}
The issue is assigned to No One
JSONCopied
{
"id": "sentry.rules.filters.assigned_to.AssignedToFilter",
"targetType": "Unassigned"
}
The issue is assigned to targetType
targetType
- One ofTeam
orMember
targetIdentifier
- The target's ID
JSONCopied
{
"id": "sentry.rules.filters.assigned_to.AssignedToFilter",
"targetType": "Member",
"targetIdentifier": 895329789
}
The event is from the latest release
JSONCopied
{
"id": "sentry.rules.filters.latest_release.LatestReleaseFilter"
}
The issue's category is equal to value
value
- An integer correlated with a category. Valid values are1
(Error),2
(Performance),3
(Profile),4
(Cron), and5
(Replay).
JSONCopied
{
"id": "sentry.rules.filters.issue_category.IssueCategoryFilter",
"value": 2
}
The event's attribute
value match
value
attribute
- Valid values aremessage
,platform
,environment
,type
,error.handled
,error.unhandled
,error.main_thread
,exception.type
,exception.value
,user.id
,user.email
,user.username
,user.ip_address
,http.method
,http.url
,http.status_code
,sdk.name
,stacktrace.code
,stacktrace.module
,stacktrace.filename
,stacktrace.abs_path
,stacktrace.package
,unreal.crashtype
, andapp.in_foreground
.match
- The comparison operator. Valid values areeq
(equals),ne
(does not equal),sw
(starts with),ew
(ends with),co
(contains),nc
(does not contain),is
(is set), andns
(is not set).value
- A string. Not required whenmatch
isis
orns
.
JSONCopied
{
"id": "sentry.rules.conditions.event_attribute.EventAttributeCondition",
"attribute": "http.url",
"match": "nc",
"value": "localhost"
}
The event's tags match key
match
value
key
- The tagmatch
- The comparison operator. Valid values areeq
(equals),ne
(does not equal),sw
(starts with),ew
(ends with),co
(contains),nc
(does not contain),is
(is set), andns
(is not set).value
- A string. Not required whenmatch
isis
orns
.
JSONCopied
{
"id": "sentry.rules.filters.tagged_event.TaggedEventFilter",
"key": "level",
"match": "eq"
"value": "error"
}
The event's level is match
level
match
- Valid values areeq
,gte
, andlte
.level
- Valid values are50
(fatal),40
(error),30
(warning),20
(info),10
(debug),0
(sample).
JSONCopied
{
"id": "sentry.rules.filters.level.LevelFilter",
"match": "gte"
"level": "50"
}
owner
(string)
The ID of the team or user that owns the rule.
Scopes
You need to authenticate via bearer auth token. requires one of the following scopes:
alerts:write
project:admin
project:write
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
cursor | string |
Request Body
{"conditions"=>[{"id"=>"sentry.rules.conditions.first_seen_event.FirstSeenEventCondition", "label"=>"label...", "name"=>"A new issue is created"}], "filters"=>[{"match"=>"co", "id"=>"sentry.rules.filters.tagged_event.TaggedEventFilter", "key"=>"release", "value"=>"23.10.1", "name"=>"The event's tags match release contains 23.10.1"}], "actions"=>[{"targetType"=>"Member", "fallthroughType"=>"ActiveMembers", "id"=>"sentry.mail.actions.NotifyEmailAction", "targetIdentifier"=>2090953, "name"=>"Send a notification to Member"}], "actionMatch"=>"any", "filterMatch"=>"all", "frequency"=>1440, "name"=>"Issue Alert via API", "owner"=>"team:1168178", "createdBy"=>{"id"=>2090953, "name"=>"dirk.nielsen@sentry.io", "email"=>"dirk.nielsen@sentry.io"}, "environment"=>"production", "status"=>"active", "snooze"=>false}