---
title: "Create or update IdP group connections"
method: PATCH
path: "/orgs/{org}/teams/{team_slug}/team-sync/group-mappings"
tags: ["teams"]
---

# Create or update IdP group connections

`PATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings`

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](https://docs.github.com/enterprise-cloud@latest/github/getting-started-with-github/githubs-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`.

## Path parameters

- `org` string, required
- `team_slug` string, required

## Request body

- object
  - `groups` object[] — 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.
    - `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.

## Response `200`

Response

- GroupMapping — External Groups to be mapped to a team for membership
  - `groups` object[] — Array of groups to be mapped to this team
    - `group_id` string, required — The ID of the group
    - `group_name` string, required — The name of the group
    - `group_description` string, required — a description of the group
    - `status` string — synchronization status for this group mapping
    - `synced_at` string, nullable — the time of the last sync for this group-mapping

## Other responses

- `422` — Unprocessable entity if you attempt to modify an enterprise team at the organization level.

---

[API](https://skmtc.net/github/apis/ghec.md) · [All operations](https://skmtc.net/github/apis/ghec/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/ghec/revisions/8ae6d0c8716e/schema)
