{"meta":{"title":"비밀 검사 사용자 지정 패턴을 위한 REST API 엔드포인트","intro":"REST API를 사용하여 비밀 검사에 대한 사용자 지정 패턴을 관리합니다.","product":"REST API","breadcrumbs":[{"href":"/ko/rest","title":"REST API"},{"href":"/ko/rest/secret-scanning","title":"비밀 탐지"},{"href":"/ko/rest/secret-scanning/custom-patterns","title":"사용자 지정 패턴"}],"documentType":"article"},"body":"# 비밀 검사 사용자 지정 패턴을 위한 REST API 엔드포인트\n\nREST API를 사용하여 비밀 검사에 대한 사용자 지정 패턴을 관리합니다.\n\n> [!NOTE]\n> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.\n\n## List organization custom patterns\n\n```\nGET /orgs/{org}/secret-scanning/custom-patterns\n```\n\nLists secret scanning custom patterns for an organization.\nPersonal access tokens (classic) need the read:org scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n- **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n- **`state`** (string)\n  Filter custom patterns by state. When absent, returns patterns in all states.\n  Can be one of: `published`, `unpublished`\n\n- **`push_protection`** (string)\n  Filter custom patterns by whether push protection is enabled. When absent, returns patterns regardless of push protection status.\n  Can be one of: `enabled`, `disabled`\n\n- **`sort`** (string)\n  The property to sort the results by.\n  Default: `created`\n  Can be one of: `created`, `updated`, `name`\n\n- **`direction`** (string)\n  The direction to sort the results by.\n  Default: `desc`\n  Can be one of: `asc`, `desc`\n\n- **`before`** (string)\n  A cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see \"Using pagination in the REST API.\"\n\n- **`after`** (string)\n  A cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see \"Using pagination in the REST API.\"\n\n### HTTP response status codes\n\n- **200** - OK\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/orgs/ORG/secret-scanning/custom-patterns\n```\n\n**Response schema (Status: 200):**\n\nArray of `Secret Scanning Custom Pattern`:\n  * `id`: required, integer\n  * `name`: required, string\n  * `pattern`: required, string\n  * `slug`: required, string\n  * `state`: required, string, enum: `published`, `unpublished`\n  * `push_protection_enabled`: required, boolean\n  * `start_delimiter`: string or null\n  * `end_delimiter`: string or null\n  * `must_match`: array of string or null\n  * `must_not_match`: array of string or null\n  * `custom_pattern_version`: string or null\n  * `created_at`: string, format: date-time\n  * `updated_at`: string, format: date-time\n\n## Bulk create organization custom patterns\n\n```\nPOST /orgs/{org}/secret-scanning/custom-patterns\n```\n\nBulk creates secret scanning custom patterns for an organization.\nPersonal access tokens (classic) need the write:org scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n- **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n#### Body parameters\n\n- **`patterns`** (array of objects) (required)\n  The list of custom patterns to create (maximum 100).\n  - **`name`** (string) (required)\n    The name of the custom pattern.\n  - **`pattern`** (string) (required)\n    The regular expression of the custom pattern.\n  - **`start_delimiter`** (string)\n    The start delimiter regex for the custom pattern.\nDefaults to \\A|[^0-9A-Za-z] when not specified.\n    Default: `\\A|[^0-9A-Za-z]`\n  - **`end_delimiter`** (string)\n    The end delimiter regex for the custom pattern.\nDefaults to \\z|[^0-9A-Za-z] when not specified.\n    Default: `\\z|[^0-9A-Za-z]`\n  - **`must_match`** (array of strings)\n    List of regexes that the secret must match.\n  - **`must_not_match`** (array of strings)\n    List of regexes that the secret must not match.\n\n### HTTP response status codes\n\n- **201** - All patterns created successfully.\n\n- **400** - Bad Request\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **422** - Validation failed for one or more patterns.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/orgs/ORG/secret-scanning/custom-patterns \\\n  -d '{\n  \"patterns\": [\n    {\n      \"name\": \"Example Custom Pattern\",\n      \"pattern\": \"[a-z]+_token_[0-9]+\"\n    },\n    {\n      \"name\": \"Another Custom Pattern\",\n      \"pattern\": \"prefix_[a-zA-Z0-9]{32}\",\n      \"start_delimiter\": \"\\\\b\",\n      \"end_delimiter\": \"\\\\b\",\n      \"must_match\": [\n        \"^prefix_prod\"\n      ],\n      \"must_not_match\": [\n        \"test\"\n      ]\n    }\n  ]\n}'\n```\n\n**Response schema (Status: 201):**\n\n* `created_patterns`: array of `Secret Scanning Custom Pattern`:\n  * `id`: required, integer\n  * `name`: required, string\n  * `pattern`: required, string\n  * `slug`: required, string\n  * `state`: required, string, enum: `published`, `unpublished`\n  * `push_protection_enabled`: required, boolean\n  * `start_delimiter`: string or null\n  * `end_delimiter`: string or null\n  * `must_match`: array of string or null\n  * `must_not_match`: array of string or null\n  * `custom_pattern_version`: string or null\n  * `created_at`: string, format: date-time\n  * `updated_at`: string, format: date-time\n\n## Bulk delete organization custom patterns\n\n```\nDELETE /orgs/{org}/secret-scanning/custom-patterns\n```\n\nBulk deletes secret scanning custom patterns for an organization.\nPersonal access tokens (classic) need the write:org scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n- **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n#### Body parameters\n\n- **`patterns`** (array of objects) (required)\n  The list of custom patterns to delete.\n  - **`pattern_id`** (integer) (required)\n    The ID of the custom pattern to delete.\n  - **`custom_pattern_version`** (string or null)\n    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.\n\n- **`post_delete_action`** (string)\n  What to do with alerts associated with the deleted patterns.\ndelete_alerts permanently removes the alerts.\nresolve_alerts resolves the alerts as \"pattern deleted\".\nDefaults to delete_alerts when not specified.\n  Default: `delete_alerts`\n  Can be one of: `delete_alerts`, `resolve_alerts`\n\n### HTTP response status codes\n\n- **204** - All patterns deleted successfully.\n\n- **400** - Bad Request\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **412** - Precondition Failed\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/orgs/ORG/secret-scanning/custom-patterns \\\n  -d '{\n  \"patterns\": [\n    {\n      \"pattern_id\": 2,\n      \"custom_pattern_version\": \"0ujsswThIGTUYm2K8FjOOfXtY1K\"\n    }\n  ]\n}'\n```\n\n**Response schema (Status: 204):**\n\n## Update an organization custom pattern\n\n```\nPATCH /orgs/{org}/secret-scanning/custom-patterns/{pattern_id}\n```\n\nUpdates a secret scanning custom pattern for an organization.\nPersonal access tokens (classic) need the write:org scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n- **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n- **`pattern_id`** (integer) (required)\n  The ID of the custom pattern.\n\n#### Body parameters\n\n- **`pattern`** (string)\n  The updated regular expression of the custom pattern.\n\n- **`start_delimiter`** (string)\n  The updated start delimiter regex for the custom pattern.\n\n- **`end_delimiter`** (string)\n  The updated end delimiter regex for the custom pattern.\n\n- **`must_match`** (array of strings)\n  Updated list of regexes that the secret must match.\n\n- **`must_not_match`** (array of strings)\n  Updated list of regexes that the secret must not match.\n\n- **`custom_pattern_version`** (string or null) (required)\n  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.\n\n### HTTP response status codes\n\n- **200** - Pattern updated successfully.\n\n- **400** - Bad Request\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **412** - Precondition Failed\n\n- **422** - Validation failed, or the endpoint has been spammed.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PATCH \\\n  https://api.github.com/orgs/ORG/secret-scanning/custom-patterns/PATTERN_ID \\\n  -d '{\n  \"pattern\": \"updated_secret_[0-9A-Z]{16}\",\n  \"start_delimiter\": \"[^0-9A-Za-z]\",\n  \"end_delimiter\": \"[^0-9A-Za-z]\",\n  \"must_match\": [\n    \"updated_secret_[0-9]{2}*\"\n  ],\n  \"must_not_match\": [\n    \"updated_secret_1234567890ABCDEF\"\n  ],\n  \"custom_pattern_version\": \"0ujsswThIGTUYm2K8FjOOfXtY1K\"\n}'\n```\n\n**Response schema (Status: 200):**\n\n* `id`: required, integer\n* `name`: required, string\n* `pattern`: required, string\n* `slug`: required, string\n* `state`: required, string, enum: `published`, `unpublished`\n* `push_protection_enabled`: required, boolean\n* `start_delimiter`: string or null\n* `end_delimiter`: string or null\n* `must_match`: array of string or null\n* `must_not_match`: array of string or null\n* `custom_pattern_version`: string or null\n* `created_at`: string, format: date-time\n* `updated_at`: string, format: date-time\n\n## List repository custom patterns\n\n```\nGET /repos/{owner}/{repo}/secret-scanning/custom-patterns\n```\n\nLists secret scanning custom patterns for a repository.\nOAuth 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.\nFine-grained access tokens require the administration:write repository permission.\n\n### Parameters\n\n#### Headers\n\n- **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n- **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n- **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n- **`state`** (string)\n  Filter custom patterns by state. When absent, returns patterns in all states.\n  Can be one of: `published`, `unpublished`\n\n- **`push_protection`** (string)\n  Filter custom patterns by whether push protection is enabled. When absent, returns patterns regardless of push protection status.\n  Can be one of: `enabled`, `disabled`\n\n- **`sort`** (string)\n  The property to sort the results by.\n  Default: `created`\n  Can be one of: `created`, `updated`, `name`\n\n- **`direction`** (string)\n  The direction to sort the results by.\n  Default: `desc`\n  Can be one of: `asc`, `desc`\n\n- **`before`** (string)\n  A cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see \"Using pagination in the REST API.\"\n\n- **`after`** (string)\n  A cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see \"Using pagination in the REST API.\"\n\n### HTTP response status codes\n\n- **200** - OK\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/secret-scanning/custom-patterns\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [List organization custom patterns](#list-organization-custom-patterns).\n\n## Bulk create repository custom patterns\n\n```\nPOST /repos/{owner}/{repo}/secret-scanning/custom-patterns\n```\n\nBulk creates secret scanning custom patterns for a repository.\nOAuth 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.\nFine-grained access tokens require the administration:write repository permission.\n\n### Parameters\n\n#### Headers\n\n- **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n- **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n- **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n#### Body parameters\n\n- **`patterns`** (array of objects) (required)\n  The list of custom patterns to create (maximum 100).\n  - **`name`** (string) (required)\n    The name of the custom pattern.\n  - **`pattern`** (string) (required)\n    The regular expression of the custom pattern.\n  - **`start_delimiter`** (string)\n    The start delimiter regex for the custom pattern.\nDefaults to \\A|[^0-9A-Za-z] when not specified.\n    Default: `\\A|[^0-9A-Za-z]`\n  - **`end_delimiter`** (string)\n    The end delimiter regex for the custom pattern.\nDefaults to \\z|[^0-9A-Za-z] when not specified.\n    Default: `\\z|[^0-9A-Za-z]`\n  - **`must_match`** (array of strings)\n    List of regexes that the secret must match.\n  - **`must_not_match`** (array of strings)\n    List of regexes that the secret must not match.\n\n### HTTP response status codes\n\n- **201** - All patterns created successfully.\n\n- **400** - Bad Request\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **422** - Validation failed for one or more patterns.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/repos/OWNER/REPO/secret-scanning/custom-patterns \\\n  -d '{\n  \"patterns\": [\n    {\n      \"name\": \"Example Custom Pattern\",\n      \"pattern\": \"[a-z]+_token_[0-9]+\"\n    },\n    {\n      \"name\": \"Another Custom Pattern\",\n      \"pattern\": \"prefix_[a-zA-Z0-9]{32}\",\n      \"start_delimiter\": \"\\\\b\",\n      \"end_delimiter\": \"\\\\b\",\n      \"must_match\": [\n        \"^prefix_prod\"\n      ],\n      \"must_not_match\": [\n        \"test\"\n      ]\n    }\n  ]\n}'\n```\n\n**Response schema (Status: 201):**\n\nSame response schema as [Bulk create organization custom patterns](#bulk-create-organization-custom-patterns).\n\n## Bulk delete repository custom patterns\n\n```\nDELETE /repos/{owner}/{repo}/secret-scanning/custom-patterns\n```\n\nBulk deletes secret scanning custom patterns for a repository.\nOAuth 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.\nFine-grained access tokens require the administration:write repository permission.\n\n### Parameters\n\n#### Headers\n\n- **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n- **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n- **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n#### Body parameters\n\n- **`patterns`** (array of objects) (required)\n  The list of custom patterns to delete.\n  - **`pattern_id`** (integer) (required)\n    The ID of the custom pattern to delete.\n  - **`custom_pattern_version`** (string or null)\n    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.\n\n- **`post_delete_action`** (string)\n  What to do with alerts associated with the deleted patterns.\ndelete_alerts permanently removes the alerts.\nresolve_alerts resolves the alerts as \"pattern deleted\".\nDefaults to delete_alerts when not specified.\n  Default: `delete_alerts`\n  Can be one of: `delete_alerts`, `resolve_alerts`\n\n### HTTP response status codes\n\n- **204** - All patterns deleted successfully.\n\n- **400** - Bad Request\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **412** - Precondition Failed\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/repos/OWNER/REPO/secret-scanning/custom-patterns \\\n  -d '{\n  \"patterns\": [\n    {\n      \"pattern_id\": 2,\n      \"custom_pattern_version\": \"0ujsswThIGTUYm2K8FjOOfXtY1K\"\n    }\n  ]\n}'\n```\n\n**Response schema (Status: 204):**\n\n## Update a repository custom pattern\n\n```\nPATCH /repos/{owner}/{repo}/secret-scanning/custom-patterns/{pattern_id}\n```\n\nUpdates a secret scanning custom pattern for a repository.\nOAuth 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.\nFine-grained access tokens require the administration:write repository permission.\n\n### Parameters\n\n#### Headers\n\n- **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n- **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n- **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n- **`pattern_id`** (integer) (required)\n  The ID of the custom pattern.\n\n#### Body parameters\n\n- **`pattern`** (string)\n  The updated regular expression of the custom pattern.\n\n- **`start_delimiter`** (string)\n  The updated start delimiter regex for the custom pattern.\n\n- **`end_delimiter`** (string)\n  The updated end delimiter regex for the custom pattern.\n\n- **`must_match`** (array of strings)\n  Updated list of regexes that the secret must match.\n\n- **`must_not_match`** (array of strings)\n  Updated list of regexes that the secret must not match.\n\n- **`custom_pattern_version`** (string or null) (required)\n  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.\n\n### HTTP response status codes\n\n- **200** - Pattern updated successfully.\n\n- **400** - Bad Request\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **412** - Precondition Failed\n\n- **422** - Validation failed, or the endpoint has been spammed.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PATCH \\\n  https://api.github.com/repos/OWNER/REPO/secret-scanning/custom-patterns/PATTERN_ID \\\n  -d '{\n  \"pattern\": \"updated_secret_[0-9A-Z]{16}\",\n  \"start_delimiter\": \"[^0-9A-Za-z]\",\n  \"end_delimiter\": \"[^0-9A-Za-z]\",\n  \"must_match\": [\n    \"updated_secret_[0-9]{2}*\"\n  ],\n  \"must_not_match\": [\n    \"updated_secret_1234567890ABCDEF\"\n  ],\n  \"custom_pattern_version\": \"0ujsswThIGTUYm2K8FjOOfXtY1K\"\n}'\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Update an organization custom pattern](#update-an-organization-custom-pattern)."}