チーム同期用の REST API エンドポイント
REST API を使って、GitHub チームと外部 ID プロバイダー (IdP) グループ間の接続を管理します。
Team の同期について
これらのエンドポイントを使うには、認証されたユーザーが、チーム メンテナーであるか、またはチームに関連づけられた組織の所有者である必要があります。 また、認証に使用するトークンも、お使いの IdP (SSO) プロバイダーで使用するための認可を受けている必要があります。 詳しくは、「シングル サインオンに使用する個人用アクセス トークンの認可」をご覧ください。
チームの同期を使って、IdP から GitHub チームのメンバーを管理できます。 これらのエンドポイントを使うには、チームの同期を有効にする必要があります。 詳しくは、「Organization の Team 同期を管理する」をご覧ください。
メモ
これらのエンドポイントは、Enterprise Managed Users では使えません。 マネージド ユーザーを含む Organization の管理の詳細については、「外部グループの REST API エンドポイント」を参照してください。
List IdP groups for an organization
Lists IdP groups available in an organization.
"List IdP groups for an organization" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Members" organization permissions (write)
"List IdP groups for an organization" のパラメーター
| 名前, Type, 説明 | 
|---|
| acceptstringSetting to  | 
| 名前, Type, 説明 | 
|---|
| orgstring 必須The organization name. The name is not case sensitive. | 
| 名前, Type, 説明 | 
|---|
| per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API." Default:  | 
| pagestringPage token | 
| qstringFilters the results to return only those that begin with the value specified by this parameter. For example, a value of  | 
"List IdP groups for an organization" の HTTP 応答状態コード
| 状態コード | 説明 | 
|---|---|
| 200 | OK | 
"List IdP groups for an organization" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
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/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
List IdP groups connected to a team on GitHub Enterprise Cloud.
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 GET /organizations/{org_id}/team/{team_id}/team-sync/group-mappings.
"List IdP groups for a team" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Members" organization permissions (write)
"List IdP groups for a team" のパラメーター
| 名前, Type, 説明 | 
|---|
| acceptstringSetting to  | 
| 名前, Type, 説明 | 
|---|
| orgstring 必須The organization name. The name is not case sensitive. | 
| team_slugstring 必須The slug of the team name. | 
"List IdP groups for a team" の HTTP 応答状態コード
| 状態コード | 説明 | 
|---|---|
| 200 | OK | 
"List IdP groups for a team" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
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-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
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.
"Create or update IdP group connections" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Members" organization permissions (write)
"Create or update IdP group connections" のパラメーター
| 名前, Type, 説明 | 
|---|
| acceptstringSetting to  | 
| 名前, Type, 説明 | 
|---|
| orgstring 必須The organization name. The name is not case sensitive. | 
| team_slugstring 必須The slug of the team name. | 
| 名前, Type, 説明 | ||||
|---|---|---|---|---|
| groupsarray of objectsThe IdP groups you want to connect to a GitHub team. When updating, the new  | ||||
| Properties of  | 
| 名前, Type, 説明 | 
|---|
| group_idstring 必須ID of the IdP group. | 
| group_namestring 必須Name of the IdP group. | 
| group_descriptionstring 必須Description of the IdP group. | 
"Create or update IdP group connections" の HTTP 応答状態コード
| 状態コード | 説明 | 
|---|---|
| 200 | OK | 
"Create or update IdP group connections" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
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."
    }
  ]
}List IdP groups for a team (Legacy)
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 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 Enterprise Cloud.
"List IdP groups for a team (Legacy)" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Members" organization permissions (write)
"List IdP groups for a team (Legacy)" のパラメーター
| 名前, Type, 説明 | 
|---|
| acceptstringSetting to  | 
| 名前, Type, 説明 | 
|---|
| team_idinteger 必須The unique identifier of the team. | 
"List IdP groups for a team (Legacy)" の HTTP 応答状態コード
| 状態コード | 説明 | 
|---|---|
| 200 | OK | 
| 403 | Forbidden | 
| 404 | Resource not found | 
"List IdP groups for a team (Legacy)" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
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-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)
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.
"Create or update IdP group connections (Legacy)" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Members" organization permissions (write)
"Create or update IdP group connections (Legacy)" のパラメーター
| 名前, Type, 説明 | 
|---|
| acceptstringSetting to  | 
| 名前, Type, 説明 | 
|---|
| team_idinteger 必須The unique identifier of the team. | 
| 名前, Type, 説明 | |||||||
|---|---|---|---|---|---|---|---|
| groupsarray of objects 必須The IdP groups you want to connect to a GitHub team. When updating, the new  | |||||||
| Properties of  | 
| 名前, Type, 説明 | 
|---|
| group_idstring 必須ID of the IdP group. | 
| group_namestring 必須Name of the IdP group. | 
| group_descriptionstring 必須Description of the IdP group. | 
| idstring | 
| namestring | 
| descriptionstring | 
synced_at string "Create or update IdP group connections (Legacy)" の HTTP 応答状態コード
| 状態コード | 説明 | 
|---|---|
| 200 | OK | 
| 403 | Forbidden | 
| 422 | Validation failed, or the endpoint has been spammed. | 
"Create or update IdP group connections (Legacy)" のコード サンプル
GHE.com で GitHub にアクセスする場合は、api.github.com を api.SUBDOMAIN.ghe.com にあるエンタープライズの専用サブドメインに置き換えます。
要求の例
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."
    }
  ]
}