Use the REST API to retrieve and update secret alerts from a repository.
You can use the API to:
security_and_analysis object" section.For more information about secret scanning, see Secret scanning.
Note
Most endpoints use Authorization: Bearer <YOUR-TOKEN> and Accept: application/vnd.github+json headers, plus X-GitHub-Api-Version: 2026-03-10. Curl examples below omit these standard headers for brevity.
GET /orgs/{org}/secret-scanning/alerts
Lists secret scanning alerts for eligible repositories in an organization, from newest to oldest.
The authenticated user must be an administrator or security manager for the organization 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.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
state (string)
Set to open or resolved to only list secret scanning alerts in a specific state.
Can be one of: open, resolved
secret_type (string)
A comma-separated list of secret types to return. All default secret patterns are returned. To return generic patterns, pass the token name(s) in the parameter. See "Supported secret scanning patterns" for a complete list of secret types.
exclude_secret_types (string)
A comma-separated list of secret types to exclude from the results. All default secret patterns are returned except those matching the specified types. Cannot be combined with the secret_type parameter. See "Supported secret scanning patterns" for a complete list of secret types.
exclude_providers (string)
A comma-separated list of provider slugs to exclude from the results.
Provider slugs use lowercase with underscores (e.g., github_secret_scanning, clojars).
You can find the provider slug in the provider_slug field of each alert.
Cannot be combined with the providers parameter.
providers (string)
A comma-separated list of provider slugs to filter by.
Provider slugs use lowercase with underscores (e.g., github_secret_scanning, clojars).
You can find the provider slug in the provider_slug field of each alert.
Cannot be combined with the exclude_providers parameter.
resolution (string)
A comma-separated list of resolutions. Only secret scanning alerts with one of these resolutions are listed. Valid resolutions are false_positive, wont_fix, revoked, pattern_edited, pattern_deleted or used_in_tests.
assignee (string)
Filters alerts by assignee. Use * to get all assigned alerts, none to get all unassigned alerts, or a GitHub username to get alerts assigned to a specific user.
sort (string)
The property to sort the results by. created means when the alert was created. updated means when the alert was updated or resolved.
Default: created
Can be one of: created, updated
direction (string)
The direction to sort the results by.
Default: desc
Can be one of: asc, desc
page (integer)
The page number of the results to fetch. For more information, see "Using pagination in the REST API."
Default: 1
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
before (string)
A cursor, as given in the Link header. If specified, the query only searches for events before this cursor. To receive an initial cursor on your first request, include an empty "before" query string.
after (string)
A cursor, as given in the Link header. If specified, the query only searches for events after this cursor. To receive an initial cursor on your first request, include an empty "after" query string.
validity (string)
A comma-separated list of validities that, when present, will return alerts that match the validities in this list. Valid options are active, inactive, and unknown.
is_publicly_leaked (boolean)
A boolean value representing whether or not to filter alerts by the publicly-leaked tag being present.
Default: false
is_multi_repo (boolean)
A boolean value representing whether or not to filter alerts by the multi-repo tag being present.
Default: false
hide_secret (boolean)
A boolean value representing whether or not to hide literal secrets in the results.
Default: false
is_bypassed (boolean)
A boolean value (true or false) indicating whether to filter alerts by their push protection bypass status. When set to true, only alerts that were created because a push protection rule was bypassed will be returned. When set to false, only alerts that were not caused by a push protection bypass will be returned.
included_metadata (string)
A comma-separated list of metadata fields to filter alerts by. Only alerts that have all of the
specified metadata fields attached will be returned. Possible values are: owner-email, owner-id,
owner-name, secret-id, secret-name, secret-issued-date, secret-expiration-date, organization-name,
organization-id, last-used-date, and has-organization-access.
owner_email_hash (string)
Filters alerts to only those whose attached owner_email metadata field matches the
provided value. The value must be the lowercase hex-encoded SHA-256 hash of the email
address to match (for example, the SHA-256 of user@example.com). Only alerts that
have an owner_email metadata value whose SHA-256 hash equals this parameter are
returned.
200 - OK
404 - Resource not found
503 - Service unavailable
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/secret-scanning/alerts
Response schema (Status: 200):
Array of objects:
number: integer, read-onlycreated_at: string, format: date-time, read-onlyupdated_at: any of:
url: string, format: uri, read-onlyhtml_url: string, format: uri, read-onlylocations_url: string, format: uristate: string, enum: open, resolvedresolution: string or null, enum: false_positive, wont_fix, revoked, used_in_tests, nullresolved_at: string or null, format: date-timeresolved_by: any of:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringsecret_type: stringsecret_type_display_name: stringprovider: string or nullprovider_slug: string or nullsecret: stringrepository: Simple Repository:
id: required, integer, format: int64node_id: required, stringname: required, stringfull_name: required, stringowner: required, Simple User (see above)private: required, booleanhtml_url: required, string, format: uridescription: required, string or nullfork: required, booleanurl: required, string, format: uriarchive_url: required, stringassignees_url: required, stringblobs_url: required, stringbranches_url: required, stringcollaborators_url: required, stringcomments_url: required, stringcommits_url: required, stringcompare_url: required, stringcontents_url: required, stringcontributors_url: required, string, format: urideployments_url: required, string, format: uridownloads_url: required, string, format: urievents_url: required, string, format: uriforks_url: required, string, format: urigit_commits_url: required, stringgit_refs_url: required, stringgit_tags_url: required, stringissue_comment_url: required, stringissue_events_url: required, stringissues_url: required, stringkeys_url: required, stringlabels_url: required, stringlanguages_url: required, string, format: urimerges_url: required, string, format: urimilestones_url: required, stringnotifications_url: required, stringpulls_url: required, stringreleases_url: required, stringstargazers_url: required, string, format: uristatuses_url: required, stringsubscribers_url: required, string, format: urisubscription_url: required, string, format: uritags_url: required, string, format: uriteams_url: required, string, format: uritrees_url: required, stringhooks_url: required, string, format: uripush_protection_bypassed: boolean or nullpush_protection_bypassed_by: any of:
push_protection_bypassed_at: string or null, format: date-timepush_protection_bypass_request_reviewer: any of:
push_protection_bypass_request_reviewer_comment: string or nullpush_protection_bypass_request_comment: string or nullpush_protection_bypass_request_html_url: string or null, format: uriresolution_comment: string or nullvalidity: string, enum: active, inactive, unknownpublicly_leaked: boolean or nullmulti_repo: boolean or nullis_base64_encoded: boolean or nullfirst_location_detected: any of:
has_more_locations: booleanassigned_to: any of:
closure_request_comment: string or nullclosure_request_reviewer_comment: string or nullclosure_request_reviewer: any of:
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.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
state (string)
Set to open or resolved to only list secret scanning alerts in a specific state.
Can be one of: open, resolved
secret_type (string)
A comma-separated list of secret types to return. All default secret patterns are returned. To return generic patterns, pass the token name(s) in the parameter. See "Supported secret scanning patterns" for a complete list of secret types.
exclude_secret_types (string)
A comma-separated list of secret types to exclude from the results. All default secret patterns are returned except those matching the specified types. Cannot be combined with the secret_type parameter. See "Supported secret scanning patterns" for a complete list of secret types.
exclude_providers (string)
A comma-separated list of provider slugs to exclude from the results.
Provider slugs use lowercase with underscores (e.g., github_secret_scanning, clojars).
You can find the provider slug in the provider_slug field of each alert.
Cannot be combined with the providers parameter.
providers (string)
A comma-separated list of provider slugs to filter by.
Provider slugs use lowercase with underscores (e.g., github_secret_scanning, clojars).
You can find the provider slug in the provider_slug field of each alert.
Cannot be combined with the exclude_providers parameter.
resolution (string)
A comma-separated list of resolutions. Only secret scanning alerts with one of these resolutions are listed. Valid resolutions are false_positive, wont_fix, revoked, pattern_edited, pattern_deleted or used_in_tests.
assignee (string)
Filters alerts by assignee. Use * to get all assigned alerts, none to get all unassigned alerts, or a GitHub username to get alerts assigned to a specific user.
sort (string)
The property to sort the results by. created means when the alert was created. updated means when the alert was updated or resolved.
Default: created
Can be one of: created, updated
direction (string)
The direction to sort the results by.
Default: desc
Can be one of: asc, desc
page (integer)
The page number of the results to fetch. For more information, see "Using pagination in the REST API."
Default: 1
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
before (string)
A cursor, as given in the Link header. If specified, the query only searches for events before this cursor. To receive an initial cursor on your first request, include an empty "before" query string.
after (string)
A cursor, as given in the Link header. If specified, the query only searches for events after this cursor. To receive an initial cursor on your first request, include an empty "after" query string.
validity (string)
A comma-separated list of validities that, when present, will return alerts that match the validities in this list. Valid options are active, inactive, and unknown.
is_publicly_leaked (boolean)
A boolean value representing whether or not to filter alerts by the publicly-leaked tag being present.
Default: false
is_multi_repo (boolean)
A boolean value representing whether or not to filter alerts by the multi-repo tag being present.
Default: false
hide_secret (boolean)
A boolean value representing whether or not to hide literal secrets in the results.
Default: false
is_bypassed (boolean)
A boolean value (true or false) indicating whether to filter alerts by their push protection bypass status. When set to true, only alerts that were created because a push protection rule was bypassed will be returned. When set to false, only alerts that were not caused by a push protection bypass will be returned.
included_metadata (string)
A comma-separated list of metadata fields to filter alerts by. Only alerts that have all of the
specified metadata fields attached will be returned. Possible values are: owner-email, owner-id,
owner-name, secret-id, secret-name, secret-issued-date, secret-expiration-date, organization-name,
organization-id, last-used-date, and has-organization-access.
owner_email_hash (string)
Filters alerts to only those whose attached owner_email metadata field matches the
provided value. The value must be the lowercase hex-encoded SHA-256 hash of the email
address to match (for example, the SHA-256 of user@example.com). Only alerts that
have an owner_email metadata value whose SHA-256 hash equals this parameter are
returned.
200 - OK
404 - Repository is public or secret scanning is disabled for the repository
503 - Service unavailable
Request:
curl -L \
-X GET \
https://api.github.com/repos/OWNER/REPO/secret-scanning/alerts
Response schema (Status: 200):
Array of objects:
number: integer, read-onlycreated_at: string, format: date-time, read-onlyupdated_at: any of:
url: string, format: uri, read-onlyhtml_url: string, format: uri, read-onlylocations_url: string, format: uristate: string, enum: open, resolvedresolution: string or null, enum: false_positive, wont_fix, revoked, used_in_tests, nullresolved_at: string or null, format: date-timeresolved_by: any of:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringresolution_comment: string or nullsecret_type: stringsecret_type_display_name: stringprovider: string or nullprovider_slug: string or nullsecret: stringpush_protection_bypassed: boolean or nullpush_protection_bypassed_by: any of:
push_protection_bypassed_at: string or null, format: date-timepush_protection_bypass_request_reviewer: any of:
push_protection_bypass_request_reviewer_comment: string or nullpush_protection_bypass_request_comment: string or nullpush_protection_bypass_request_html_url: string or null, format: urivalidity: string, enum: active, inactive, unknownpublicly_leaked: boolean or nullmulti_repo: boolean or nullis_base64_encoded: boolean or nullfirst_location_detected: any of:
has_more_locations: booleanassigned_to: any of:
closure_request_comment: string or nullclosure_request_reviewer_comment: string or nullclosure_request_reviewer: any of:
GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}
Gets a single secret scanning alert detected in an eligible repository.
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.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
alert_number (integer) (required)
The number that identifies an alert. You can find this at the end of the URL for a code scanning alert within GitHub, and in the number field in the response from the GET /repos/{owner}/{repo}/code-scanning/alerts operation.
hide_secret (boolean)
A boolean value representing whether or not to hide literal secrets in the results.
Default: false
200 - OK
304 - Not modified
404 - Repository is public, or secret scanning is disabled for the repository, or the resource is not found
503 - Service unavailable
Request:
curl -L \
-X GET \
https://api.github.com/repos/OWNER/REPO/secret-scanning/alerts/ALERT_NUMBER
Response schema (Status: 200):
number: integer, read-onlycreated_at: string, format: date-time, read-onlyupdated_at: any of:
url: string, format: uri, read-onlyhtml_url: string, format: uri, read-onlylocations_url: string, format: uristate: string, enum: open, resolvedresolution: string or null, enum: false_positive, wont_fix, revoked, used_in_tests, nullresolved_at: string or null, format: date-timeresolved_by: any of:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringresolution_comment: string or nullsecret_type: stringsecret_type_display_name: stringprovider: string or nullprovider_slug: string or nullsecret: stringpush_protection_bypassed: boolean or nullpush_protection_bypassed_by: any of:
push_protection_bypassed_at: string or null, format: date-timepush_protection_bypass_request_reviewer: any of:
push_protection_bypass_request_reviewer_comment: string or nullpush_protection_bypass_request_comment: string or nullpush_protection_bypass_request_html_url: string or null, format: urivalidity: string, enum: active, inactive, unknownpublicly_leaked: boolean or nullmulti_repo: boolean or nullis_base64_encoded: boolean or nullfirst_location_detected: any of:
has_more_locations: booleanassigned_to: any of:
closure_request_comment: string or nullclosure_request_reviewer_comment: string or nullclosure_request_reviewer: any of:
metadata: array of objects:
key: required, stringvalue: required, stringPATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}
Updates the status of a secret scanning alert in an eligible repository.
You can also use this endpoint to assign or unassign an alert to a user who has write access to the repository.
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.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
alert_number (integer) (required)
The number that identifies an alert. You can find this at the end of the URL for a code scanning alert within GitHub, and in the number field in the response from the GET /repos/{owner}/{repo}/code-scanning/alerts operation.
state (string)
Sets the state of the secret scanning alert. You must provide resolution when you set the state to resolved.
Can be one of: open, resolved
resolution (string or null)
Required when the state is resolved. The reason for resolving the alert.
Can be one of: false_positive, wont_fix, revoked, used_in_tests, null
resolution_comment (string or null)
An optional comment when closing or reopening an alert. Cannot be updated or deleted.
assignee (string or null)
The username of the user to assign to the alert. Set to null to unassign the alert.
validity (string or null)
Sets the validity of the secret scanning alert. Can be active, inactive, or null to clear the override.
Can be one of: active, inactive, null
200 - OK
400 - Bad request, resolution comment is invalid or the resolution was not changed.
403 - Delegated alert dismissal is enabled and the authenticated user is not a valid reviewer.
404 - Repository is public, or secret scanning is disabled for the repository, or the resource is not found
422 - State does not match the resolution or resolution comment, assignee does not have write access to the repository, or the requested validity change could not be applied to this alert
503 - Service unavailable
Request:
curl -L \
-X PATCH \
https://api.github.com/repos/OWNER/REPO/secret-scanning/alerts/ALERT_NUMBER \
-d '{
"state": "resolved",
"resolution": "false_positive"
}'
Response schema (Status: 200):
Same response schema as Get a secret scanning alert.
GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations
Lists all locations for a given secret scanning alert for an eligible repository.
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.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
alert_number (integer) (required)
The number that identifies an alert. You can find this at the end of the URL for a code scanning alert within GitHub, and in the number field in the response from the GET /repos/{owner}/{repo}/code-scanning/alerts operation.
page (integer)
The page number of the results to fetch. For more information, see "Using pagination in the REST API."
Default: 1
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
200 - OK
404 - Repository is public, or secret scanning is disabled for the repository, or the resource is not found
503 - Service unavailable
Request:
curl -L \
-X GET \
https://api.github.com/repos/OWNER/REPO/secret-scanning/alerts/ALERT_NUMBER/locations
Response schema (Status: 200):
Array of objects:
type: string, enum: commit, wiki_commit, issue_title, issue_body, issue_comment, discussion_title, discussion_body, discussion_comment, pull_request_title, pull_request_body, pull_request_comment, pull_request_review, pull_request_review_commentdetails: one of:
path: required, stringstart_line: required, numberend_line: required, numberstart_column: required, numberend_column: required, numberblob_sha: required, stringblob_url: required, stringcommit_sha: required, stringcommit_url: required, stringhtml_url: string, format: uripath: required, stringstart_line: required, numberend_line: required, numberstart_column: required, numberend_column: required, numberblob_sha: required, stringpage_url: required, stringcommit_sha: required, stringcommit_url: required, stringissue_title_url: required, string, format: urihtml_url: string, format: uriissue_body_url: required, string, format: urihtml_url: string, format: uriissue_comment_url: required, string, format: urihtml_url: string, format: uridiscussion_title_url: required, string, format: uridiscussion_body_url: required, string, format: uridiscussion_comment_url: required, string, format: uripull_request_title_url: required, string, format: urihtml_url: string, format: uripull_request_body_url: required, string, format: urihtml_url: string, format: uripull_request_comment_url: required, string, format: urihtml_url: string, format: uripull_request_review_url: required, string, format: urihtml_url: string, format: uripull_request_review_comment_url: required, string, format: urihtml_url: string, format: uriPOST /repos/{owner}/{repo}/secret-scanning/push-protection-bypasses
Creates a bypass for a previously push protected secret.
The authenticated user must be the original author of the committed secret.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
reason (string) (required)
The reason for bypassing push protection.
Can be one of: false_positive, used_in_tests, will_fix_later
placeholder_id (string) (required)
The ID of the push protection bypass placeholder. This value is returned on any push protected routes.
200 - OK
403 - User does not have enough permissions to perform this action.
404 - Placeholder ID not found, or push protection is disabled on this repository.
422 - Bad request, input data missing or incorrect.
503 - Service unavailable
Request:
curl -L \
-X POST \
https://api.github.com/repos/OWNER/REPO/secret-scanning/push-protection-bypasses \
-d '{
"reason": "will_fix_later",
"placeholder_id": "2k4dM4tseyC5lPIsjl5emX9sPNk"
}'
Response schema (Status: 200):
reason: string, enum: false_positive, used_in_tests, will_fix_laterexpire_at: string or null, format: date-timetoken_type: stringGET /repos/{owner}/{repo}/secret-scanning/scan-history
Lists the latest default incremental and backfill scans by type for a repository.
Note
This endpoint requires GitHub Advanced Security.
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.
accept (string)application/vnd.github+json is recommended.owner (string) (required)
The account owner of the repository. The name is not case sensitive.
repo (string) (required)
The name of the repository without the .git extension. The name is not case sensitive.
200 - OK
404 - Repository does not have GitHub Advanced Security or secret scanning enabled
503 - Service unavailable
Request:
curl -L \
-X GET \
https://api.github.com/repos/OWNER/REPO/secret-scanning/scan-history
Response schema (Status: 200):
incremental_scans: array of objects:
type: stringstatus: stringcompleted_at: string or null, format: date-timestarted_at: string or null, format: date-timepattern_update_scans: array of objects:
type: stringstatus: stringcompleted_at: string or null, format: date-timestarted_at: string or null, format: date-timebackfill_scans: array of objects:
type: stringstatus: stringcompleted_at: string or null, format: date-timestarted_at: string or null, format: date-timecustom_pattern_backfill_scans: array of items:
type: stringstatus: stringcompleted_at: string or null, format: date-timestarted_at: string or null, format: date-timepattern_name: stringpattern_scope: stringgeneric_secrets_backfill_scans: array of objects:
type: stringstatus: stringcompleted_at: string or null, format: date-timestarted_at: string or null, format: date-time