Skip to main content
A API REST agora é versionada. Para obter mais informações, confira "Sobre o controle de versão da API".

Pontos de extremidade da API REST para o gerenciamento de exclusão de conteúdo do Copilot

Use a API REST para gerenciar as regras de exclusão de conteúdo Copilot.

Get Copilot content exclusion rules for an organization

Note

This endpoint is in public preview and is subject to change.

Gets information about an organization's Copilot content exclusion path rules. To configure these settings, go to the organization's settings on GitHub. For more information, see "Excluding content from GitHub Copilot."

Organization owners can view details about Copilot content exclusion rules for the organization.

OAuth app tokens and personal access tokens (classic) need either the copilot or read:org scopes to use this endpoint.

Caution

  • At this time, the API does not support comments. This endpoint will not return any comments in the existing rules.
  • At 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.

Tokens de acesso granular para "Get Copilot content exclusion rules for an organization"

Este endpoint funciona com os seguintes tipos de token granulares:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Copilot content exclusion" organization permissions (read)

Parâmetros para "Get Copilot content exclusion rules for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Get Copilot content exclusion rules for an organization"

Código de statusDescrição
200

OK

401

Requires authentication

403

Forbidden

404

Resource not found

500

Internal Error

Exemplos de código para "Get Copilot content exclusion rules for an organization"

Exemplo de solicitação

get/orgs/{org}/copilot/content_exclusion
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/content_exclusion

OK

Status: 200
{ "octo-repo": [ "/src/some-dir/kernel.rs" ] }

Set Copilot content exclusion rules for an organization

Note

This endpoint is in public preview and is subject to change.

Sets Copilot content exclusion path rules for an organization. To configure these settings, go to the organization's settings on GitHub. For more information, see "Excluding content from GitHub Copilot."

Organization owners can set Copilot content exclusion rules for the organization.

OAuth app tokens and personal access tokens (classic) need the copilot scope to use this endpoint.

Caution

  • At this time, the API does not support comments. When using this endpoint, any existing comments in your rules will be deleted.
  • At 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.

Tokens de acesso granular para "Set Copilot content exclusion rules for an organization"

Este endpoint funciona com os seguintes tipos de token granulares:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Copilot content exclusion" organization permissions (write)

Parâmetros para "Set Copilot content exclusion rules for an organization"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

Códigos de status de resposta HTTP para "Set Copilot content exclusion rules for an organization"

Código de statusDescrição
200

Success

401

Requires authentication

403

Forbidden

404

Resource not found

413

Payload Too Large

422

Validation failed, or the endpoint has been spammed.

500

Internal Error

Exemplos de código para "Set Copilot content exclusion rules for an organization"

Exemplo de solicitação

put/orgs/{org}/copilot/content_exclusion
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/copilot/content_exclusion \ -d '{"octo-repo":["/src/some-dir/kernel.rs"]}'

Success

Status: 200
{ "message": "Content exclusion rules updated successfully." }