---
title: "List secret scanning alerts for a repository"
method: GET
path: "/repos/{owner}/{repo}/secret-scanning/alerts"
tags: ["secret-scanning"]
---

# List secret scanning alerts for a repository

`GET /repos/{owner}/{repo}/secret-scanning/alerts`

Lists secret scanning alerts for an eligible repository, from newest to oldest.

The authenticated user must be an administrator for the repository or for the organization that owns the repository to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the `repo` or `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead.

## Path parameters

- `owner` string, required
- `repo` string, required

## Query parameters

- `state` 'open' | 'resolved'
- `secret_type` string
- `exclude_secret_types` string
- `exclude_providers` string
- `providers` string
- `resolution` string
- `assignee` string
- `sort` 'created' | 'updated'
- `direction` 'asc' | 'desc'
- `page` integer
- `per_page` integer
- `before` string
- `after` string
- `validity` string
- `is_publicly_leaked` boolean
- `is_multi_repo` boolean
- `hide_secret` boolean
- `is_bypassed` boolean
- `included_metadata` string
- `owner_email_hash` string

## Response `200`

Response

- SecretScanningAlert[]
  - `number` integer — The security alert number.
  - `created_at` string, date-time — The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
  - `updated_at` string, date-time, nullable — The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
  - `url` string, uri — The REST API URL of the alert resource.
  - `html_url` string, uri — The GitHub URL of the alert resource.
  - `locations_url` string, uri — The REST API URL of the code locations for this alert.
  - `state` 'open' | 'resolved' — Sets the state of the secret scanning alert. You must provide `resolution` when you set the state to `resolved`.
  - `resolution` 'false_positive' | 'wont_fix' | 'revoked' | 'used_in_tests', nullable — **Required when the `state` is `resolved`.** The reason for resolving the alert.
  - `resolved_at` string, date-time, nullable — The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
  - `resolved_by` NullableSimpleUser, nullable — 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
    - `user_view_type` string
  - `resolution_comment` string, nullable — An optional comment to resolve an alert.
  - `secret_type` string — The type of secret that secret scanning detected.
  - `secret_type_display_name` string — User-friendly name for the detected secret, matching the `secret_type`. For a list of built-in patterns, see "[Supported secret scanning patterns](https://docs.github.com/enterprise-cloud@latest/code-security/secret-scanning/introduction/supported-secret-scanning-patterns#supported-secrets)."
  - `provider` string, nullable — The provider of the secret that was detected.
  - `provider_slug` string, nullable — The slug identifier for the provider of the secret that was detected. Use this value for filtering by provider with the `providers` or `exclude_providers` parameters.
  - `secret` string — The secret that was detected.
  - `push_protection_bypassed` boolean, nullable — Whether push protection was bypassed for the detected secret.
  - `push_protection_bypassed_by` NullableSimpleUser, nullable — 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
    - `user_view_type` string
  - `push_protection_bypassed_at` string, date-time, nullable — The time that push protection was bypassed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
  - `push_protection_bypass_request_reviewer` NullableSimpleUser, nullable — 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
    - `user_view_type` string
  - `push_protection_bypass_request_reviewer_comment` string, nullable — An optional comment when reviewing a push protection bypass.
  - `push_protection_bypass_request_comment` string, nullable — An optional comment when requesting a push protection bypass.
  - `push_protection_bypass_request_html_url` string, uri, nullable — The URL to a push protection bypass request.
  - `validity` 'active' | 'inactive' | 'unknown' — The token status as of the latest validity check.
  - `publicly_leaked` boolean, nullable — Whether the detected secret was publicly leaked.
  - `multi_repo` boolean, nullable — Whether the detected secret was found in multiple repositories under the same organization or enterprise.
  - `is_base64_encoded` boolean, nullable — A boolean value representing whether or not alert is base64 encoded
  - `first_location_detected` union — Details on the location where the token was initially detected. This can be a commit, wiki commit, issue, discussion, pull request.
    - SecretScanningLocationCommit — Represents a 'commit' secret scanning location type. This location type shows that a secret was detected inside a commit to a repository.
      - `path` string, required — The file path in the repository
      - `start_line` number, required — Line number at which the secret starts in the file
      - `end_line` number, required — Line number at which the secret ends in the file
      - `start_column` number, required — The column at which the secret starts within the start line when the file is interpreted as 8BIT ASCII
      - `end_column` number, required — The column at which the secret ends within the end line when the file is interpreted as 8BIT ASCII
      - `blob_sha` string, required — SHA-1 hash ID of the associated blob
      - `blob_url` string, required — The API URL to get the associated blob resource
      - `commit_sha` string, required — SHA-1 hash ID of the associated commit
      - `commit_url` string, required — The API URL to get the associated commit resource
      - `html_url` string, uri — The GitHub URL to get the associated commit resource.
    - SecretScanningLocationWikiCommit — Represents a 'wiki_commit' secret scanning location type. This location type shows that a secret was detected inside a commit to a repository wiki.
      - `path` string, required — The file path of the wiki page
      - `start_line` number, required — Line number at which the secret starts in the file
      - `end_line` number, required — Line number at which the secret ends in the file
      - `start_column` number, required — The column at which the secret starts within the start line when the file is interpreted as 8-bit ASCII.
      - `end_column` number, required — The column at which the secret ends within the end line when the file is interpreted as 8-bit ASCII.
      - `blob_sha` string, required — SHA-1 hash ID of the associated blob
      - `page_url` string, required — The GitHub URL to get the associated wiki page
      - `commit_sha` string, required — SHA-1 hash ID of the associated commit
      - `commit_url` string, required — The GitHub URL to get the associated wiki commit
    - SecretScanningLocationIssueTitle — Represents an 'issue_title' secret scanning location type. This location type shows that a secret was detected in the title of an issue.
      - `issue_title_url` string, uri, required — The API URL to get the issue where the secret was detected.
      - `html_url` string, uri — The GitHub URL for the issue where the secret was detected.
    - SecretScanningLocationIssueBody — Represents an 'issue_body' secret scanning location type. This location type shows that a secret was detected in the body of an issue.
      - `issue_body_url` string, uri, required — The API URL to get the issue where the secret was detected.
      - `html_url` string, uri — The GitHub URL for the issue where the secret was detected.
    - SecretScanningLocationIssueComment — Represents an 'issue_comment' secret scanning location type. This location type shows that a secret was detected in a comment on an issue.
      - `issue_comment_url` string, uri, required — The API URL to get the issue comment where the secret was detected.
      - `html_url` string, uri — The GitHub URL for the issue comment where the secret was detected.
    - SecretScanningLocationDiscussionTitle — Represents a 'discussion_title' secret scanning location type. This location type shows that a secret was detected in the title of a discussion.
      - `discussion_title_url` string, uri, required — The URL to the discussion where the secret was detected.
    - SecretScanningLocationDiscussionBody — Represents a 'discussion_body' secret scanning location type. This location type shows that a secret was detected in the body of a discussion.
      - `discussion_body_url` string, uri, required — The URL to the discussion where the secret was detected.
    - SecretScanningLocationDiscussionComment — Represents a 'discussion_comment' secret scanning location type. This location type shows that a secret was detected in a comment on a discussion.
      - `discussion_comment_url` string, uri, required — The API URL to get the discussion comment where the secret was detected.
    - SecretScanningLocationPullRequestTitle — Represents a 'pull_request_title' secret scanning location type. This location type shows that a secret was detected in the title of a pull request.
      - `pull_request_title_url` string, uri, required — The API URL to get the pull request where the secret was detected.
      - `html_url` string, uri — The GitHub URL for the pull request where the secret was detected.
    - SecretScanningLocationPullRequestBody — Represents a 'pull_request_body' secret scanning location type. This location type shows that a secret was detected in the body of a pull request.
      - `pull_request_body_url` string, uri, required — The API URL to get the pull request where the secret was detected.
      - `html_url` string, uri — The GitHub URL for the pull request where the secret was detected.
    - SecretScanningLocationPullRequestComment — Represents a 'pull_request_comment' secret scanning location type. This location type shows that a secret was detected in a comment on a pull request.
      - `pull_request_comment_url` string, uri, required — The API URL to get the pull request comment where the secret was detected.
      - `html_url` string, uri — The GitHub URL for the pull request comment where the secret was detected.
    - SecretScanningLocationPullRequestReview — Represents a 'pull_request_review' secret scanning location type. This location type shows that a secret was detected in a review on a pull request.
      - `pull_request_review_url` string, uri, required — The API URL to get the pull request review where the secret was detected.
      - `html_url` string, uri — The GitHub URL for the pull request review where the secret was detected.
    - SecretScanningLocationPullRequestReviewComment — Represents a 'pull_request_review_comment' secret scanning location type. This location type shows that a secret was detected in a review comment on a pull request.
      - `pull_request_review_comment_url` string, uri, required — The API URL to get the pull request review comment where the secret was detected.
      - `html_url` string, uri — The GitHub URL for the pull request review comment where the secret was detected.
  - `has_more_locations` boolean — A boolean value representing whether or not the token in the alert was detected in more than one location.
  - `assigned_to` NullableSimpleUser, nullable — 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
    - `user_view_type` string
  - `closure_request_comment` string, nullable — An optional comment from the closure request author.
  - `closure_request_reviewer_comment` string, nullable — An optional comment from the closure request reviewer.
  - `closure_request_reviewer` NullableSimpleUser, nullable — 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
    - `user_view_type` string

## Other responses

- `404` — Repository is public or secret scanning is disabled for the repository
- `503` — Service unavailable

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-2.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-2/versions/8ae6d0c8716e/schema)
