Sample - GitHub REST API
PATCH/orgs/{org}/secret-scanning/custom-patterns/{pattern_id}

Update an organization custom pattern

Updates a secret scanning custom pattern for an organization.

Personal access tokens (classic) need the write:org scope to use this endpoint.

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

2 parameters · 6 body fields
orgstringrequired
The organization name. The name is not case sensitive.
pattern_idintegerrequired
The ID of the custom pattern.
patternstringoptional
The updated regular expression of the custom pattern.
start_delimiterstringoptional
The updated start delimiter regex for the custom pattern.
end_delimiterstringoptional
The updated end delimiter regex for the custom pattern.
must_matcharray<string>optional
Updated list of regexes that the secret must match.
must_not_matcharray<string>optional
Updated list of regexes that the secret must not match.
custom_pattern_versionstringrequired
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.

6 status codes
200Pattern updated successfully.
idintegerrequired
The ID of the custom pattern.
namestringrequired
The name of the custom pattern.
patternstringrequired
The regular expression of the custom pattern.
slugstringrequired
A URL-friendly identifier for the custom pattern, derived from its name.
statestringrequired
The state of the custom pattern.
Allowed:publishedunpublished
push_protection_enabledbooleanrequired
Whether push protection is enabled for this custom pattern.
start_delimiterstringoptional
The start delimiter regex for the custom pattern.
end_delimiterstringoptional
The end delimiter regex for the custom pattern.
must_matcharray<string>optional
List of regexes that the secret must match.
must_not_matcharray<string>optional
List of regexes that the secret must not match.
custom_pattern_versionstringoptional
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_atstringoptional
The date and time the custom pattern was created in ISO 8601 format.
updated_atstringoptional
The date and time the custom pattern was last updated in ISO 8601 format.
400Bad Request
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Forbidden
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
412Precondition Failed
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Validation failed, or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 400 is returned: Bad Request. A 403 is returned: Forbidden. A 404 is returned: Resource not found. A 412 is returned: Precondition Failed. A 422 is returned: Validation failed, or the endpoint has been spammed.