List recent code scanning analyses for a repository

List the details of recent code scanning analyses for 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.


string The token will be passed in the authorization header.



string Set a full Git reference to list alerts for a specific branch. The ref must be formatted as refs/heads/<branch name>.

string Set a single code scanning tool name to filter alerts by tool.


GET https://api.github.com/repos///code-scanning/analyses
authorization: bearer undefined
accept: application/vnd.github.v3+json
user-agent: octokit.rest

Example Response

Status: 200
    "ref": "refs/heads/master",
    "commit_sha": "d99612c3e1f2970085cfbaeadf8f010ef69bad83",
    "analysis_key": ".github/workflows/codeql-analysis.yml:analyze",
    "tool_name": "CodeQL command-line toolchain",
    "environment": "{}",
    "error": "",
    "created_at": "2020-08-27T15:05:21Z"
    "ref": "refs/heads/my-branch",
    "commit_sha": "c8cff6510d4d084fb1b4aa13b64b97ca12b07321",
    "analysis_key": ".github/workflows/shiftleft.yml:build",
    "tool_name": "Python Security Analysis",
    "environment": "{}",
    "error": "",
    "created_at": "2020-08-31T22:46:44Z"

See documentation on GitHub developer guides