Sample - GitHub REST API
POST/repos/{owner}/{repo}/secret-scanning/custom-patterns

Bulk create repository custom patterns

Bulk creates secret scanning custom patterns for a repository.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead.

Fine-grained access tokens require the administration:write repository permission.

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

2 parameters · 1 body field
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
patternsarray<SecretScanningCustomPatternToCreate>required
The list of custom patterns to create (maximum 100).

5 status codes
201All patterns created successfully.
created_patternsarray<SecretScanningCustomPattern>optional
The list of successfully created custom patterns.
400Bad Request
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Forbidden
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Validation failed for one or more patterns.
messagestringoptional
A summary message describing the error.
validation_errorsobjectoptional
A map of validation errors keyed by the zero-based index of the pattern that failed.

Error handling

A 400 is returned: Bad Request. A 403 is returned: Forbidden. A 404 is returned: Resource not found. A 422 is returned: Validation failed for one or more patterns.