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

POST /orgs/{org}/secret-scanning/custom-patterns — GitHub API

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

GitHub API

Bulk create 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
→ 231 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 POST 'https://api.github.com/orgs/example-org/secret-scanning/custom-patterns' \  -H "Authorization: Bearer $GITHUB_TOKEN" \  -H 'Accept: application/vnd.github+json' \  -H 'X-GitHub-Api-Version: 2026-03-10' \  -H 'Content-Type: application/json' \  -d '{  "patterns": [    {      "name": "example-name",      "pattern": "example-pattern",      "start_delimiter": "\\A|[^0-9A-Za-z]",      "end_delimiter": "\\z|[^0-9A-Za-z]",      "must_match": [        "example-must-match"      ],      "must_not_match": [        "example-must-not-match"      ]    }  ]}'

Parameters

Name In Type Required Description
org path string Yes The organization name. The name is not case sensitive.
patterns body object[] Yes The list of custom patterns to create (maximum 100).

Response 200 OK

{
  "created_patterns": [
    {
      "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.