{"meta":{"title":"REST-API-Endpunkte für Copilot benutzerdefinierte Agents","intro":"Verwenden Sie die REST-API, um Copilot custom agents für Ihr Unternehmen zu verwalten.","product":"REST-API","breadcrumbs":[{"href":"/de/enterprise-cloud@latest/rest","title":"REST-API"},{"href":"/de/enterprise-cloud@latest/rest/copilot","title":"Copilot"},{"href":"/de/enterprise-cloud@latest/rest/copilot/copilot-custom-agents","title":"Copilot benutzerdefinierte Agenten"}],"documentType":"article"},"body":"# REST-API-Endpunkte für Copilot benutzerdefinierte Agents\n\nVerwenden Sie die REST-API, um Copilot custom agents für Ihr Unternehmen zu verwalten.\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 custom agents for an enterprise\n\n```\nGET /enterprises/{enterprise}/copilot/custom-agents\n```\n\nGets the list of all custom agents defined in the /agents/*.md files in the .github-private repository for the enterprise.\nIf no source repository has been configured, returns null for custom_agents.\nEnterprise owners with read access to AI Controls can use this endpoint.\nOAuth app tokens and personal access tokens (classic) need the admin:enterprise 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- **`enterprise`** (string) (required)\n  The slug version of the enterprise name.\n\n- **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n- **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n### HTTP response status codes\n\n- **200** - Success\n\n- **401** - Requires authentication\n\n- **403** - Forbidden\n\n- **404** - Not found or source repository not found\n\n- **500** - Internal Error\n\n### Code examples\n\n#### Example 1: Status Code 200\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/enterprises/ENTERPRISE/copilot/custom-agents\n```\n\n**Response schema (Status: 200):**\n\n* `custom_agents`: array of objects or null:\n  * `name`: string\n  * `file_path`: string\n  * `url`: string\n\n#### Example 2: Status Code 200\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/enterprises/ENTERPRISE/copilot/custom-agents\n```\n\n**Response schema (Status: 200):**\n\n* `custom_agents`: array of objects or null:\n  * `name`: string\n  * `file_path`: string\n  * `url`: string\n\n## Get the source organization for custom agents in an enterprise\n\n```\nGET /enterprises/{enterprise}/copilot/custom-agents/source\n```\n\nGets the organization and repository configured as the source for custom agent definitions and Copilot CLI client settings in an enterprise.\nCustom agents are enterprise-defined AI agents stored as markdown files in a special repository.\nAn enterprise admin configures one organization as the \"source\" for custom agents and\nCopilot CLI client settings, and that org must have a repo named .github-private containing agent\ndefinitions in /agents/*.md, or enterprise-managed AI standards in copilot/managed-settings.json (with fallback to .github/copilot/settings.json). Learn more about configuring enterprise-managed AI standards for Copilot clients.\nEnterprise owners with read access to AI Controls can use this endpoint.\nOAuth app tokens and personal access tokens (classic) need the admin:enterprise 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- **`enterprise`** (string) (required)\n  The slug version of the enterprise name.\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/enterprises/ENTERPRISE/copilot/custom-agents/source\n```\n\n**Response schema (Status: 200):**\n\n* `organization`: required, object or null:\n  * `id`: required, integer\n  * `login`: required, string\n* `repository`: required, object or null:\n  * `id`: required, integer\n  * `name`: required, string\n  * `full_name`: required, string\n\n## Set the source organization for custom agents in an enterprise\n\n```\nPUT /enterprises/{enterprise}/copilot/custom-agents/source\n```\n\nSets an organization as the source for custom agent definitions and Copilot CLI client settings in the enterprise.\nThe organization must have a .github-private repository containing agent definitions.\nBy default, this endpoint also creates an enterprise-level ruleset to protect\nagent definition files (agents/.md and .github/agents/.md). You can opt out\nof ruleset creation by setting create_ruleset to false.\nEnterprise owners with write access to AI Controls can use this endpoint.\nOAuth app tokens and personal access tokens (classic) need the admin:enterprise 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- **`enterprise`** (string) (required)\n  The slug version of the enterprise name.\n\n#### Body parameters\n\n- **`organization_id`** (integer) (required)\n  The ID of the organization to use as the custom agents source.\n\n- **`create_ruleset`** (boolean)\n  Whether to create a ruleset to protect agent definition files. Defaults to true.\n  Default: `true`\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- **422** - Validation failed\n\n- **500** - Internal Error\n\n### Code examples\n\n#### Set source organization without creating a ruleset\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/enterprises/ENTERPRISE/copilot/custom-agents/source \\\n  -d '{\n  \"organization_id\": 123,\n  \"create_ruleset\": false\n}'\n```\n\n**Response schema (Status: 200):**\n\n* `organization`: object:\n  * `id`: integer\n  * `login`: string\n  * `avatar_url`: string\n* `repository`: object:\n  * `id`: integer\n  * `name`: string\n  * `full_name`: string\n* `ruleset`: object:\n  * `id`: integer\n  * `name`: string\n  * `enforcement`: string\n\n## Delete the custom agents source for an enterprise\n\n```\nDELETE /enterprises/{enterprise}/copilot/custom-agents/source\n```\n\nRemoves the custom agents source configuration for the enterprise.\nThis effectively disables custom agents and Copilot CLI client settings\nfor the enterprise by removing the reference to the source organization's .github-private repository.\nNote: This does not delete the .github-private repository or any agent\ndefinition files. It only removes the association between the enterprise\nand the source repository.\nEnterprise owners with write access to AI Controls can use this endpoint.\nOAuth app tokens and personal access tokens (classic) need the admin:enterprise 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- **`enterprise`** (string) (required)\n  The slug version of the enterprise name.\n\n### HTTP response status codes\n\n- **204** - No Content - The custom agents source was successfully removed.\n\n- **403** - Forbidden - The user does not have enterprise admin access.\n\n- **404** - Not found - Enterprise not found, feature not enabled, or no custom agents source is configured.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/enterprises/ENTERPRISE/copilot/custom-agents/source\n```\n\n**Response schema (Status: 204):**"}