apicheats.dev github/llms.txt Raw .md
GET

GET /repos/{owner}/{repo}/code-scanning/analyses — GitHub API

GitHub token (required); https://api.github.com

GitHub API

List code scanning analyses for a repository

Base URL
https://api.github.com
Auth
Authorization: Bearer <GITHUB_API_KEY>
Last verified
2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 402 tokens · Vary: Accept

Critical gotchas

GitHub recommends an Accept: application/vnd.github+json header and an explicit X-GitHub-Api-Version header.

Fine-grained tokens only authorize repositories and permissions selected when the token is created.

cURL

curl -X GET 'https://api.github.com/repos/example-owner/example-repo/code-scanning/analyses?tool_name=example-tool-name&tool_guid=example-tool-guid&page=1&per_page=30&pr=10&ref=example-ref&sarif_id=6c81cd8e-b078-4ac3-a3be-1dad7dbd0b53&direction=desc&sort=created' \  -H "Authorization: Bearer $GITHUB_TOKEN" \  -H 'Accept: application/vnd.github+json' \  -H 'X-GitHub-Api-Version: 2026-03-10'

Parameters

Name In Type Required Description
owner path string Yes The account owner of the repository. The name is not case sensitive.
repo path string Yes The name of the repository without the `.git` extension. The name is not case sensitive.
tool_name query 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.
tool_guid query 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.
page query integer No The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
per_page query integer No The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
pr query integer No The number of the pull request for the results you want to list.
ref query 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`.
sarif_id query string No Filter analyses belonging to the same SARIF upload.
direction query string No The direction to sort the results by.
sort query string No The property by which to sort the results.

Response 200 OK

[
  {
    "ref": "string",
    "commit_sha": "string",
    "analysis_key": "string",
    "environment": "string",
    "category": "string",
    "error": "error reading field xyz",
    "created_at": "2026-09-03T00:00:00Z",
    "results_count": 0,
    "rules_count": 0,
    "id": 0,
    "url": "https://example.com",
    "sarif_id": "6c81cd8e-b078-4ac3-a3be-1dad7dbd0b53",
    "tool": {
      "name": "string",
      "version": "string",
      "guid": "string"
    },
    "deletable": true,
    "warning": "123 results were ignored"
  }
]
Get a free GitHub API key → sponsored

Affiliate link - we may earn a commission, at no extra cost to you.