{"meta":{"title":"Copilot コンテンツの除外管理のための REST API エンドポイント","intro":"REST API を使用して、Copilot のコンテンツ除外ルールを管理します。","product":"REST API","breadcrumbs":[{"href":"/ja/enterprise-cloud@latest/rest","title":"REST API"},{"href":"/ja/enterprise-cloud@latest/rest/copilot","title":"Copilot"},{"href":"/ja/enterprise-cloud@latest/rest/copilot/copilot-content-exclusion-management","title":"Copilot コンテンツの除外管理"}],"documentType":"article"},"body":"# Copilot コンテンツの除外管理のための REST API エンドポイント\n\nREST API を使用して、Copilot のコンテンツ除外ルールを管理します。\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## Get Copilot content exclusion rules for an enterprise\n\n```\nGET /enterprises/{enterprise}/copilot/content_exclusion\n```\n\nNote\n\nThis endpoint is in public preview and is subject to change.\n\nGets information about an enterprise's Copilot content exclusion path rules.\nTo configure these settings, go to the enterprise's settings on GitHub.\nFor more information, see \"Excluding content from GitHub Copilot.\"\nEnterprise owners can view details about Copilot content exclusion rules for the enterprise.\nOAuth app tokens and personal access tokens (classic) need either the read:enterprise or copilot scopes to use this endpoint.\nCaution\n\nAt this time, the API does not support comments. This endpoint will not return any comments in the existing rules.\nAt this time, the API does not support duplicate keys. If your content exclusion configuration contains duplicate keys, the API will return only the last occurrence of that key. For example, if duplicate entries are present, only the final value will be included in the response.\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- **`enterprise`** (string) (required)\n  The slug version of the enterprise name.\n\n### HTTP response status codes\n\n- **200** - OK\n\n- **401** - Requires authentication\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **500** - Internal Error\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/enterprises/ENTERPRISE/copilot/content_exclusion\n```\n\n**Response schema (Status: 200):**\n\nobject, additional properties: array\n\n## Set Copilot content exclusion rules for an enterprise\n\n```\nPUT /enterprises/{enterprise}/copilot/content_exclusion\n```\n\nNote\n\nThis endpoint is in public preview and is subject to change.\n\nSets Copilot content exclusion path rules for an enterprise.\nTo configure these settings, go to the enterprise's settings on GitHub.\nFor more information, see \"Excluding content from GitHub Copilot.\"\nEnterprise owners can set Copilot content exclusion rules for the enterprise.\nOAuth app tokens and personal access tokens (classic) need either the admin:enterprise or copilot scopes to use this endpoint.\nCaution\n\nAt this time, the API does not support comments. When using this endpoint, any existing comments in your rules will be deleted.\nAt this time, the API does not support duplicate keys. If you submit content exclusions through the API with duplicate keys, only the last occurrence will be saved. Earlier entries with the same key will be overwritten.\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- **`enterprise`** (string) (required)\n  The slug version of the enterprise name.\n\n### HTTP response status codes\n\n- **200** - Success\n\n- **401** - Requires authentication\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **413** - Payload Too Large\n\n- **422** - Validation failed, or the endpoint has been spammed.\n\n- **500** - Internal Error\n\n### Code examples\n\n#### Example of content exclusion paths\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/enterprises/ENTERPRISE/copilot/content_exclusion \\\n  -d '{\n  \"git@github.com:*/copilot\": [\n    \"/__tests__/**\"\n  ],\n  \"octo-org/octo-repo\": [\n    \"/src/some-dir/kernel.rs\"\n  ]\n}'\n```\n\n**Response schema (Status: 200):**\n\n* `message`: string\n\n## Get Copilot content exclusion rules for an organization\n\n```\nGET /orgs/{org}/copilot/content_exclusion\n```\n\nNote\n\nThis endpoint is in public preview and is subject to change.\n\nGets information about an organization's Copilot content exclusion path rules.\nTo configure these settings, go to the organization's settings on GitHub.\nFor more information, see \"Excluding content from GitHub Copilot.\"\nOrganization owners can view details about Copilot content exclusion rules for the organization.\nOAuth app tokens and personal access tokens (classic) need either the copilot or read:org scopes to use this endpoint.\nCaution\n\nAt this time, the API does not support comments. This endpoint will not return any comments in the existing rules.\nAt this time, the API does not support duplicate keys. If your content exclusion configuration contains duplicate keys, the API will return only the last occurrence of that key. For example, if duplicate entries are present, only the final value will be included in the response.\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- **401** - Requires authentication\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **500** - Internal Error\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/copilot/content_exclusion\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Get Copilot content exclusion rules for an enterprise](#get-copilot-content-exclusion-rules-for-an-enterprise).\n\n## Set Copilot content exclusion rules for an organization\n\n```\nPUT /orgs/{org}/copilot/content_exclusion\n```\n\nNote\n\nThis endpoint is in public preview and is subject to change.\n\nSets Copilot content exclusion path rules for an organization.\nTo configure these settings, go to the organization's settings on GitHub.\nFor more information, see \"Excluding content from GitHub Copilot.\"\nOrganization owners can set Copilot content exclusion rules for the organization.\nOAuth app tokens and personal access tokens (classic) need the copilot scope to use this endpoint.\nCaution\n\nAt this time, the API does not support comments. When using this endpoint, any existing comments in your rules will be deleted.\nAt this time, the API does not support duplicate keys. If you submit content exclusions through the API with duplicate keys, only the last occurrence will be saved. Earlier entries with the same key will be overwritten.\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** - Success\n\n- **401** - Requires authentication\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **413** - Payload Too Large\n\n- **422** - Validation failed, or the endpoint has been spammed.\n\n- **500** - Internal Error\n\n### Code examples\n\n#### Example of content exclusion paths\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/orgs/ORG/copilot/content_exclusion \\\n  -d '{\n  \"octo-repo\": [\n    \"/src/some-dir/kernel.rs\"\n  ]\n}'\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Set Copilot content exclusion rules for an enterprise](#set-copilot-content-exclusion-rules-for-an-enterprise)."}