Bulk create organization custom patterns
Bulk creates secret scanning custom patterns for an organization.
Personal access tokens (classic) need the write:org scope to use this endpoint.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”The organization name. The name is not case sensitive.
Request Body required
Section titled “ Request Body required ”object
The list of custom patterns to create.
A custom pattern to create in a bulk operation.
object
The name of the custom pattern.
The regular expression of the custom pattern.
The start delimiter regex for the custom pattern.
Defaults to \A|[^0-9A-Za-z] when not specified.
The end delimiter regex for the custom pattern.
Defaults to \z|[^0-9A-Za-z] when not specified.
List of regexes that the secret must match.
List of regexes that the secret must not match.
Examples
{ "patterns": [ { "name": "Example Custom Pattern", "pattern": "[a-z]+_token_[0-9]+" }, { "name": "Another Custom Pattern", "pattern": "prefix_[a-zA-Z0-9]{32}", "start_delimiter": "\\b", "end_delimiter": "\\b", "must_match": [ "^prefix_prod" ], "must_not_match": [ "test" ] } ]}Responses
Section titled “ Responses ”All patterns created successfully.
object
The list of successfully created custom patterns.
A custom pattern for secret scanning.
object
The ID of the custom pattern.
The name of the custom pattern.
The regular expression of the custom pattern.
A URL-friendly identifier for the custom pattern, derived from its name.
The state of the custom pattern.
Whether push protection is enabled for this custom pattern.
The start delimiter regex for the custom pattern.
The end delimiter regex for the custom pattern.
List of regexes that the secret must match.
List of regexes that the secret must not match.
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.
The date and time the custom pattern was created in ISO 8601 format.
The date and time the custom pattern was last updated in ISO 8601 format.
Examples
{ "created_patterns": [ { "id": 1, "name": "Example Custom Pattern", "pattern": "[a-z]+_token_[0-9]+", "slug": "example-custom-pattern", "state": "unpublished", "push_protection_enabled": false, "start_delimiter": null, "end_delimiter": null, "must_match": null, "must_not_match": null, "created_at": "2024-01-15T10:30:00Z", "updated_at": "2024-01-15T10:30:00Z" }, { "id": 2, "name": "Another Custom Pattern", "pattern": "prefix_[a-zA-Z0-9]{32}", "slug": "another-custom-pattern", "state": "unpublished", "push_protection_enabled": false, "start_delimiter": "\\b", "end_delimiter": "\\b", "must_match": [ "^prefix_prod" ], "must_not_match": [ "test" ], "created_at": "2024-01-15T10:30:00Z", "updated_at": "2024-01-15T10:30:00Z" } ]}Bad Request
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Scim Error
object
Example generated
{ "message": "example", "documentation_url": "example", "detail": "example", "status": 1, "scimType": "example", "schemas": [ "example" ]}Forbidden
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Resource not found
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Validation failed for one or more patterns.
object
A summary message describing the error.
A map of validation errors keyed by the zero-based index of the pattern that failed.
object
object
List of validation errors for this pattern.
A validation error for a custom pattern in a batch operation.
object
A machine-readable code describing the error.
A human-readable description of the error.
Example
{ "validation_errors": { "additionalProperty": { "errors": [ { "code": "none" } ] } }}