Skip to main content
Skip to content

Pontos de extremidade da API REST para organizações de equipes empresariais

Use a API REST para criar e gerenciar atribuições de organização para equipes empresariais em sua GitHub empresa.

Sobre organizações de equipe corporativa

Esses endpoints só estão disponíveis para membros autenticados da empresa da equipe Enterprise com classic personal access tokens com o read:enterpriseescopo para as APIs GET e admin:enterprise para outras APIs.

Esses endpoints não são compatíveis com fine-grained personal access tokens nem com tokens de acesso de GitHub App.

GitHub gera o slug da equipe empresarial com base na equipe name e adiciona o prefixo ent:.

Get organization assignments

Get all organizations assigned to an enterprise team

Tokens de acesso granulares para "Get organization assignments"

Este endpoint funciona com os seguintes tipos de token granulares:

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

  • "Enterprise teams" enterprise permissions (read)

Parâmetros para "Get organization assignments"

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

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

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

The slug version of the enterprise name.

enterprise-team string Obrigatório

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

Parâmetros de consulta
Nome, Tipo, Descrição
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Padrão: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Padrão: 1

Códigos de status de resposta HTTP para "Get organization assignments"

Código de statusDescrição
200

An array of organizations the team is assigned to

Exemplos de código para "Get organization assignments"

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/enterprises/{enterprise}/teams/{enterprise-team}/organizations
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/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/organizations

An array of organizations the team is assigned to

Status: 200
{ "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "hooks_url": "https://api.github.com/orgs/github/hooks", "issues_url": "https://api.github.com/orgs/github/issues", "members_url": "https://api.github.com/orgs/github/members{/member}", "public_members_url": "https://api.github.com/orgs/github/public_members{/member}", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "description": "A great organization" }

Add organization assignments

Assign an enterprise team to multiple organizations.

Tokens de acesso granulares para "Add organization assignments"

Este endpoint funciona com os seguintes tipos de token granulares:

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

  • "Enterprise teams" enterprise permissions (write)

Parâmetros para "Add organization assignments"

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

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

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

The slug version of the enterprise name.

enterprise-team string Obrigatório

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

Parâmetros do corpo
Nome, Tipo, Descrição
organization_slugs array of strings Obrigatório

Organization slug to assign the team to.

Códigos de status de resposta HTTP para "Add organization assignments"

Código de statusDescrição
200

Successfully assigned the enterprise team to organizations.

Exemplos de código para "Add organization assignments"

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

post/enterprises/{enterprise}/teams/{enterprise-team}/organizations/add
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/organizations/add \ -d '{"organization_slugs":["github"]}'

Successfully assigned the enterprise team to organizations.

Status: 200
[ { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "hooks_url": "https://api.github.com/orgs/github/hooks", "issues_url": "https://api.github.com/orgs/github/issues", "members_url": "https://api.github.com/orgs/github/members{/member}", "public_members_url": "https://api.github.com/orgs/github/public_members{/member}", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "description": "A great organization" } ]

Remove organization assignments

Unassign an enterprise team from multiple organizations.

Tokens de acesso granulares para "Remove organization assignments"

Este endpoint funciona com os seguintes tipos de token granulares:

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

  • "Enterprise teams" enterprise permissions (write)

Parâmetros para "Remove organization assignments"

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

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

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

The slug version of the enterprise name.

enterprise-team string Obrigatório

The slug version of the enterprise team name. You can also substitute this value with the enterprise team id.

Parâmetros do corpo
Nome, Tipo, Descrição
organization_slugs array of strings Obrigatório

Organization slug to unassign the team from.

Códigos de status de resposta HTTP para "Remove organization assignments"

Código de statusDescrição
204

Successfully unassigned the enterprise team from organizations.

Exemplos de código para "Remove organization assignments"

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

post/enterprises/{enterprise}/teams/{enterprise-team}/organizations/remove