{"meta":{"title":"シークレット スキャンのプッシュ保護に関する REST API エンドポイント","intro":"REST API を使って、シークレット スキャンのプッシュ保護を管理します。","product":"REST API","breadcrumbs":[{"href":"/ja/rest","title":"REST API"},{"href":"/ja/rest/secret-scanning","title":"シークレット スキャン"},{"href":"/ja/rest/secret-scanning/push-protection","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 pattern configurations\n\n```\nGET /orgs/{org}/secret-scanning/pattern-configurations\n```\n\nLists the secret scanning pattern configurations 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### 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/pattern-configurations\n```\n\n**Response schema (Status: 200):**\n\n* `pattern_config_version`: string or null\n* `provider_pattern_overrides`: array of objects:\n  * `token_type`: string\n  * `custom_pattern_version`: string or null\n  * `slug`: string\n  * `display_name`: string\n  * `alert_total`: integer\n  * `alert_total_percentage`: integer\n  * `false_positives`: integer\n  * `false_positive_rate`: integer\n  * `bypass_rate`: integer\n  * `default_setting`: string, enum: `disabled`, `enabled`\n  * `enterprise_setting`: string or null, enum: `not-set`, `disabled`, `enabled`, `null`\n  * `setting`: string, enum: `not-set`, `disabled`, `enabled`\n* `custom_pattern_overrides`: array of objects:\n  * `token_type`: string\n  * `custom_pattern_version`: string or null\n  * `slug`: string\n  * `display_name`: string\n  * `alert_total`: integer\n  * `alert_total_percentage`: integer\n  * `false_positives`: integer\n  * `false_positive_rate`: integer\n  * `bypass_rate`: integer\n  * `default_setting`: string, enum: `disabled`, `enabled`\n  * `enterprise_setting`: string or null, enum: `not-set`, `disabled`, `enabled`, `null`\n  * `setting`: string, enum: `not-set`, `disabled`, `enabled`\n\n## Update organization pattern configurations\n\n```\nPATCH /orgs/{org}/secret-scanning/pattern-configurations\n```\n\nUpdates the secret scanning pattern configurations 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- **`pattern_config_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- **`provider_pattern_settings`** (array of objects)\n  Pattern settings for provider patterns.\n  - **`token_type`** (string)\n    The ID of the pattern to configure.\n  - **`push_protection_setting`** (string)\n    Push protection setting to set for the pattern.\n    Can be one of: `not-set`, `disabled`, `enabled`\n\n- **`custom_pattern_settings`** (array of objects)\n  Pattern settings for custom patterns.\n  - **`token_type`** (string)\n    The ID of the pattern to configure.\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  - **`push_protection_setting`** (string)\n    Push protection setting to set for the pattern.\n    Can be one of: `disabled`, `enabled`\n\n### HTTP response status codes\n\n- **200** - OK\n\n- **400** - Bad Request\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **409** - Conflict\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/pattern-configurations \\\n  -d '{\n  \"pattern_config_version\": \"0ujsswThIGTUYm2K8FjOOfXtY1K\",\n  \"provider_pattern_settings\": [\n    {\n      \"token_type\": \"GITHUB_PERSONAL_ACCESS_TOKEN\",\n      \"push_protection_setting\": \"enabled\"\n    }\n  ],\n  \"custom_pattern_settings\": [\n    {\n      \"token_type\": \"cp_2\",\n      \"custom_pattern_version\": \"0ujsswThIGTUYm2K8FjOOfXtY1K\",\n      \"push_protection_setting\": \"enabled\"\n    }\n  ]\n}'\n```\n\n**Response schema (Status: 200):**\n\n* `pattern_config_version`: string"}