v56

latestOpenAPI 3.0.3MITraw.githubusercontent.com2026-08-011,4581,08113.3 MB
secret-scanning

Update a repository custom pattern

Updates a secret scanning custom pattern for a repository.

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

patch/repos/{owner}/{repo}/secret-scanning/custom-patterns/{pattern_id}

Path parameters

ownerstring required

The account owner of the repository. The name is not case sensitive.

repostring required

The name of the repository without the .git extension. The name is not case sensitive.

pattern_idinteger required

The ID of the custom pattern.

Request body

OR
OR
OR
OR

Response

Pattern updated successfully.

idinteger required

The ID of the custom pattern.

namestring required

The name of the custom pattern.

patternstring required

The regular expression of the custom pattern.

slugstring required

A URL-friendly identifier for the custom pattern, derived from its name.

state'published' | 'unpublished' required

The state of the custom pattern.

push_protection_enabledboolean required

Whether push protection is enabled for this custom pattern.

start_delimiterstring nullable

The start delimiter regex for the custom pattern.

end_delimiterstring nullable

The end delimiter regex for the custom pattern.

must_matchstring[] nullable

List of regexes that the secret must match.

must_not_matchstring[] nullable

List of regexes that the secret must not match.

custom_pattern_versionstring nullable

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_atstring date-time

The date and time the custom pattern was created in ISO 8601 format.

updated_atstring date-time

The date and time the custom pattern was last updated in ISO 8601 format.