Skip to main content
L’API REST est maintenant versionnée. Pour plus d’informations, consultez « À propos des versions de l’API ».

Points de terminaison d’API REST pour les équipes d’entreprise

Utilisez l’API REST pour créer et gérer des équipes d’entreprise dans votre entreprise GitHub.

À propos des équipes d’entreprise

Remarque

Ces points de terminaison se trouvent actuellement en préversion publique et peuvent être amenés à changer.

Cette documentation API est destinée aux entreprises sur GitHub Enterprise Cloud.

Si votre entreprise utilise Copilot Business pour un environnement non-GHE, veuillez vous référer au lien de documentation en accès anticipé qui vous a été communiqué précédemment.

Ces points de terminaison ne sont disponibles que pour les membres authentifiés de l’entreprise de l’équipe d’entreprise, disposant de personal access tokens classiques avec l’étendue read:enterprise pour les API GET et admin:enterprise pour les autres API.

Ces points de terminaison ne sont pas compatibles avec fine-grained personal access tokens ni avec les jetons d’accès GitHub App.

GitHub génère le slug de l’équipe d’entreprise à partir de l’équipe name et ajoute le préfixe ent:.

List enterprise teams

List all teams in the enterprise for the authenticated user

Jetons d'accès granulaires pour «List enterprise teams»

Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:

Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:

  • "Enterprise teams" enterprise permissions (read)

Paramètres pour «List enterprise teams »

En-têtes
Nom, Type, Description
accept string

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

Paramètres de chemin d’accès
Nom, Type, Description
enterprise string Requis

The slug version of the enterprise name.

Paramètres de requête
Nom, Type, Description
per_page integer

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

Par défaut: 30

page integer

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

Par défaut: 1

Codes d’état de réponse HTTP pour «List enterprise teams »

Code de statutDescription
200

OK

403

Forbidden

Exemples de code pour «List enterprise teams »

Exemple de requête

get/enterprises/{enterprise}/teams
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams

Response

Status: 200
[ { "id": 1, "name": "Justice League", "description": "A great team.", "slug": "justice-league", "url": "https://HOSTNAME/enterprises/dc/teams/justice-league", "group_id": "62ab9291-fae2-468e-974b-7e45096d5021", "html_url": "https://github.com/enterprises/dc/teams/justice-league", "members_url": "https://HOSTNAME/enterprises/dc/teams/justice-league/members{/member}", "created_at": "2019-01-26T19:01:12Z", "updated_at": "2019-01-26T19:14:43Z" } ]

Create an enterprise team

To create an enterprise team, the authenticated user must be an owner of the enterprise.

Jetons d'accès granulaires pour «Create an enterprise team»

Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:

Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:

  • "Enterprise teams" enterprise permissions (write)

Paramètres pour «Create an enterprise team »

En-têtes
Nom, Type, Description
accept string

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

Paramètres de chemin d’accès
Nom, Type, Description
enterprise string Requis

The slug version of the enterprise name.

Paramètres du corps
Nom, Type, Description
name string Requis

The name of the team.

description string or null

A description of the team.

sync_to_organizations string

Retired: this field is no longer supported. Whether the enterprise team should be reflected in each organization. This value cannot be set.

Par défaut: disabled

Peut être l'un des: all, disabled

organization_selection_type string

Specifies which organizations in the enterprise should have access to this team. Can be one of disabled, selected, or all. disabled: The team is not assigned to any organizations. This is the default when you create a new team. selected: The team is assigned to specific organizations. You can then use the add organization assignments API endpoint. all: The team is assigned to all current and future organizations in the enterprise.

Par défaut: disabled

Peut être l'un des: disabled, selected, all

group_id string or null

The ID of the IdP group to assign team membership with. You can get this value from the REST API endpoints for SCIM.

Codes d’état de réponse HTTP pour «Create an enterprise team »

Code de statutDescription
201

Created

Exemples de code pour «Create an enterprise team »

Exemple de requête

post/enterprises/{enterprise}/teams
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams \ -d '{"name":"Justice League","description":"A great team.","group_id":"62ab9291-fae2-468e-974b-7e45096d5021"}'

Response

Status: 201
{ "id": 1, "name": "Justice League", "description": "A great team.", "slug": "justice-league", "url": "https://HOSTNAME/enterprises/dc/teams/justice-league", "group_id": "62ab9291-fae2-468e-974b-7e45096d5021", "html_url": "https://github.com/enterprises/dc/teams/justice-league", "members_url": "https://HOSTNAME/enterprises/dc/teams/justice-league/members{/member}", "created_at": "2019-01-26T19:01:12Z", "updated_at": "2019-01-26T19:14:43Z" }

Get an enterprise team

Gets a team using the team's slug. To create the slug, GitHub replaces special characters in the name string, changes all words to lowercase, and replaces spaces with a - separator and adds the "ent:" prefix. For example, "My TEam Näme" would become ent:my-team-name.

Jetons d'accès granulaires pour «Get an enterprise team»

Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:

Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:

  • "Enterprise teams" enterprise permissions (read)

Paramètres pour «Get an enterprise team »

En-têtes
Nom, Type, Description
accept string

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

Paramètres de chemin d’accès
Nom, Type, Description
enterprise string Requis

The slug version of the enterprise name.

team_slug string Requis

The slug of the team name.

Codes d’état de réponse HTTP pour «Get an enterprise team »

Code de statutDescription
200

OK

403

Forbidden

Exemples de code pour «Get an enterprise team »

Exemple de requête

get/enterprises/{enterprise}/teams/{team_slug}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/TEAM_SLUG

Response

Status: 200
{ "id": 1, "name": "Justice League", "description": "A great team.", "slug": "justice-league", "url": "https://HOSTNAME/enterprises/dc/teams/justice-league", "group_id": "62ab9291-fae2-468e-974b-7e45096d5021", "html_url": "https://github.com/enterprises/dc/teams/justice-league", "members_url": "https://HOSTNAME/enterprises/dc/teams/justice-league/members{/member}", "created_at": "2019-01-26T19:01:12Z", "updated_at": "2019-01-26T19:14:43Z" }

Update an enterprise team

To edit a team, the authenticated user must be an enterprise owner.

Jetons d'accès granulaires pour «Update an enterprise team»

Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:

Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:

  • "Enterprise teams" enterprise permissions (write)

Paramètres pour «Update an enterprise team »

En-têtes
Nom, Type, Description
accept string

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

Paramètres de chemin d’accès
Nom, Type, Description
enterprise string Requis

The slug version of the enterprise name.

team_slug string Requis

The slug of the team name.

Paramètres du corps
Nom, Type, Description
name string or null

A new name for the team.

description string or null

A new description for the team.

sync_to_organizations string

Retired: this field is no longer supported. Whether the enterprise team should be reflected in each organization. This value cannot be changed.

Par défaut: disabled

Peut être l'un des: all, disabled

organization_selection_type string

Specifies which organizations in the enterprise should have access to this team. Can be one of disabled, selected, or all. disabled: The team is not assigned to any organizations. This is the default when you create a new team. selected: The team is assigned to specific organizations. You can then use the add organization assignments API. all: The team is assigned to all current and future organizations in the enterprise.

Par défaut: disabled

Peut être l'un des: disabled, selected, all

group_id string or null

The ID of the IdP group to assign team membership with. The new IdP group will replace the existing one, or replace existing direct members if the team isn't currently linked to an IdP group.

Codes d’état de réponse HTTP pour «Update an enterprise team »

Code de statutDescription
200

OK

403

Forbidden

Exemples de code pour «Update an enterprise team »

Exemple de requête

patch/enterprises/{enterprise}/teams/{team_slug}
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/TEAM_SLUG \ -d '{"name":"Justice League","description":"A great team.","group_id":"62ab9291-fae2-468e-974b-7e45096d5021"}'

Response

Status: 200
{ "id": 1, "name": "Justice League", "description": "A great team.", "slug": "justice-league", "url": "https://HOSTNAME/enterprises/dc/teams/justice-league", "group_id": "62ab9291-fae2-468e-974b-7e45096d5021", "html_url": "https://github.com/enterprises/dc/teams/justice-league", "members_url": "https://HOSTNAME/enterprises/dc/teams/justice-league/members{/member}", "created_at": "2019-01-26T19:01:12Z", "updated_at": "2019-01-26T19:14:43Z" }

Delete an enterprise team

To delete an enterprise team, the authenticated user must be an enterprise owner.

If you are an enterprise owner, deleting an enterprise team will delete all of its IdP mappings as well.

Jetons d'accès granulaires pour «Delete an enterprise team»

Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:

Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:

  • "Enterprise teams" enterprise permissions (write)

Paramètres pour «Delete an enterprise team »

En-têtes
Nom, Type, Description
accept string

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

Paramètres de chemin d’accès
Nom, Type, Description
enterprise string Requis

The slug version of the enterprise name.

team_slug string Requis

The slug of the team name.

Codes d’état de réponse HTTP pour «Delete an enterprise team »

Code de statutDescription
204

No Content

403

Forbidden

Exemples de code pour «Delete an enterprise team »

Exemple de requête

delete/enterprises/{enterprise}/teams/{team_slug}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/teams/TEAM_SLUG

Response

Status: 204