REST API endpoints for enterprise team organizations
Use the REST API to create and manage organization assignments for enterprise teams in your GitHub enterprise.
About enterprise team organizations
Remarque
These endpoints are currently in public preview and subject to change.
This API documentation is for enterprises on GitHub Enterprise Cloud.
If your enterprise is Copilot Business for non-GHE, please refer to the early access documentation link that was previously shared to you.
These endpoints are only available to authenticated members of the enterprise team's enterprise with classic personal access tokens with the read:enterprise scope for GET APIs and admin:enterprise for other APIs.
These endpoints are not compatible with fine-grained personal access tokens or GitHub App access tokens.
GitHub generates the enterprise team's slug from the team name and adds the ent: prefix.
Get organization assignments
Get all organizations assigned to an enterprise team
Jetons d’accès affinés pour « Get organization assignments »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « Get organization assignments »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
enterprise string ObligatoireThe slug version of the enterprise name. |
enterprise-team string ObligatoireThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Nom, Type, Description |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « Get organization assignments »
| Code d’état | Description |
|---|---|
200 | An array of organizations the team is assigned to |
Exemples de code pour « Get organization assignments »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com.
Exemple de requête
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/organizationsAn 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.
Jetons d’accès affinés pour « Add organization assignments »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « Add organization assignments »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
enterprise string ObligatoireThe slug version of the enterprise name. |
enterprise-team string ObligatoireThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Nom, Type, Description |
|---|
organization_slugs array of strings ObligatoireOrganization slug to assign the team to. |
Codes d’état de la réponse HTTP pour « Add organization assignments »
| Code d’état | Description |
|---|---|
200 | Successfully assigned the enterprise team to organizations. |
Exemples de code pour « Add organization assignments »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com.
Exemple de requête
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
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.
Jetons d’accès affinés pour « Remove organization assignments »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « Remove organization assignments »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
enterprise string ObligatoireThe slug version of the enterprise name. |
enterprise-team string ObligatoireThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
| Nom, Type, Description |
|---|
organization_slugs array of strings ObligatoireOrganization slug to unassign the team from. |
Codes d’état de la réponse HTTP pour « Remove organization assignments »
| Code d’état | Description |
|---|---|
204 | Successfully unassigned the enterprise team from organizations. |
Exemples de code pour « Remove organization assignments »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com.
Exemple de requête
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/organizations/remove \
-d '{"organization_slugs":["github"]}'Successfully unassigned the enterprise team from organizations.
Status: 204Get organization assignment
Check if an enterprise team is assigned to an organization
Jetons d’accès affinés pour « Get organization assignment »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « Get organization assignment »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
enterprise string ObligatoireThe slug version of the enterprise name. |
enterprise-team string ObligatoireThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
org string ObligatoireThe organization name. The name is not case sensitive. |
Codes d’état de la réponse HTTP pour « Get organization assignment »
| Code d’état | Description |
|---|---|
200 | The team is assigned to the organization |
404 | The team is not assigned to the organization |
Exemples de code pour « Get organization assignment »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com.
Exemple de requête
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/organizations/ORGThe team is assigned to the organization
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 an organization assignment
Assign an enterprise team to an organization.
Jetons d’accès affinés pour « Add an organization assignment »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « Add an organization assignment »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
enterprise string ObligatoireThe slug version of the enterprise name. |
enterprise-team string ObligatoireThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
org string ObligatoireThe organization name. The name is not case sensitive. |
Codes d’état de la réponse HTTP pour « Add an organization assignment »
| Code d’état | Description |
|---|---|
201 | Successfully assigned the enterprise team to the organization. |
Exemples de code pour « Add an organization assignment »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com.
Exemple de requête
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/organizations/ORGSuccessfully assigned the enterprise team to the organization.
Status: 201{
"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"
}Delete an organization assignment
Unassign an enterprise team from an organization.
Jetons d’accès affinés pour « Delete an organization assignment »
Ce point de terminaison ne fonctionne pas avec les jetons d’accès utilisateur d’application GitHub, les jetons d’accès d’installation d’application GitHub ou les jetons d’accès personnels affinés.
Paramètres pour « Delete an organization assignment »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
enterprise string ObligatoireThe slug version of the enterprise name. |
enterprise-team string ObligatoireThe slug version of the enterprise team name. You can also substitute this value with the enterprise team id. |
org string ObligatoireThe organization name. The name is not case sensitive. |
Codes d’état de la réponse HTTP pour « Delete an organization assignment »
| Code d’état | Description |
|---|---|
204 | Successfully unassigned the enterprise team from the organization. |
Exemples de code pour « Delete an organization assignment »
Si vous accédez à GitHub à GHE.com, remplacez api.github.com par le sous-domaine dédié de votre entreprise à api.SUBDOMAIN.ghe.com.
Exemple de requête
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/teams/ENTERPRISE-TEAM/organizations/ORGSuccessfully unassigned the enterprise team from the organization.
Status: 204