apicheats.dev github/llms.txt Raw .md
GET

GET /repos/{owner}/{repo}/secret-scanning/custom-patterns — GitHub API

GitHub token (required); https://api.github.com

GitHub API

List repository 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
→ 346 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/repos/example-owner/example-repo/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
owner path string Yes The account owner of the repository. The name is not case sensitive.
repo path string Yes The name of the repository without the `.git` extension. 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.