Copilot 团队自定义的 REST API 端点
使用 REST API 来管理团队的 Copilot 自定义。
关于 Copilot 团队自定义
Copilot自定义文档定义组织团队成员可用的插件和插件市场。 GitHub 为每个团队存储一个文档。 可以在团队的 “自定义Copilot” 选项卡上或使用这些终结点创建和管理文档。
自定义文档支持以下顶级键:
pluginAssignments:可供团队使用的插件,按PLUGIN@MARKETPLACE作为键。 默认情况下,每个插件都处于启用状态。extraKnownMarketplaces:可供团队使用的其他插件市场,以市场名称为键。
下面的请求和响应示例显示了一个插件及其应用市场。
访问要求
经过身份验证的用户必须是组织所有者或团队的维护者。 对于分配给组织的企业团队,包括与标识提供者组同步的企业团队,经过身份验证的用户必须是组织所有者。 除了这些角色要求之外,所需的范围和权限也是必需的。
| 令牌类型 | 查看自定义设置 | 替换或删除自定义项 |
|---|---|---|
| Personal access token (classic) 或 OAuth app 令牌 | read:org 或 admin:org 作用域 | admin:org 范围 |
| Fine-grained personal access token 或 GitHub App 用户访问令牌 | 具有读取权限的组织“Copilot 智能体设置”权限 | 具有写入访问权限的“Copilot 智能体 settings”组织权限 |
创建和更新自定义项
若要创建团队的自定义文档,请将完整文档作为 JSON 请求正文发送到 PUT 终结点。 不要将其包装在另一个对象中。 成功的请求会返回 200 OK,其中包含所提交的文档。
终结点 PUT 将替换整个文档。 它不会将请求与现有自定义项合并。 从请求中省略的任何插件或应用市场都将从存储的文档中删除。
编辑现有文档:
- 使用
GET终结点获取团队的当前自定义文档。 - 编辑文档,保留要保留的每个插件和应用市场。
- 将完整文档发送到
PUT终结点。
在替换文档之前读取文档不会阻止请求之间的另一次编辑。
当团队没有文档时,终结点 GET 将 404 Not Found 返回。 404 还可能意味着经过身份验证的用户无法访问该团队。
若要删除团队的自定义文档,请使用 DELETE 终结点。 即使文档不存在,它也会返回 204 No Content 。 这不会删除团队。
无效的文档返回 422 Unprocessable Entity,并说明原因。 并发编辑可能会导致写入或删除返回 409 Conflict。
Get Copilot customizations for a team
Note
This endpoint is in public preview and is subject to change.
Gets the GitHub-managed Copilot customizations of a team.
The authenticated user must be an organization owner or a team maintainer. Teams that keep their
customizations in a repository return 409.
OAuth app tokens and personal access tokens (classic) need the admin:org or read:org scope to use this endpoint.
“Get Copilot customizations for a team”的细粒度访问令牌
此端点支持以下精细令牌类型:
细粒度令牌必须具有以下权限集:
- "Copilot agent settings" organization permissions (read)
“”Get Copilot customizations for a team 的参数
| 名称, 类型, 说明 |
|---|
accept string Setting to |
| 名称, 类型, 说明 |
|---|
org string 必须The organization name. The name is not case sensitive. |
team_slug string 必须The slug of the team name. |
“Get Copilot customizations for a team”的 HTTP 响应状态代码
| 状态代码 | 说明 |
|---|---|
200 | OK |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
409 | Conflict |
422 | Validation failed, or the endpoint has been spammed. |
500 | Internal Error |
503 | Service unavailable |
“Get Copilot customizations for a team”的代码示例
请求示例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/copilot/customizationsResponse
Status: 200{
"pluginAssignments": {
"code-review@acme-marketplace": {
"state": "defaultEnabled"
}
},
"extraKnownMarketplaces": {
"acme-marketplace": {
"source": {
"source": "github",
"repo": "acme/copilot-marketplace"
}
}
}
}Set Copilot customizations for a team
Note
This endpoint is in public preview and is subject to change.
Replaces the GitHub-managed Copilot customizations of a team, creating them on the first write.
The authenticated user must be an organization owner or a team maintainer. Teams that keep their
customizations in a repository return 409. Documents that fail validation return 422 with the reason.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
“Set Copilot customizations for a team”的细粒度访问令牌
此端点支持以下精细令牌类型:
细粒度令牌必须具有以下权限集:
- "Copilot agent settings" organization permissions (write)
“”Set Copilot customizations for a team 的参数
| 名称, 类型, 说明 |
|---|
accept string Setting to |
| 名称, 类型, 说明 |
|---|
org string 必须The organization name. The name is not case sensitive. |
team_slug string 必须The slug of the team name. |
| 名称, 类型, 说明 | |||||
|---|---|---|---|---|---|
pluginAssignments object Plugins assigned to the team, keyed by | |||||
Properties of |
| 名称, 类型, 说明 | ||
|---|---|---|
key object A user-defined key to represent an item in | ||
Properties of |
| 名称, 类型, 说明 |
|---|
state string The assignment state. 值: |
extraKnownMarketplaces object Additional plugin marketplaces available to the team, keyed by marketplace name.
Properties of extraKnownMarketplaces
| 名称, 类型, 说明 |
|---|
key object A user-defined key to represent an item in |
“Set Copilot customizations for a team”的 HTTP 响应状态代码
| 状态代码 | 说明 |
|---|---|
200 | OK |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
409 | Conflict |
422 | Validation failed, or the endpoint has been spammed. |
500 | Internal Error |
503 | Service unavailable |
“Set Copilot customizations for a team”的代码示例
请求示例
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/copilot/customizations \
-d '{"pluginAssignments":{"code-review@acme-marketplace":{"state":"defaultEnabled"}},"extraKnownMarketplaces":{"acme-marketplace":{"source":{"source":"github","repo":"acme/copilot-marketplace"}}}}'Response
Status: 200{
"pluginAssignments": {
"code-review@acme-marketplace": {
"state": "defaultEnabled"
}
},
"extraKnownMarketplaces": {
"acme-marketplace": {
"source": {
"source": "github",
"repo": "acme/copilot-marketplace"
}
}
}
}Delete Copilot customizations for a team
Note
This endpoint is in public preview and is subject to change.
Deletes the GitHub-managed Copilot customizations of a team. Deleting customizations that don't exist succeeds.
The authenticated user must be an organization owner or a team maintainer. Teams that keep their
customizations in a repository return 409.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
“Delete Copilot customizations for a team”的细粒度访问令牌
此端点支持以下精细令牌类型:
细粒度令牌必须具有以下权限集:
- "Copilot agent settings" organization permissions (write)
“”Delete Copilot customizations for a team 的参数
| 名称, 类型, 说明 |
|---|
accept string Setting to |
| 名称, 类型, 说明 |
|---|
org string 必须The organization name. The name is not case sensitive. |
team_slug string 必须The slug of the team name. |
“Delete Copilot customizations for a team”的 HTTP 响应状态代码
| 状态代码 | 说明 |
|---|---|
204 | No Content |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
409 | Conflict |
422 | Validation failed, or the endpoint has been spammed. |
500 | Internal Error |
503 | Service unavailable |
“Delete Copilot customizations for a team”的代码示例
请求示例
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/copilot/customizationsResponse
Status: 204