---
title: "Get a code scanning alert"
method: GET
path: "/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"
tags: ["code-scanning"]
---

# Get a code scanning alert

`GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}`

Gets a single code scanning alert. You must use an access token with the `security_events` scope to use this endpoint with private repos, the `public_repo` scope also grants permission to read security events on public repos only. GitHub Apps must have the `security_events` read permission to use this endpoint.

**Deprecation notice**:
The instances field is deprecated and will, in future, not be included in the response for this endpoint. The example response reflects this change. The same information can now be retrieved via a GET request to the URL specified by `instances_url`.

## Path parameters

- `owner` string, required
- `repo` string, required
- `alert_number` integer, required — The security alert number.

## Response `200`

Response

- CodeScanningAlert
  - `number` integer, required — The security alert number.
  - `created_at` string, date-time, required — The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
  - `updated_at` string, date-time — The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
  - `url` string, uri, required — The REST API URL of the alert resource.
  - `html_url` string, uri, required — The GitHub URL of the alert resource.
  - `instances_url` string, uri, required — The REST API URL for fetching the list of instances for an alert.
  - `state` 'open' | 'dismissed' | 'fixed', required — State of a code scanning alert.
  - `fixed_at` string, date-time, nullable — The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
  - `dismissed_by` NullableSimpleUser, nullable, required — A GitHub user.
    - `name` string, nullable
    - `email` string, nullable
    - `login` string, required
    - `id` integer, required
    - `node_id` string, required
    - `avatar_url` string, uri, required
    - `gravatar_id` string, nullable, required
    - `url` string, uri, required
    - `html_url` string, uri, required
    - `followers_url` string, uri, required
    - `following_url` string, required
    - `gists_url` string, required
    - `starred_url` string, required
    - `subscriptions_url` string, uri, required
    - `organizations_url` string, uri, required
    - `repos_url` string, uri, required
    - `events_url` string, required
    - `received_events_url` string, uri, required
    - `type` string, required
    - `site_admin` boolean, required
    - `starred_at` string
  - `dismissed_at` string, date-time, nullable, required — The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
  - `dismissed_reason` 'null' | 'false positive' | 'won't fix' | 'used in tests', nullable, required — **Required when the state is dismissed.** The reason for dismissing or closing the alert.
  - `rule` CodeScanningAlertRule, required
    - `id` string, nullable — A unique identifier for the rule used to detect the alert.
    - `name` string — The name of the rule used to detect the alert.
    - `severity` 'none' | 'note' | 'warning' | 'error', nullable — The severity of the alert.
    - `security_severity_level` 'low' | 'medium' | 'high' | 'critical', nullable — The security severity of the alert.
    - `description` string — A short description of the rule used to detect the alert.
    - `full_description` string — description of the rule used to detect the alert.
    - `tags` string[], nullable — A set of tags applicable for the rule.
    - `help` string, nullable — Detailed documentation for the rule as GitHub Flavored Markdown.
    - `help_uri` string, nullable — A link to the documentation for the rule used to detect the alert.
  - `tool` CodeScanningAnalysisTool, required
    - `name` string — The name of the tool used to generate the code scanning analysis.
    - `version` string, nullable — The version of the tool used to generate the code scanning analysis.
    - `guid` string, nullable — The GUID of the tool used to generate the code scanning analysis, if provided in the uploaded SARIF data.
  - `most_recent_instance` CodeScanningAlertInstance, required
    - `ref` string — The full Git reference, formatted as `refs/heads/<branch name>`, `refs/pull/<number>/merge`, or `refs/pull/<number>/head`.
    - `analysis_key` string — Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name.
    - `environment` string — 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.
    - `category` string — 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.
    - `state` 'open' | 'dismissed' | 'fixed' — State of a code scanning alert.
    - `commit_sha` string
    - `message` object
      - `text` string
    - `location` CodeScanningAlertLocation — Describe a region within a file for the alert.
      - `path` string
      - `start_line` integer
      - `end_line` integer
      - `start_column` integer
      - `end_column` integer
    - `html_url` string
    - `classifications` CodeScanningAlertClassification[] — Classifications that have been applied to the file that triggered the alert. For example identifying it as documentation, or a generated file.

## Other responses

- `304` — Not modified
- `403` — Response if GitHub Advanced Security is not enabled for this repository
- `404` — Resource not found
- `503` — Service unavailable

---

[API](https://skmtc.net/github/apis/ghes.md) · [All operations](https://skmtc.net/github/apis/ghes/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/ghes/revisions/ee6c7a46328e/schema)
