Team synchronization
The Team synchronization API allows you to manage connections between GitHub teams and external identity provider (IdP) groups.
About the Team synchronization API
To use this API, 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 a SAML single sign-on organization."
You can manage GitHub team members through your IdP with team synchronization. Team synchronization must be enabled to use the Team Synchronization API. For more information, see "Synchronizing teams between your identity provider and GitHub."
Note: The Team Synchronization API cannot be used with Enterprise Managed Users. To learn more about managing an organization with managed users, see "External groups API".
List IdP groups for an organization
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
List IdP groups available in an organization. You can limit your page results using the per_page parameter. GitHub generates a url-encoded page token using a cursor value for where the next page begins. For more information on cursor pagination, see "Offset and Cursor Pagination explained."
Parameters
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
orgstringRequiredThe organization name. The name is not case sensitive. |
| Query parameters |
| Name, Type, Description |
per_pageintegerThe number of results per page (max 100). Default: |
pagestringPage token |
HTTP response status codes
| Status code | Description |
|---|---|
200 | OK |
Code samples
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/team-sync/groupsResponse
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."
}
]
}List IdP groups 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.
List IdP groups connected to a team on GitHub.
Note: You can also specify a team by org_id and team_id using the route GET /organizations/{org_id}/team/{team_id}/team-sync/group-mappings.
Parameters
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
orgstringRequiredThe organization name. The name is not case sensitive. |
team_slugstringRequiredThe slug of the team name. |
HTTP response status codes
| Status code | Description |
|---|---|
200 | OK |
Code samples
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/team-sync/group-mappingsResponse
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."
}
]
}Create or update IdP group connections
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.
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.
Parameters
| Headers | |||||||
|---|---|---|---|---|---|---|---|
| Name, Type, Description | |||||||
acceptstringSetting to | |||||||
| Path parameters | |||||||
| Name, Type, Description | |||||||
orgstringRequiredThe organization name. The name is not case sensitive. | |||||||
team_slugstringRequiredThe slug of the team name. | |||||||
| Body parameters | |||||||
| Name, Type, Description | |||||||
groupsarray of objectsThe IdP groups you want to connect to a GitHub team. When updating, the new | |||||||
Properties of the | |||||||
| Name, Type, Description |
|---|
group_idstringRequiredID of the IdP group. |
group_namestringRequiredName of the IdP group. |
group_descriptionstringRequiredDescription of the IdP group. |
HTTP response status codes
| Status code | Description |
|---|---|
200 | OK |
Code samples
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
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."
}
]
}List IdP groups for a team (Legacy)
Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List IdP groups for a team endpoint.
Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
List IdP groups connected to a team on GitHub.
Parameters
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
team_idintegerRequiredThe unique identifier of the team. |
HTTP response status codes
| Status code | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Code samples
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/teams/TEAM_ID/team-sync/group-mappingsResponse
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."
}
]
}Create or update IdP group connections (Legacy)
Deprecation Notice: This endpoint route is deprecated 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.
Parameters
| Headers | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Name, Type, Description | ||||||||||
acceptstringSetting to | ||||||||||
| Path parameters | ||||||||||
| Name, Type, Description | ||||||||||
team_idintegerRequiredThe unique identifier of the team. | ||||||||||
| Body parameters | ||||||||||
| Name, Type, Description | ||||||||||
groupsarray of objectsRequiredThe IdP groups you want to connect to a GitHub team. When updating, the new | ||||||||||
Properties of the | ||||||||||
| Name, Type, Description |
|---|
group_idstringRequiredID of the IdP group. |
group_namestringRequiredName of the IdP group. |
group_descriptionstringRequiredDescription of the IdP group. |
idstring |
namestring |
descriptionstring |
synced_atstringHTTP response status codes
| Status code | Description |
|---|---|
200 | OK |
403 | Forbidden |
422 | Validation failed |
Code samples
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
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."
}
]
}