GET /repos/{owner}/{repo}/code-scanning/analyses

Lists the details of all code scanning analyses for a repository, starting with the most recent. The response is paginated and you can use the page and per_page parameters to list the analyses you're interested in. By default 30 analyses are listed per page.

The rules_count field in the response give the number of rules that were run in the analysis. For very old analyses this data is not available, and 0 is returned in this field.

[!WARNING] Closing down notice: The tool_name field is closing down and will, in future, not be included in the response for this endpoint. The example response reflects this change. The tool name can now be found inside the tool field.

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.

Servers

Path parameters

Name Type Required Description
repo String Yes

The name of the repository without the .git extension. The name is not case sensitive.

owner String Yes

The account owner of the repository. The name is not case sensitive.

Query parameters

Name Type Required Description
page Integer No

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Default value: 1

direction String No

The direction to sort the results by.

Possible values:

  • "desc"
  • "asc"

Default value: "desc"

tool_name String No

The name of a code scanning tool. Only results by this tool will be listed. You can specify the tool by using either tool_name or tool_guid, but not both.

per_page Integer No

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Default value: 30

sort String No

The property by which to sort the results.

Possible values:

  • "created"

Default value: "created"

pr Integer No

The number of the pull request for the results you want to list.

ref String No

The Git reference for the analyses you want to list. The ref for a branch can be formatted either as refs/heads/<branch name> or simply <branch name>. To reference a pull request use refs/pull/<number>/merge.

tool_guid String No

The GUID of a code scanning tool. Only results by this tool will be listed. Note that some code scanning tools may not include a GUID in their analysis data. You can specify the tool by using either tool_guid or tool_name, but not both.

sarif_id String No

Filter analyses belonging to the same SARIF upload.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.