Update a code scanning alert
Updates the status of a single code scanning alert. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` write permission to use this endpoint.
/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}- Source
github-v3-rest.json- Revision
f5f067c1e6f6- Active snapshot
85e53e3d0d65
Request
Path Parameters
- owner stringrequired
- repo stringrequired
- alert_number alert-number integerrequired
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.
Body Params
requiredAllowed: null, "false positive", "won't fix", "used in tests"
**Required when the state is dismissed.** The reason for dismissing or closing the alert. Can be one of: `false positive`, `won't fix`, and `used in tests`.
Allowed: "open", "dismissed"
Sets the state of the code scanning alert. Can be one of `open` or `dismissed`. You must provide `dismissed_reason` when you set the state to `dismissed`.
Responses
Response
The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
dismissed_by Simple User objectrequirednullable Simple User
Simple User
Example: https://github.com/images/error/octocat_happy.gif
Example: https://api.github.com/users/octocat/events{/privacy}
Example: https://api.github.com/users/octocat/followers
Example: https://api.github.com/users/octocat/following{/other_user}
Example: https://api.github.com/users/octocat/gists{/gist_id}
Example: 41d064eb2195891e12d0413f63227ea7
Example: https://github.com/octocat
Example: 1
Example: octocat
Example: MDQ6VXNlcjE=
Example: https://api.github.com/users/octocat/orgs
Example: https://api.github.com/users/octocat/received_events
Example: https://api.github.com/users/octocat/repos
Example: "2020-07-09T00:17:55Z"
Example: https://api.github.com/users/octocat/starred{/owner}{/repo}
Example: https://api.github.com/users/octocat/subscriptions
Example: User
Example: https://api.github.com/users/octocat
Allowed: null, "false positive", "won't fix", "used in tests"
**Required when the state is dismissed.** The reason for dismissing or closing the alert. Can be one of: `false positive`, `won't fix`, and `used in tests`.
The GitHub URL of the alert resource.
The REST API URL for fetching the list of instances for an alert.
most_recent_instance code-scanning-alert-instance objectrequired
Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name.
Identifies the configuration under which the analysis was executed. Used to distinguish between multiple analyses for the same tool and commit, but performed on different languages or different parts of the code.
Classifications that have been applied to the file that triggered the alert. For example identifying it as documentation, or a generated file.
Identifies the variable values associated with the environment in which the analysis that generated this alert instance was performed, such as the language that was analyzed.
location code-scanning-alert-location objectoptionalDescribe a region within a file for the alert.
Describe a region within a file for the alert.
message objectoptional
The full Git reference, formatted as `refs/heads/<branch name>`, `refs/pull/<number>/merge`, or `refs/pull/<number>/head`.
Allowed: "open", "closed", "dismissed", "fixed"
State of a code scanning alert.
The security alert number.
rule code-scanning-alert-rule objectrequired
A short description of the rule used to detect the alert.
description of the rule used to detect the alert.
Detailed documentation for the rule as GitHub Flavored Markdown.
A unique identifier for the rule used to detect the alert.
The name of the rule used to detect the alert.
The severity of the alert.
A set of tags applicable for the rule.
Allowed: "open", "closed", "dismissed", "fixed"
State of a code scanning alert.
tool code-scanning-analysis-tool objectrequired
The GUID of the tool used to generate the code scanning analysis, if provided in the uploaded SARIF data.
The name of the tool used to generate the code scanning analysis.
The version of the tool used to generate the code scanning analysis.
The REST API URL of the alert resource.
Response if the repository is archived or if github advanced security is not enabled for this repository
Resource not found
Service unavailable