用于Copilot功能策略管理的 REST API 终结点
使用 REST API 管理某个组织的 Copilot 功能策略。
Get feature policies for an organization
Note
This endpoint is in public preview and is subject to change.
Use this endpoint to retrieve the Copilot default availability policy for new features and clients for an organization.
The enterprise default is used when the enterprise has set one. Otherwise, the organization's
own default is used, and an organization that has not enabled a default is reported as
disabled. For more information, see
About default availability.
Organization owners can use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:org or repo scope to use this endpoint.
Organization SAML authorization and OAuth app access restrictions also apply.
“Get feature policies for an organization”的细粒度访问令牌
此端点支持以下精细令牌类型:
细粒度令牌必须具有以下权限集:
- "Administration" organization permissions (write)
“”Get feature policies for an organization 的参数
| 名称, 类型, 说明 |
|---|
accept string Setting to |
| 名称, 类型, 说明 |
|---|
org string 必须The organization name. The name is not case sensitive. |
“Get feature policies for an organization”的 HTTP 响应状态代码
| 状态代码 | 说明 |
|---|---|
200 | OK |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
“Get feature policies for an organization”的代码示例
如果你在 GHE.com 上访问 GitHub,请将 api.github.com 替换为企业的专用子域,位于 api.SUBDOMAIN.ghe.com。
请求示例
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/copilot/feature-policiesOK
Status: 200{
"default_availability": {
"policy_state": "enabled",
"editable": true
}
}Update feature policies for an organization
Note
This endpoint is in public preview and is subject to change.
Use this endpoint to update the Copilot default availability policy for new features and clients for an organization.
An organization can only set its own default while its enterprise has not set one. For more information, see About default availability.
Changing this policy does not change any Copilot feature or client policy that has already been set.
Organization owners can use this endpoint.
OAuth app tokens and personal access tokens (classic) need the admin:org or repo scope to use this endpoint.
Organization SAML authorization and OAuth app access restrictions also apply.
“Update feature policies for an organization”的细粒度访问令牌
此端点支持以下精细令牌类型:
细粒度令牌必须具有以下权限集:
- "Administration" organization permissions (write)
“”Update feature policies for an organization 的参数
| 名称, 类型, 说明 |
|---|
accept string Setting to |
| 名称, 类型, 说明 |
|---|
org string 必须The organization name. The name is not case sensitive. |
| 名称, 类型, 说明 | ||
|---|---|---|
default_availability object 必须 | ||
Properties of |
| 名称, 类型, 说明 |
|---|
policy_state string 必须The organization default policy applied to newly released Copilot features and clients. 可以是以下选项之一: |
“Update feature policies for an organization”的 HTTP 响应状态代码
| 状态代码 | 说明 |
|---|---|
200 | OK |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
“Update feature policies for an organization”的代码示例
如果你在 GHE.com 上访问 GitHub,请将 api.github.com 替换为企业的专用子域,位于 api.SUBDOMAIN.ghe.com。
请求示例
curl -L \
-X PATCH \
-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/copilot/feature-policies \
-d '{"default_availability":{"policy_state":"enabled"}}'OK
Status: 200{
"default_availability": {
"policy_state": "enabled",
"editable": true
}
}