Use the REST API to manage connections between GitHub teams and external identity provider (IdP) groups.
About team synchronizationTo use these endpoints, the authenticated user must be a team maintainer or an owner of the organization associated with the team. The token you use to authenticate will also need to be authorized for use with your IdP (SSO) provider. For more information, see Authorizing a personal access token for use with single sign-on.
You can manage GitHub team members through your IdP with team synchronization. Team synchronization must be enabled to use these endpoints. For more information, see Managing team synchronization for your organization.
List IdP groups for an organization Code samples for "List IdP groups for an organization"If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
get/orgs/{org}/team-sync/groups
Copy to clipboard curl request example
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/orgs/ORG/team-sync/groups
Response
Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "group_description": "The people who configure your octoworld." }, { "group_id": "456", "group_name": "Octocat docs members", "group_description": "The people who make your octoworld come to life." } ] }
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
get/orgs/{org}/teams/{team_slug}/team-sync/group-mappings
Copy to clipboard curl request example
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/orgs/ORG/teams/TEAM_SLUG/team-sync/group-mappings
Response
Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "group_description": "The people who configure your octoworld." }, { "group_id": "456", "group_name": "Octocat docs members", "group_description": "The people who make your octoworld come to life." } ] }
Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty groups
array will remove all connections for a team.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Note
You can also specify a team by org_id
and team_id
using the route PATCH /organizations/{org_id}/team/{team_id}/team-sync/group-mappings
.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
accept
string
Setting to application/vnd.github+json
is recommended.
org
string Required
The organization name. The name is not case sensitive.
team_slug
string Required
The slug of the team name.
Body parameters Name, Type, Descriptiongroups
array of objects
The IdP groups you want to connect to a GitHub team. When updating, the new groups
object will replace the original one. You must include any existing groups that you don't want to remove.
groups
Name, Type, Description
group_id
string Required
ID of the IdP group.
group_name
string Required
Name of the IdP group.
group_description
string Required
Description of the IdP group.
HTTP response status codes for "Create or update IdP group connections" Status code Description200
OK
Code samples for "Create or update IdP group connections"If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
patch/orgs/{org}/teams/{team_slug}/team-sync/group-mappings
Copy to clipboard curl request example
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/orgs/ORG/teams/TEAM_SLUG/team-sync/group-mappings \ -d '{"groups":[{"group_id":"123","group_name":"Octocat admins","group_description":"string"}]}'
Response
Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "group_description": "The people who configure your octoworld." }, { "group_id": "456", "group_name": "Octocat docs members", "group_description": "The people who make your octoworld come to life." } ] }
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
get/teams/{team_id}/team-sync/group-mappings
Copy to clipboard curl request example
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/teams/TEAM_ID/team-sync/group-mappings
Response
Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "group_description": "The people who configure your octoworld." }, { "group_id": "456", "group_name": "Octocat docs members", "group_description": "The people who make your octoworld come to life." } ] }
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Create or update IdP group connections
endpoint.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty groups
array will remove all connections for a team.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
accept
string
Setting to application/vnd.github+json
is recommended.
team_id
integer Required
The unique identifier of the team.
Body parameters Name, Type, Descriptiongroups
array of objects Required
The IdP groups you want to connect to a GitHub team. When updating, the new groups
object will replace the original one. You must include any existing groups that you don't want to remove.
groups
Name, Type, Description
group_id
string Required
ID of the IdP group.
group_name
string Required
Name of the IdP group.
group_description
string Required
Description of the IdP group.
id
string
name
string
description
string
synced_at
string
200
OK
403
Forbidden
422
Validation failed, or the endpoint has been spammed.
Code samples for "Create or update IdP group connections (Legacy)"If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
patch/teams/{team_id}/team-sync/group-mappings
Copy to clipboard curl request example
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/teams/TEAM_ID/team-sync/group-mappings \ -d '{"groups":[{"group_id":"123","group_name":"Octocat admins","description":"The people who configure your octoworld.","group_description":"string"}]}'
Response
Status: 200
{ "groups": [ { "group_id": "123", "group_name": "Octocat admins", "group_description": "The people who configure your octoworld." } ] }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4