← All tags

Secret-Scanning API Reference

Retrieve secret scanning alerts from a repository.

9 endpoints tagged secret-scanning, each listing its parameters and possible responses. Search or scroll the index below to jump to a specific endpoint.

No endpoints match your search.

List secret scanning alerts for an organization

GET /orgs/{org}/secret-scanning/alerts

Lists secret scanning alerts for eligible repositories in an organization, from newest to oldest.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
statequerynoSet to open or resolved to only list secret scanning alerts in a specific state.
secret_typequerynoA 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_typesquerynoA 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_providersquerynoA comma-separated list of provider slugs to exclude from the results.
providersquerynoA comma-separated list of provider slugs to filter by.
resolutionquerynoA 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.
assigneequerynoFilters 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.
sortquerynoThe property to sort the results by. created means when the alert was created. updated means when the alert was updated or resolved.
directionquerynoThe direction to sort the results by.
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
beforequerynoA 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.
afterquerynoA 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.
validityquerynoA 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_leakedquerynoA boolean value representing whether or not to filter alerts by the publicly-leaked tag being present.
is_multi_repoquerynoA boolean value representing whether or not to filter alerts by the multi-repo tag being present.
hide_secretquerynoA boolean value representing whether or not to hide literal secrets in the results.
is_bypassedquerynoA 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.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
503Service unavailableyes

List organization pattern configurations

GET /orgs/{org}/secret-scanning/pattern-configurations

Lists the secret scanning pattern configurations for an organization.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
200Responseyes
403Forbiddenyes
404Resource not foundyes

Update organization pattern configurations

PATCH /orgs/{org}/secret-scanning/pattern-configurations

Updates the secret scanning pattern configurations for an organization.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
200Responseyes
400Bad Requestyes
403Forbiddenyes
404Resource not foundyes
409Conflictyes
422Validation failed, or the endpoint has been spammed.yes

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.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
statequerynoSet to open or resolved to only list secret scanning alerts in a specific state.
secret_typequerynoA 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_typesquerynoA 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_providersquerynoA comma-separated list of provider slugs to exclude from the results.
providersquerynoA comma-separated list of provider slugs to filter by.
resolutionquerynoA 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.
assigneequerynoFilters 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.
sortquerynoThe property to sort the results by. created means when the alert was created. updated means when the alert was updated or resolved.
directionquerynoThe direction to sort the results by.
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
beforequerynoA 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.
afterquerynoA 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.
validityquerynoA 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_leakedquerynoA boolean value representing whether or not to filter alerts by the publicly-leaked tag being present.
is_multi_repoquerynoA boolean value representing whether or not to filter alerts by the multi-repo tag being present.
hide_secretquerynoA boolean value representing whether or not to hide literal secrets in the results.
is_bypassedquerynoA 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.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Repository is public or secret scanning is disabled for the repositoryno
503Service unavailableyes

Get a secret scanning alert

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

Gets a single secret scanning alert detected in an eligible repository.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
alert_numberpathyesThe 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_secretquerynoA boolean value representing whether or not to hide literal secrets in the results.

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Repository is public, or secret scanning is disabled for the repository, or the resource is not foundno
503Service unavailableyes

Update a secret scanning alert

PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}

Updates the status of a secret scanning alert in an eligible repository.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
alert_numberpathyesThe 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.

Responses

StatusDescriptionHas JSON body
200Responseyes
400Bad request, resolution comment is invalid or the resolution was not changed.no
403Delegated alert dismissal is enabled and the authenticated user is not a valid reviewer.no
404Repository is public, or secret scanning is disabled for the repository, or the resource is not foundno
422State 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 alertno
503Service unavailableyes

List locations for 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.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
alert_numberpathyesThe 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.
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
404Repository is public, or secret scanning is disabled for the repository, or the resource is not foundno
503Service unavailableyes

Create a push protection bypass

POST /repos/{owner}/{repo}/secret-scanning/push-protection-bypasses

Creates a bypass for a previously push protected secret.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
200Responseyes
403User does not have enough permissions to perform this action.no
404Placeholder ID not found, or push protection is disabled on this repository.no
422Bad request, input data missing or incorrect.no
503Service unavailableyes

Get secret scanning scan history for a repository

GET /repos/{owner}/{repo}/secret-scanning/scan-history

Lists the latest default incremental and backfill scans by type for a repository.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
404Repository does not have GitHub Advanced Security or secret scanning enabledno
503Service unavailableyes
200Responseyes