PATCH
/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}Update a code scanning alert
Updates the status of a single code scanning alert.
OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
alert_numberintegerrequired
The number that identifies an alert. You can find this at the end of the URL for a code scanning alert within GitHub, and in the `number` field in the response from the `GET /repos/{owner}/{repo}/code-scanning/alerts` operation.
statestringrequired
Sets the state of the code scanning alert. You must provide `dismissed_reason` when you set the state to `dismissed`.
dismissed_reasonstringoptional
**Required when the state is dismissed.** The reason for dismissing or closing the alert.
dismissed_commentstringoptional
The dismissal comment associated with the dismissal of the alert.
create_requestbooleanoptional
If `true`, attempt to create an alert dismissal request.
assigneesarray<string>optional
The list of users to assign to the code scanning alert. An empty array unassigns all previous assignees from the alert.
200Response
numberintegerrequired
The security alert number.
created_atstringrequired
The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
updated_atstringoptional
The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
urlstringrequired
The REST API URL of the alert resource.
html_urlstringrequired
The GitHub URL of the alert resource.
instances_urlstringrequired
The REST API URL for fetching the list of instances for an alert.
statestringrequired
State of a code scanning alert.
fixed_atstringoptional
The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
dismissed_byobjectrequired
A GitHub user.
dismissed_atstringrequired
The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
dismissed_reasonstringrequired
**Required when the state is dismissed.** The reason for dismissing or closing the alert.
dismissed_commentstringoptional
The dismissal comment associated with the dismissal of the alert.
ruleobjectrequired
toolobjectrequired
most_recent_instanceobjectrequired
dismissal_approved_byobjectoptional
A GitHub user.
assigneesarray<SimpleUser>optional
linked_pull_requestsarray<PullRequestSimple>optional
Pull requests linked to this alert.
400Bad Request
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Response if the repository is archived or if GitHub Advanced Security is not enabled for this repository
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
503Service unavailable
codestringoptional
messagestringoptional
documentation_urlstringoptional
Error handling
A 400 is returned: Bad Request. A 403 is returned: Response if the repository is archived or if GitHub Advanced Security is not enabled for this repository. A 404 is returned: Resource not found. A 503 is returned: Service unavailable.