{"meta":{"title":"Pontos de extremidade de API REST para sincronização de equipe","intro":"Use a API REST para gerenciar conexões entre GitHub equipes e grupos de IdP (provedor de identidade externo).","product":"API REST","breadcrumbs":[{"href":"/pt/enterprise-cloud@latest/rest","title":"API REST"},{"href":"/pt/enterprise-cloud@latest/rest/teams","title":"Teams"},{"href":"/pt/enterprise-cloud@latest/rest/teams/team-sync","title":"Sincronização de equipe"}],"documentType":"article"},"body":"# Pontos de extremidade de API REST para sincronização de equipe\n\nUse a API REST para gerenciar conexões entre GitHub equipes e grupos de IdP (provedor de identidade externo).\n\n## Sobre a sincronização de equipes\n\nPara usar esses endpoints, o usuário precisa estar autenticado e atuar como mantenedor da equipe ou proprietário da organização a qual a equipe está associada. O token que você usa para efetuar a autenticação também deverá ser autorizado para uso com o provedor de IdP (SSO). Para saber mais, confira [Como autorizar um token de acesso pessoal para uso com logon único](/pt/enterprise-cloud@latest/authentication/authenticating-with-single-sign-on/authorizing-a-personal-access-token-for-use-with-single-sign-on).\n\nVocê pode gerenciar membros da equipe do GitHub usando seu IdP com a sincronização de equipe. A sincronização de equipe deve estar habilitada para usar esses endpoints. Para saber mais, confira [Gerenciando a sincronização da equipe para a sua organização](/pt/enterprise-cloud@latest/organizations/managing-saml-single-sign-on-for-your-organization/managing-team-synchronization-for-your-organization).\n\n> \\[!NOTE]\n> Esses endpoints não podem ser usados com Enterprise Managed Users. Para saber mais sobre como gerenciar um organização com usuários gerenciados, consulte [Endpoints de API REST para grupos externos](/pt/enterprise-cloud@latest/rest/teams/external-groups).\n\n> \\[!NOTE]\n> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.\n\n## List IdP groups for an organization\n\n```\nGET /orgs/{org}/team-sync/groups\n```\n\nLists IdP groups available in an organization.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (string)\n  Page token\n\n* **`q`** (string)\n  Filters the results to return only those that begin with the value specified by this parameter. For example, a value of ab will return results that begin with \"ab\".\n\n### HTTP response status codes\n\n* **200** - OK\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/orgs/ORG/team-sync/groups\n```\n\n**Response schema (Status: 200):**\n\n* `groups`: array of objects:\n  * `group_id`: required, string\n  * `group_name`: required, string\n  * `group_description`: required, string\n  * `status`: string\n  * `synced_at`: string or null\n\n## List IdP groups for a team\n\n```\nGET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings\n```\n\nList IdP groups connected to a team on GitHub Enterprise Cloud.\nTeam synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.\nNote\n\nYou 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.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n* **`team_slug`** (string) (required)\n  The slug of the team name.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **422** - Unprocessable entity if you attempt to modify an enterprise team at the organization level.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/team-sync/group-mappings\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [List IdP groups for an organization](#list-idp-groups-for-an-organization).\n\n## Create or update IdP group connections\n\n```\nPATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings\n```\n\nCreates, 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.\nTeam synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.\nNote\n\nYou 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.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n* **`team_slug`** (string) (required)\n  The slug of the team name.\n\n#### Body parameters\n\n* **`groups`** (array of objects)\n  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.\n  * **`group_id`** (string) (required)\n    ID of the IdP group.\n  * **`group_name`** (string) (required)\n    Name of the IdP group.\n  * **`group_description`** (string) (required)\n    Description of the IdP group.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **422** - Unprocessable entity if you attempt to modify an enterprise team at the organization level.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PATCH \\\n  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/team-sync/group-mappings \\\n  -d '{\n  \"groups\": [\n    {\n      \"group_id\": \"123\",\n      \"group_name\": \"Octocat admins\",\n      \"group_description\": \"string\"\n    }\n  ]\n}'\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [List IdP groups for an organization](#list-idp-groups-for-an-organization).\n\n## List IdP groups for a team (Legacy)\n\n```\nGET /teams/{team_id}/team-sync/group-mappings\n```\n\nWarning\n\nEndpoint 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 List IdP groups for a team endpoint.\n\nTeam synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.\nList IdP groups connected to a team on GitHub Enterprise Cloud.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`team_id`** (integer) (required)\n  The unique identifier of the team.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/teams/TEAM_ID/team-sync/group-mappings\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [List IdP groups for an organization](#list-idp-groups-for-an-organization).\n\n## Create or update IdP group connections (Legacy)\n\n```\nPATCH /teams/{team_id}/team-sync/group-mappings\n```\n\nWarning\n\nEndpoint 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.\n\nTeam synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.\nCreates, 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.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`team_id`** (integer) (required)\n  The unique identifier of the team.\n\n#### Body parameters\n\n* **`groups`** (array of objects) (required)\n  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.\n  * **`group_id`** (string) (required)\n    ID of the IdP group.\n  * **`group_name`** (string) (required)\n    Name of the IdP group.\n  * **`group_description`** (string) (required)\n    Description of the IdP group.\n  * **`id`** (string)\n  * **`name`** (string)\n  * **`description`** (string)\n\n* **`synced_at`** (string)\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **403** - Forbidden\n\n* **422** - Validation failed, or the endpoint has been spammed.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PATCH \\\n  https://api.github.com/teams/TEAM_ID/team-sync/group-mappings \\\n  -d '{\n  \"groups\": [\n    {\n      \"group_id\": \"123\",\n      \"group_name\": \"Octocat admins\",\n      \"description\": \"The people who configure your octoworld.\",\n      \"group_description\": \"string\"\n    }\n  ]\n}'\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [List IdP groups for an organization](#list-idp-groups-for-an-organization)."}