Skip to content

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.

[!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.

API method documentation

owner
required
string

The account owner of the repository. The name is not case sensitive.

repo
required
string

The name of the repository without the .git extension. The name is not case sensitive.

Response

Media type application/json
object
incremental_scans
Array<object>

Information on a single scan performed by secret scanning on the repository

object
type

The type of scan

string
status

The state of the scan. Either “completed”, “running”, “pending”, “failed”, or “unknown”.

“failed”: this scan type has hit its retry limit and has been marked permanently failed. This usually resolves on its own at the next scheduled scan attempt. If “failed” persists, contact Support.

“unknown”: the scan is in an unrecognized or currently unhandled state.

string
completed_at

The time that the scan was completed. Empty if the scan is running

string format: date-time
nullable
started_at

The time that the scan was started. Empty if the scan is pending

string format: date-time
nullable
pattern_update_scans
Array<object>

Information on a single scan performed by secret scanning on the repository

object
type

The type of scan

string
status

The state of the scan. Either “completed”, “running”, “pending”, “failed”, or “unknown”.

“failed”: this scan type has hit its retry limit and has been marked permanently failed. This usually resolves on its own at the next scheduled scan attempt. If “failed” persists, contact Support.

“unknown”: the scan is in an unrecognized or currently unhandled state.

string
completed_at

The time that the scan was completed. Empty if the scan is running

string format: date-time
nullable
started_at

The time that the scan was started. Empty if the scan is pending

string format: date-time
nullable
backfill_scans
Array<object>

Information on a single scan performed by secret scanning on the repository

object
type

The type of scan

string
status

The state of the scan. Either “completed”, “running”, “pending”, “failed”, or “unknown”.

“failed”: this scan type has hit its retry limit and has been marked permanently failed. This usually resolves on its own at the next scheduled scan attempt. If “failed” persists, contact Support.

“unknown”: the scan is in an unrecognized or currently unhandled state.

string
completed_at

The time that the scan was completed. Empty if the scan is running

string format: date-time
nullable
started_at

The time that the scan was started. Empty if the scan is pending

string format: date-time
nullable
custom_pattern_backfill_scans
Array
object
type

The type of scan

string
status

The state of the scan. Either “completed”, “running”, “pending”, “failed”, or “unknown”.

“failed”: this scan type has hit its retry limit and has been marked permanently failed. This usually resolves on its own at the next scheduled scan attempt. If “failed” persists, contact Support.

“unknown”: the scan is in an unrecognized or currently unhandled state.

string
completed_at

The time that the scan was completed. Empty if the scan is running

string format: date-time
nullable
started_at

The time that the scan was started. Empty if the scan is pending

string format: date-time
nullable
pattern_name

Name of the custom pattern for custom pattern scans

string
pattern_scope

Level at which the custom pattern is defined, one of “repository”, “organization”, or “enterprise”

string
generic_secrets_backfill_scans
Array<object>

Information on a single scan performed by secret scanning on the repository

object
type

The type of scan

string
status

The state of the scan. Either “completed”, “running”, “pending”, “failed”, or “unknown”.

“failed”: this scan type has hit its retry limit and has been marked permanently failed. This usually resolves on its own at the next scheduled scan attempt. If “failed” persists, contact Support.

“unknown”: the scan is in an unrecognized or currently unhandled state.

string
completed_at

The time that the scan was completed. Empty if the scan is running

string format: date-time
nullable
started_at

The time that the scan was started. Empty if the scan is pending

string format: date-time
nullable
Examples
Example default
{
"incremental_scans": [
{
"type": "git",
"status": "completed",
"completed_at": "2024-10-07T02:47:00Z"
}
],
"backfill_scans": [
{
"type": "git",
"status": "completed",
"started_at": "2024-10-07T02:47:00Z",
"completed_at": "2024-10-07T02:50:00Z"
},
{
"type": "issue",
"status": "completed",
"started_at": "2024-10-07T02:47:00Z",
"completed_at": "2024-10-07T02:49:00Z"
},
{
"type": "discussion",
"status": "completed",
"started_at": "2024-10-07T02:47:00Z",
"completed_at": "2024-10-07T02:48:00Z"
}
],
"pattern_update_scans": [
{
"type": "discussion",
"status": "in_progress",
"started_at": "2024-10-07T02:47:00Z",
"completed_at": "2024-10-07T02:51:00Z"
}
],
"custom_pattern_backfill_scans": [
{
"type": "git",
"status": "completed",
"started_at": "2024-10-07T02:47:00Z",
"completed_at": "2024-10-07T02:55:00Z",
"pattern_slug": "my-custom-pattern",
"pattern_scope": "enterprise"
},
{
"type": "git",
"status": "completed",
"started_at": "2024-10-07T02:47:00Z",
"completed_at": "2024-10-07T02:55:00Z",
"pattern_slug": "my-custom-pattern",
"pattern_scope": "organization"
}
],
"generic_secrets_backfill_scans": [
{
"type": "git",
"status": "completed",
"started_at": "2024-10-07T02:47:00Z",
"completed_at": "2024-10-07T02:55:00Z"
}
]
}

Repository does not have GitHub Advanced Security or secret scanning enabled

Service unavailable

Media type application/json
object
code
string
message
string
documentation_url
string
Example generated
{
"code": "example",
"message": "example",
"documentation_url": "example"
}