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 verificação de IA

Use a API REST para obter e atualizar as configurações de Verificação de IA para uma organização.

Get the AI Scan setting for an organization

Note

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

Gets the AI Scan setting stored on an organization.

The response reports the value stored on the organization. Organization respects enterprise policy.

The authenticated user must be an owner or security manager for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org, repo, or write:org scope to use this endpoint. Organization owners can use admin:org or repo; security managers need write:org.

Tokens de acesso granulares para "Get the AI Scan setting for an organization"

Este endpoint funciona com os seguintes tipos de token granulares:

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

  • "Administration" organization permissions (read)

Parâmetros para "Get the AI Scan setting 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 the AI Scan setting for an organization"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

Exemplos de código para "Get the AI Scan setting for an organization"

Se você acessar GitHub em GHE.com, substitua api.github.com pelo subdomínio dedicado da sua empresa em api.SUBDOMAIN.ghe.com.

Exemplo de solicitação

get/orgs/{org}/code-scanning/ai-scan
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/code-scanning/ai-scan

Response

Status: 200
{ "pr_scan": "enabled" }

Update the AI Scan setting for an organization

Note

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

Updates the AI Scan setting stored on an organization.

The organization respects the enterprise policy, so enabling is rejected when the enterprise disallows AI Scan.

OAuth app tokens and personal access tokens (classic) need the admin:org, repo, or write:org scope to use this endpoint. Organization owners can use admin:org or repo; security managers need write:org.

Tokens de acesso granulares para "Update the AI Scan setting for an organization"

Este endpoint funciona com os seguintes tipos de token granulares:

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

  • "Administration" organization permissions (write)

Parâmetros para "Update the AI Scan setting 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.

Parâmetros do corpo
Nome, Tipo, Descrição
pr_scan string

Whether AI Scan is enabled for the organization. Organization respects enterprise policy. Disabled organizations prevent repositories from enabling AI Scan. Enabled organizations enable AI Scan for their repositories, but individual repositories can opt out.

Pode ser um dos: enabled, disabled

Códigos de status de resposta HTTP para "Update the AI Scan setting for an organization"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Update the AI Scan setting for an organization"

Se você acessar GitHub em GHE.com, substitua api.github.com pelo subdomínio dedicado da sua empresa em api.SUBDOMAIN.ghe.com.

Exemplo de solicitação

patch/orgs/{org}/code-scanning/ai-scan
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/code-scanning/ai-scan \ -d '{"pr_scan":"enabled"}'

Response

Status: 200
{ "pr_scan": "enabled" }