{"meta":{"title":"Конечные точки REST API для синхронизации групп","intro":"Используйте REST API для управления подключениями между GitHub командами и группами внешнего поставщика удостоверений (IdP).","product":"REST API","breadcrumbs":[{"href":"/ru/enterprise-cloud@latest/rest","title":"REST API"},{"href":"/ru/enterprise-cloud@latest/rest/teams","title":"Teams"},{"href":"/ru/enterprise-cloud@latest/rest/teams/team-sync","title":"Синхронизация команд"}],"documentType":"article"},"body":"# Конечные точки REST API для синхронизации групп\n\nИспользуйте REST API для управления подключениями между GitHub командами и группами внешнего поставщика удостоверений (IdP).\n\n## Синхронизация команд\n\nЧтобы использовать эти конечные точки, прошедший проверку подлинности пользователь должен быть ответственный за команду или владельцем организации, связанной с командой. Маркер, используемый для проверки подлинности, также должен быть авторизован для использования с поставщиком удостоверений (SSO). Дополнительные сведения см. в разделе [Авторизация личного маркера доступа для использования с единым входом](/ru/enterprise-cloud@latest/authentication/authenticating-with-single-sign-on/authorizing-a-personal-access-token-for-use-with-single-sign-on).\n\nВы можете управлять GitHub участниками группы с помощью поставщика удостоверений с помощью синхронизации команды. Синхронизация команд должна быть включена для использования этих конечных точек. Дополнительные сведения см. в разделе [Управление синхронизацией команд в организации](/ru/enterprise-cloud@latest/organizations/managing-saml-single-sign-on-for-your-organization/managing-team-synchronization-for-your-organization).\n\n> \\[!NOTE]\n> Эти конечные точки нельзя использовать с Enterprise Managed Users. Дополнительные сведения об управлении ими организация с управляемыми пользователямисм. в разделе [Конечные точки REST API для внешних групп](/ru/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)."}