Sample - GitHub REST API
GET/orgs/{org}/secret-scanning/custom-patterns

List organization custom patterns

Lists secret scanning custom patterns for an organization.

Personal access tokens (classic) need the read:org scope to use this endpoint.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

7 parameters
orgstringrequired
The organization name. The name is not case sensitive.
statestringoptional
Filter custom patterns by state. When absent, returns patterns in all states.
Allowed:publishedunpublished
push_protectionstringoptional
Filter custom patterns by whether push protection is enabled. When absent, returns patterns regardless of push protection status.
Allowed:enableddisabled
sortstringoptional
The property to sort the results by.
Allowed:createdupdatednameDefault:created
directionstringoptional
The direction to sort the results by.
Allowed:ascdescDefault:desc
beforestringoptional
A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
afterstringoptional
A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."

3 status codes
200Response
idintegerrequired
The ID of the custom pattern.
namestringrequired
The name of the custom pattern.
patternstringrequired
The regular expression of the custom pattern.
slugstringrequired
A URL-friendly identifier for the custom pattern, derived from its name.
statestringrequired
The state of the custom pattern.
Allowed:publishedunpublished
push_protection_enabledbooleanrequired
Whether push protection is enabled for this custom pattern.
start_delimiterstringoptional
The start delimiter regex for the custom pattern.
end_delimiterstringoptional
The end delimiter regex for the custom pattern.
must_matcharray<string>optional
List of regexes that the secret must match.
must_not_matcharray<string>optional
List of regexes that the secret must not match.
custom_pattern_versionstringoptional
The version of the entity. This is used to confirm you're updating the current version of the entity and mitigate unintentionally overriding someone else's update.
created_atstringoptional
The date and time the custom pattern was created in ISO 8601 format.
updated_atstringoptional
The date and time the custom pattern was last updated in ISO 8601 format.
403Forbidden
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 403 is returned: Forbidden. A 404 is returned: Resource not found.