GET
GET /orgs/{org}/secret-scanning/custom-patterns — GitHub API
GitHub token (required); https://api.github.com
GitHub APIList organization custom patterns
- Base URL
- https://api.github.com
- Auth
- Authorization: Bearer <GITHUB_API_KEY>
- Last verified
- 2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 311 tokens · Vary: Accept
→ 311 tokens · Vary: Accept
Critical gotchas
GitHub recommends an Accept: application/vnd.github+json header and an explicit X-GitHub-Api-Version header.
Fine-grained tokens only authorize repositories and permissions selected when the token is created.
cURL
curl -X GET 'https://api.github.com/orgs/example-org/secret-scanning/custom-patterns?state=published&push_protection=enabled&sort=created&direction=desc&before=example-before&after=example-after' \ -H "Authorization: Bearer $GITHUB_TOKEN" \ -H 'Accept: application/vnd.github+json' \ -H 'X-GitHub-Api-Version: 2026-03-10'
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| org | path | string | Yes | The organization name. The name is not case sensitive. |
| state | query | string | No | Filter custom patterns by state. When absent, returns patterns in all states. |
| push_protection | query | string | No | Filter custom patterns by whether push protection is enabled. When absent, returns patterns regardless of push protection status. |
| sort | query | string | No | The property to sort the results by. |
| direction | query | string | No | The direction to sort the results by. |
| before | query | string | No | 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)." |
| after | query | string | No | 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)." |
Response 200 OK
[
{
"id": 0,
"name": "string",
"pattern": "string",
"slug": "string",
"state": "published",
"push_protection_enabled": true,
"start_delimiter": "string",
"end_delimiter": "string",
"must_match": [
"string"
],
"must_not_match": [
"string"
],
"custom_pattern_version": "string",
"created_at": "2026-09-03T00:00:00Z",
"updated_at": "2026-09-03T00:00:00Z"
}
] Get a free GitHub API key → sponsored Affiliate link - we may earn a commission, at no extra cost to you.