List code scanning alerts for a repository

GET {{baseUrl}}/repos/:owner/:repo/code-scanning/alerts?state=open&ref=<string>

Lists all open code scanning alerts for the default branch (usually master) and protected branches in a repository. You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events read permission to use this endpoint.

Request Params

KeyDatatypeRequiredDescription
statestringSet to closed to list only closed code scanning alerts.
refstringReturns a list of code scanning alerts for a specific brach reference. The ref must be formatted as heads/&lt;branch name&gt;.

RESPONSES

status: OK

[{&quot;number&quot;:42,&quot;rule_id&quot;:&quot;js/trivial-conditional&quot;,&quot;rule_severity&quot;:&quot;warning&quot;,&quot;rule_description&quot;:&quot;Useless conditional&quot;,&quot;tool&quot;:&quot;CodeQL&quot;,&quot;created_at&quot;:&quot;2020-05-06T12:00:00Z&quot;,&quot;open&quot;:true,&quot;closed_by&quot;:null,&quot;closed_at&quot;:null,&quot;url&quot;:&quot;https://api.github.com/repos/Octo-org/octo-repo/code-scanning/alerts/25&quot;,&quot;html_url&quot;:&quot;https://github.com/Octo-org/octo-repo/security/code-scanning/25&quot;},{&quot;number&quot;:43,&quot;rule_id&quot;:&quot;js/useless-expression&quot;,&quot;rule_severity&quot;:&quot;warning&quot;,&quot;rule_description&quot;:&quot;Expression has no effect&quot;,&quot;tool&quot;:&quot;CodeQL&quot;,&quot;created_at&quot;:&quot;2020-05-06T12:00:00Z&quot;,&quot;open&quot;:true,&quot;closed_by&quot;:null,&quot;closed_at&quot;:null,&quot;url&quot;:&quot;https://api.github.com/repos/Octo-org/octo-repo/code-scanning/alerts/88&quot;,&quot;html_url&quot;:&quot;https://github.com/Octo-org/octo-repo/security/code-scanning/88&quot;}]