ドキュメントには頻繁に更新が加えられ、その都度公開されています。本ページの翻訳はまだ未完成な部分があることをご了承ください。最新の情報については、英語のドキュメンテーションをご参照ください。本ページの翻訳に問題がある場合はこちらまでご連絡ください。

このバージョンの GitHub Enterprise はこの日付をもって終了となりました: 2020-11-12. 重大なセキュリティの問題に対してであっても、パッチリリースは作成されません。 パフォーマンスの向上、セキュリティの改善、新機能のためには、最新バージョンのGitHub Enterpriseにアップグレードしてください。 アップグレードに関する支援については、GitHub Enterprise supportに連絡してください。

Team

ここには以下の内容があります:

この API は、Team の Organization の、認証済みメンバーのみが利用できます。 OAuth のアクセストークンは、 read:org スコープを必要とします。 GitHub は、Team の name からTeam の slug を生成します。

List teams

Lists all teams in an organization that are visible to the authenticated user.

get /orgs/{org}/teams

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

org string path
per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/orgs/ORG/teams
JavaScript (@octokit/core.js)
await octokit.request('GET /orgs/{org}/teams', {
  org: 'org'
})

Default response

Status: 200 OK
[
  {
    "id": 1,
    "node_id": "MDQ6VGVhbTE=",
    "url": "https://api.github.com/teams/1",
    "html_url": "https://api.github.com/teams/justice-league",
    "name": "Justice League",
    "slug": "justice-league",
    "description": "A great team.",
    "privacy": "closed",
    "permission": "admin",
    "members_url": "https://api.github.com/teams/1/members{/member}",
    "repositories_url": "https://api.github.com/teams/1/repos",
    "parent": null
  }
]

Forbidden

Status: 403 Forbidden

Notes


Create a team

To create a team, the authenticated user must be a member or owner of {org}. By default, organization members can create teams. Organization owners can limit team creation to organization owners. For more information, see "Setting team creation permissions."

When you create a new team, you automatically become a team maintainer without explicitly adding yourself to the optional array of maintainers. For more information, see "About teams".

post /orgs/{org}/teams

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

org string path
name string body

Required. The name of the team.

description string body

The description of the team.

maintainers array of strings body

List GitHub IDs for organization members who will become team maintainers.

repo_names array of strings body

The full name (e.g., "organization-name/repository-name") of repositories to add the team to.

privacy string body

The level of privacy this team should have. The options are:
For a non-nested team:
* secret - only visible to organization owners and members of this team.
* closed - visible to all members of this organization.
Default: secret
For a parent or child team:
* closed - visible to all members of this organization.
Default for child team: closed

permission string body

Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of:
* pull - team members can pull, but not push to or administer newly-added repositories.
* push - team members can pull and push, but not administer newly-added repositories.
* admin - team members can pull, push and administer newly-added repositories.

Default: pull
parent_team_id integer body

The ID of a team to set as the parent team.

コードサンプル

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/orgs/ORG/teams \
  -d '{"name":"name"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /orgs/{org}/teams', {
  org: 'org',
  name: 'name'
})

Default response

Status: 201 Created
{
  "id": 1,
  "node_id": "MDQ6VGVhbTE=",
  "url": "https://api.github.com/teams/1",
  "html_url": "https://api.github.com/teams/justice-league",
  "name": "Justice League",
  "slug": "justice-league",
  "description": "A great team.",
  "privacy": "closed",
  "permission": "admin",
  "members_url": "https://api.github.com/teams/1/members{/member}",
  "repositories_url": "https://api.github.com/teams/1/repos",
  "members_count": 3,
  "repos_count": 10,
  "created_at": "2017-07-14T16:53:42Z",
  "updated_at": "2017-08-17T12:37:15Z",
  "organization": {
    "login": "github",
    "id": 1,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
    "url": "https://api.github.com/orgs/github",
    "repos_url": "https://api.github.com/orgs/github/repos",
    "events_url": "https://api.github.com/orgs/github/events",
    "hooks_url": "https://api.github.com/orgs/github/hooks",
    "issues_url": "https://api.github.com/orgs/github/issues",
    "members_url": "https://api.github.com/orgs/github/members{/member}",
    "public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "description": "A great organization",
    "name": "github",
    "company": "GitHub",
    "blog": "https://github.com/blog",
    "location": "San Francisco",
    "email": "octocat@github.com",
    "has_organization_projects": true,
    "has_repository_projects": true,
    "public_repos": 2,
    "public_gists": 1,
    "followers": 20,
    "following": 0,
    "html_url": "https://github.com/octocat",
    "created_at": "2008-01-14T04:33:35Z",
    "updated_at": "2017-08-17T12:37:15Z",
    "type": "Organization"
  },
  "ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"
}

Forbidden

Status: 403 Forbidden

Validation failed

Status: 422 Unprocessable Entity

Notes


Get a team by name

Gets a team using the team's slug. GitHub Enterprise Server generates the slug from the team name.

Note: You can also specify a team by org_id and team_id using the route GET /organizations/{org_id}/team/{team_id}.

get /orgs/{org}/teams/{team_slug}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

org string path
team_slug string path

team_slug parameter

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/orgs/ORG/teams/TEAM_SLUG
JavaScript (@octokit/core.js)
await octokit.request('GET /orgs/{org}/teams/{team_slug}', {
  org: 'org',
  team_slug: 'team_slug'
})

Default response

Status: 200 OK
{
  "id": 1,
  "node_id": "MDQ6VGVhbTE=",
  "url": "https://api.github.com/teams/1",
  "html_url": "https://api.github.com/teams/justice-league",
  "name": "Justice League",
  "slug": "justice-league",
  "description": "A great team.",
  "privacy": "closed",
  "permission": "admin",
  "members_url": "https://api.github.com/teams/1/members{/member}",
  "repositories_url": "https://api.github.com/teams/1/repos",
  "members_count": 3,
  "repos_count": 10,
  "created_at": "2017-07-14T16:53:42Z",
  "updated_at": "2017-08-17T12:37:15Z",
  "organization": {
    "login": "github",
    "id": 1,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
    "url": "https://api.github.com/orgs/github",
    "repos_url": "https://api.github.com/orgs/github/repos",
    "events_url": "https://api.github.com/orgs/github/events",
    "hooks_url": "https://api.github.com/orgs/github/hooks",
    "issues_url": "https://api.github.com/orgs/github/issues",
    "members_url": "https://api.github.com/orgs/github/members{/member}",
    "public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "description": "A great organization",
    "name": "github",
    "company": "GitHub",
    "blog": "https://github.com/blog",
    "location": "San Francisco",
    "email": "octocat@github.com",
    "has_organization_projects": true,
    "has_repository_projects": true,
    "public_repos": 2,
    "public_gists": 1,
    "followers": 20,
    "following": 0,
    "html_url": "https://github.com/octocat",
    "created_at": "2008-01-14T04:33:35Z",
    "updated_at": "2017-08-17T12:37:15Z",
    "type": "Organization"
  },
  "ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"
}

Resource not found

Status: 404 Not Found

Notes


get /teams/{team_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}', {
  team_id: 42
})

Default response

Status: 200 OK
{
  "id": 1,
  "node_id": "MDQ6VGVhbTE=",
  "url": "https://api.github.com/teams/1",
  "html_url": "https://api.github.com/teams/justice-league",
  "name": "Justice League",
  "slug": "justice-league",
  "description": "A great team.",
  "privacy": "closed",
  "permission": "admin",
  "members_url": "https://api.github.com/teams/1/members{/member}",
  "repositories_url": "https://api.github.com/teams/1/repos",
  "members_count": 3,
  "repos_count": 10,
  "created_at": "2017-07-14T16:53:42Z",
  "updated_at": "2017-08-17T12:37:15Z",
  "organization": {
    "login": "github",
    "id": 1,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
    "url": "https://api.github.com/orgs/github",
    "repos_url": "https://api.github.com/orgs/github/repos",
    "events_url": "https://api.github.com/orgs/github/events",
    "hooks_url": "https://api.github.com/orgs/github/hooks",
    "issues_url": "https://api.github.com/orgs/github/issues",
    "members_url": "https://api.github.com/orgs/github/members{/member}",
    "public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "description": "A great organization",
    "name": "github",
    "company": "GitHub",
    "blog": "https://github.com/blog",
    "location": "San Francisco",
    "email": "octocat@github.com",
    "has_organization_projects": true,
    "has_repository_projects": true,
    "public_repos": 2,
    "public_gists": 1,
    "followers": 20,
    "following": 0,
    "html_url": "https://github.com/octocat",
    "created_at": "2008-01-14T04:33:35Z",
    "updated_at": "2017-08-17T12:37:15Z",
    "type": "Organization"
  },
  "ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"
}

Notes

プレビュー通知

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

Update a team

To edit a team, the authenticated user must either be an organization owner or a team maintainer.

Note: With nested teams, the privacy for parent teams cannot be secret.

patch /teams/{team_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
name string body

Required. The name of the team.

description string body

The description of the team.

privacy string body

The level of privacy this team should have. Editing teams without specifying this parameter leaves privacy intact. The options are:
For a non-nested team:
* secret - only visible to organization owners and members of this team.
* closed - visible to all members of this organization.
For a parent or child team:
* closed - visible to all members of this organization.

permission string body

Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of:
* pull - team members can pull, but not push to or administer newly-added repositories.
* push - team members can pull and push, but not administer newly-added repositories.
* admin - team members can pull, push and administer newly-added repositories.

Default: pull
parent_team_id integer body

The ID of a team to set as the parent team. Note: You must pass the hellcat-preview media type to use this parameter.

コードサンプル

Shell
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42 \
  -d '{"name":"name"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /teams/{team_id}', {
  team_id: 42,
  name: 'name'
})

Default response

Status: 201 Created
{
  "id": 1,
  "node_id": "MDQ6VGVhbTE=",
  "url": "https://api.github.com/teams/1",
  "html_url": "https://api.github.com/teams/justice-league",
  "name": "Justice League",
  "slug": "justice-league",
  "description": "A great team.",
  "privacy": "closed",
  "permission": "admin",
  "members_url": "https://api.github.com/teams/1/members{/member}",
  "repositories_url": "https://api.github.com/teams/1/repos",
  "members_count": 3,
  "repos_count": 10,
  "created_at": "2017-07-14T16:53:42Z",
  "updated_at": "2017-08-17T12:37:15Z",
  "organization": {
    "login": "github",
    "id": 1,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
    "url": "https://api.github.com/orgs/github",
    "repos_url": "https://api.github.com/orgs/github/repos",
    "events_url": "https://api.github.com/orgs/github/events",
    "hooks_url": "https://api.github.com/orgs/github/hooks",
    "issues_url": "https://api.github.com/orgs/github/issues",
    "members_url": "https://api.github.com/orgs/github/members{/member}",
    "public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "description": "A great organization",
    "name": "github",
    "company": "GitHub",
    "blog": "https://github.com/blog",
    "location": "San Francisco",
    "email": "octocat@github.com",
    "has_organization_projects": true,
    "has_repository_projects": true,
    "public_repos": 2,
    "public_gists": 1,
    "followers": 20,
    "following": 0,
    "html_url": "https://github.com/octocat",
    "created_at": "2008-01-14T04:33:35Z",
    "updated_at": "2017-08-17T12:37:15Z",
    "type": "Organization"
  },
  "ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"
}

Notes

プレビュー通知

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

Delete a team

To delete a team, the authenticated user must be an organization owner or team maintainer.

If you are an organization owner and you pass the hellcat-preview media type, deleting a parent team will delete all of its child teams as well.

delete /teams/{team_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /teams/{team_id}', {
  team_id: 42
})

Default Response

Status: 204 No Content

Notes

プレビュー通知

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

List team projects

Lists the organization projects for a team. If you are an authenticated site administrator for your Enterprise instance, you will be able to list all projects for the team. If you pass the hellcat-preview media type, the response will include projects inherited from a parent team.

get /teams/{team_id}/projects

パラメータ

Name Type In Description
accept string header

This API is under preview and subject to change. プレビューの通知を見る

accept string header

This API is under preview and subject to change.

team_id integer path
per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.inertia-preview+json" \
  https://api.github.com/teams/42/projects
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/projects', {
  team_id: 42,
  mediaType: {
    previews: [
      'inertia'
    ]
  }
})

Default response

Status: 200 OK
[
  {
    "owner_url": "https://api.github.com/orgs/octocat",
    "url": "https://api.github.com/projects/1002605",
    "html_url": "https://github.com/orgs/api-playground/projects/1",
    "columns_url": "https://api.github.com/projects/1002605/columns",
    "id": 1002605,
    "node_id": "MDc6UHJvamVjdDEwMDI2MDU=",
    "name": "Organization Roadmap",
    "body": "High-level roadmap for the upcoming year.",
    "number": 1,
    "state": "open",
    "creator": {
      "login": "octocat",
      "id": 1,
      "node_id": "MDQ6VXNlcjE=",
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "",
      "url": "https://api.github.com/users/octocat",
      "html_url": "https://github.com/octocat",
      "followers_url": "https://api.github.com/users/octocat/followers",
      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
      "organizations_url": "https://api.github.com/users/octocat/orgs",
      "repos_url": "https://api.github.com/users/octocat/repos",
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
      "received_events_url": "https://api.github.com/users/octocat/received_events",
      "type": "User",
      "site_admin": false
    },
    "created_at": "2011-04-11T20:09:31Z",
    "updated_at": "2014-03-04T18:58:10Z",
    "organization_permission": "write",
    "private": false,
    "permissions": {
      "read": true,
      "write": true,
      "admin": false
    }
  }
]

Notes

プレビュー通知

The Projects API is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access the API during the preview period, you must provide a custom media type in the Accept header:

application/vnd.github.inertia-preview+json
☝️ このヘッダは必須です.

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

Check team permissions for a project

Checks whether a team has read, write, or admin permissions for an organization project. If you pass the hellcat-preview media type, the response will include projects inherited from a parent team.

get /teams/{team_id}/projects/{project_id}

パラメータ

Name Type In Description
accept string header

This API is under preview and subject to change. プレビューの通知を見る

accept string header

This API is under preview and subject to change.

team_id integer path
project_id integer path

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.inertia-preview+json" \
  https://api.github.com/teams/42/projects/42
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/projects/{project_id}', {
  team_id: 42,
  project_id: 42,
  mediaType: {
    previews: [
      'inertia'
    ]
  }
})

Default response

Status: 200 OK
{
  "owner_url": "https://api.github.com/orgs/octocat",
  "url": "https://api.github.com/projects/1002605",
  "html_url": "https://github.com/orgs/api-playground/projects/1",
  "columns_url": "https://api.github.com/projects/1002605/columns",
  "id": 1002605,
  "node_id": "MDc6UHJvamVjdDEwMDI2MDU=",
  "name": "Organization Roadmap",
  "body": "High-level roadmap for the upcoming year.",
  "number": 1,
  "state": "open",
  "creator": {
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "site_admin": false
  },
  "created_at": "2011-04-11T20:09:31Z",
  "updated_at": "2014-03-04T18:58:10Z",
  "organization_permission": "write",
  "private": false,
  "permissions": {
    "read": true,
    "write": true,
    "admin": false
  }
}

Response if project is not managed by this team

Status: 404 Not Found

Notes

プレビュー通知

The Projects API is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access the API during the preview period, you must provide a custom media type in the Accept header:

application/vnd.github.inertia-preview+json
☝️ このヘッダは必須です.

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

Add or update team project permissions

Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have admin permissions for the project. The project and team must be part of the same organization.

put /teams/{team_id}/projects/{project_id}

パラメータ

Name Type In Description
accept string header

This API is under preview and subject to change. プレビューの通知を見る

accept string header

This API is under preview and subject to change.

team_id integer path
project_id integer path
permission string body

The permission to grant to the team for this project. Can be one of:
* read - team members can read, but not write to or administer this project.
* write - team members can read and write, but not administer this project.
* admin - team members can read, write and administer this project.
Default: the team's permission attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
Note: If you pass the hellcat-preview media type, you can promote—but not demote—a permission attribute inherited from a parent team.

コードサンプル

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.inertia-preview+json" \
  https://api.github.com/teams/42/projects/42 \
  -d '{"permission":"permission"}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /teams/{team_id}/projects/{project_id}', {
  team_id: 42,
  project_id: 42,
  permission: 'permission',
  mediaType: {
    previews: [
      'inertia'
    ]
  }
})

Default Response

Status: 204 No Content

Response if the project is not owned by the organization

Status: 403 Forbidden
{
  "message": "Must have admin rights to Repository.",
  "documentation_url": "https://docs.github.com/enterprise-server@2.19/rest/reference/teams#add-or-update-team-project-permissions"
}

Notes

プレビュー通知

The Projects API is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access the API during the preview period, you must provide a custom media type in the Accept header:

application/vnd.github.inertia-preview+json
☝️ このヘッダは必須です.

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

Remove a project from a team

Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have read access to both the team and project, or admin access to the team or project. Note: This endpoint removes the project from the team, but does not delete it.

delete /teams/{team_id}/projects/{project_id}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

team_id integer path
project_id integer path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/projects/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /teams/{team_id}/projects/{project_id}', {
  team_id: 42,
  project_id: 42
})

Default Response

Status: 204 No Content

Notes


List team repositories

Note: If you pass the hellcat-preview media type, the response will include any repositories inherited through a parent team.

If you are an authenticated site administrator for your Enterprise instance, you will be able to list all repositories for the team.

get /teams/{team_id}/repos

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/repos
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/repos', {
  team_id: 42
})

Default response

Status: 200 OK
[
  {
    "id": 1296269,
    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
    "name": "Hello-World",
    "full_name": "octocat/Hello-World",
    "owner": {
      "login": "octocat",
      "id": 1,
      "node_id": "MDQ6VXNlcjE=",
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "",
      "url": "https://api.github.com/users/octocat",
      "html_url": "https://github.com/octocat",
      "followers_url": "https://api.github.com/users/octocat/followers",
      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
      "organizations_url": "https://api.github.com/users/octocat/orgs",
      "repos_url": "https://api.github.com/users/octocat/repos",
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
      "received_events_url": "https://api.github.com/users/octocat/received_events",
      "type": "User",
      "site_admin": false
    },
    "private": false,
    "html_url": "https://github.com/octocat/Hello-World",
    "description": "This your first repo!",
    "fork": false,
    "url": "https://api.github.com/repos/octocat/Hello-World",
    "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
    "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
    "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
    "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
    "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
    "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
    "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
    "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
    "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
    "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
    "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
    "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
    "events_url": "https://api.github.com/repos/octocat/Hello-World/events",
    "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
    "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
    "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
    "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
    "git_url": "git:github.com/octocat/Hello-World.git",
    "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
    "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
    "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
    "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
    "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
    "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
    "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
    "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
    "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
    "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
    "ssh_url": "git@github.com:octocat/Hello-World.git",
    "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
    "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
    "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
    "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
    "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
    "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
    "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
    "clone_url": "https://github.com/octocat/Hello-World.git",
    "mirror_url": "git:git.example.com/octocat/Hello-World",
    "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks",
    "svn_url": "https://svn.github.com/octocat/Hello-World",
    "homepage": "https://github.com",
    "language": null,
    "forks_count": 9,
    "stargazers_count": 80,
    "watchers_count": 80,
    "size": 108,
    "default_branch": "master",
    "open_issues_count": 0,
    "is_template": true,
    "topics": [
      "octocat",
      "atom",
      "electron",
      "api"
    ],
    "has_issues": true,
    "has_projects": true,
    "has_wiki": true,
    "has_pages": false,
    "has_downloads": true,
    "archived": false,
    "disabled": false,
    "pushed_at": "2011-01-26T19:06:43Z",
    "created_at": "2011-01-26T19:01:12Z",
    "updated_at": "2011-01-26T19:14:43Z",
    "permissions": {
      "admin": false,
      "push": false,
      "pull": true
    },
    "template_repository": null,
    "subscribers_count": 42,
    "network_count": 0,
    "anonymous_access_enabled": false,
    "license": {
      "key": "mit",
      "name": "MIT License",
      "spdx_id": "MIT",
      "url": "https://api.github.com/licenses/mit",
      "node_id": "MDc6TGljZW5zZW1pdA=="
    }
  }
]

Notes

プレビュー通知

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

Check team permissions for a repository

Note: If you pass the hellcat-preview media type, repositories inherited through a parent team will be checked.

You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom media type via the Accept header:

get /teams/{team_id}/repos/{owner}/{repo}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
owner string path
repo string path

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/repos/octocat/hello-world
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/repos/{owner}/{repo}', {
  team_id: 42,
  owner: 'octocat',
  repo: 'hello-world'
})

Alternative response with extra repository information

Status: 200 OK

Response if repository is managed by this team

Status: 204 No Content

Response if repository is not managed by this team

Status: 404 Not Found

Notes

プレビュー通知

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

Add or update team repository permissions

To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a 422 Unprocessable Entity status if you attempt to add a repository to a team that is not owned by the organization.

Note that, if you choose not to pass any parameters, you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."

put /teams/{team_id}/repos/{owner}/{repo}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
owner string path
repo string path
permission string body

The permission to grant the team on this repository. Can be one of:
* pull - team members can pull, but not push to or administer this repository.
* push - team members can pull and push, but not administer this repository.
* admin - team members can pull, push and administer this repository.

If no permission is specified, the team's permission attribute will be used to determine what permission to grant the team on this repository.
Note: If you pass the hellcat-preview media type, you can promote—but not demote—a permission attribute inherited through a parent team.

コードサンプル

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/repos/octocat/hello-world \
  -d '{"permission":"permission"}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /teams/{team_id}/repos/{owner}/{repo}', {
  team_id: 42,
  owner: 'octocat',
  repo: 'hello-world',
  permission: 'permission'
})

Default Response

Status: 204 No Content

Notes

プレビュー通知

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

Remove a repository from a team

If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. NOTE: This does not delete the repository, it just removes it from the team.

delete /teams/{team_id}/repos/{owner}/{repo}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

team_id integer path
owner string path
repo string path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/repos/octocat/hello-world
JavaScript (@octokit/core.js)
await octokit.request('DELETE /teams/{team_id}/repos/{owner}/{repo}', {
  team_id: 42,
  owner: 'octocat',
  repo: 'hello-world'
})

Default Response

Status: 204 No Content

Notes


List child teams

You must use the hellcat-preview media type to use this endpoint.

get /teams/{team_id}/teams

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/teams
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/teams', {
  team_id: 42
})

Response if child teams exist

Status: 200 OK
[
  {
    "id": 2,
    "node_id": "MDQ6VGVhbTI=",
    "url": "https://api.github.com/teams/2",
    "name": "Original Roster",
    "slug": "original-roster",
    "description": "Started it all.",
    "privacy": "closed",
    "permission": "admin",
    "members_url": "https://api.github.com/teams/2/members{/member}",
    "repositories_url": "https://api.github.com/teams/2/repos",
    "parent": {
      "id": 1,
      "node_id": "MDQ6VGVhbTE=",
      "url": "https://api.github.com/teams/1",
      "html_url": "https://api.github.com/teams/justice-league",
      "name": "Justice League",
      "slug": "justice-league",
      "description": "A great team.",
      "privacy": "closed",
      "permission": "admin",
      "members_url": "https://api.github.com/teams/1/members{/member}",
      "repositories_url": "https://api.github.com/teams/1/repos"
    },
    "html_url": "https://github.com/orgs/rails/teams/core"
  }
]

Notes

プレビュー通知

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

List teams for the authenticated user

List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user, repo, or read:org scope when authenticating via OAuth.

get /user/teams

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/user/teams
JavaScript (@octokit/core.js)
await octokit.request('GET /user/teams')

Default response

Status: 200 OK
[
  {
    "id": 1,
    "node_id": "MDQ6VGVhbTE=",
    "url": "https://api.github.com/teams/1",
    "html_url": "https://api.github.com/teams/justice-league",
    "name": "Justice League",
    "slug": "justice-league",
    "description": "A great team.",
    "privacy": "closed",
    "permission": "admin",
    "members_url": "https://api.github.com/teams/1/members{/member}",
    "repositories_url": "https://api.github.com/teams/1/repos",
    "parent": null,
    "members_count": 3,
    "repos_count": 10,
    "created_at": "2017-07-14T16:53:42Z",
    "updated_at": "2017-08-17T12:37:15Z",
    "organization": {
      "login": "github",
      "id": 1,
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
      "url": "https://api.github.com/orgs/github",
      "repos_url": "https://api.github.com/orgs/github/repos",
      "events_url": "https://api.github.com/orgs/github/events",
      "hooks_url": "https://api.github.com/orgs/github/hooks",
      "issues_url": "https://api.github.com/orgs/github/issues",
      "members_url": "https://api.github.com/orgs/github/members{/member}",
      "public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "description": "A great organization",
      "name": "github",
      "company": "GitHub",
      "blog": "https://github.com/blog",
      "location": "San Francisco",
      "email": "octocat@github.com",
      "has_organization_projects": true,
      "has_repository_projects": true,
      "public_repos": 2,
      "public_gists": 1,
      "followers": 20,
      "following": 0,
      "html_url": "https://github.com/octocat",
      "created_at": "2008-01-14T04:33:35Z",
      "type": "Organization"
    },
    "ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"
  }
]

Not modified

Status: 304 Not Modified

Forbidden

Status: 403 Forbidden

Resource not found

Status: 404 Not Found

ディスカッション

Team ディスカッション API を使用すると、Team のページに投稿されたディスカッションを取得、作成、編集、削除できます。 Team のディスカッションは、リポジトリやプロジェクトに原生されない会話をするために利用できます。 Team の Organization に属する全メンバーが、公開のディスカッション投稿を作成や表示できます。 The team discussions API allows you to get, create, edit, and delete discussion posts on a team's page. You can use team discussions to have conversations that are not specific to a repository or project. この API は、Team の Organization の、認証済みメンバーのみが利用できます。

List discussions

List all discussions on a team's page. OAuth access tokens require the read:discussion scope.

get /teams/{team_id}/discussions

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
direction string query

Sorts the discussion comments by the date they were created. To return the oldest comments first, set to asc. Can be one of asc or desc.

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/discussions', {
  team_id: 42
})

Default response

Status: 200 OK
[
  {
    "author": {
      "login": "octocat",
      "id": 1,
      "node_id": "MDQ6VXNlcjE=",
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "",
      "url": "https://api.github.com/users/octocat",
      "html_url": "https://github.com/octocat",
      "followers_url": "https://api.github.com/users/octocat/followers",
      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
      "organizations_url": "https://api.github.com/users/octocat/orgs",
      "repos_url": "https://api.github.com/users/octocat/repos",
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
      "received_events_url": "https://api.github.com/users/octocat/received_events",
      "type": "User",
      "site_admin": false
    },
    "body": "Hi! This is an area for us to collaborate as a team.",
    "body_html": "<p>Hi! This is an area for us to collaborate as a team</p>",
    "body_version": "0d495416a700fb06133c612575d92bfb",
    "comments_count": 0,
    "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments",
    "created_at": "2018-01-25T18:56:31Z",
    "last_edited_at": null,
    "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1",
    "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==",
    "number": 1,
    "pinned": false,
    "private": false,
    "team_url": "https://api.github.com/teams/2343027",
    "title": "Our first team post",
    "updated_at": "2018-01-25T18:56:31Z",
    "url": "https://api.github.com/teams/2343027/discussions/1",
    "reactions": {
      "url": "https://api.github.com/teams/2343027/discussions/1/reactions",
      "total_count": 5,
      "+1": 3,
      "-1": 1,
      "laugh": 0,
      "confused": 0,
      "heart": 1,
      "hooray": 0,
      "eyes": 1,
      "rocket": 1
    }
  }
]

Notes

プレビュー通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


Create a discussion

Creates a new discussion post on a team's page. OAuth access tokens require the write:discussion scope.

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" for details.

post /teams/{team_id}/discussions

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
title string body

Required. The discussion post's title.

body string body

Required. The discussion post's body text.

private boolean body

Private posts are only visible to team members, organization owners, and team maintainers. Public posts are visible to all members of the organization. Set to true to create a private post.

コードサンプル

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions \
  -d '{"title":"title","body":"body"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /teams/{team_id}/discussions', {
  team_id: 42,
  title: 'title',
  body: 'body'
})

Default response

Status: 201 Created
{
  "author": {
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "site_admin": false
  },
  "body": "Hi! This is an area for us to collaborate as a team.",
  "body_html": "<p>Hi! This is an area for us to collaborate as a team</p>",
  "body_version": "0d495416a700fb06133c612575d92bfb",
  "comments_count": 0,
  "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments",
  "created_at": "2018-01-25T18:56:31Z",
  "last_edited_at": null,
  "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1",
  "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==",
  "number": 1,
  "pinned": false,
  "private": false,
  "team_url": "https://api.github.com/teams/2343027",
  "title": "Our first team post",
  "updated_at": "2018-01-25T18:56:31Z",
  "url": "https://api.github.com/teams/2343027/discussions/1",
  "reactions": {
    "url": "https://api.github.com/teams/2343027/discussions/1/reactions",
    "total_count": 5,
    "+1": 3,
    "-1": 1,
    "laugh": 0,
    "confused": 0,
    "heart": 1,
    "hooray": 0,
    "eyes": 1,
    "rocket": 1
  }
}

Notes

プレビュー通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


Get a discussion

Get a specific discussion on a team's page. OAuth access tokens require the read:discussion scope.

get /teams/{team_id}/discussions/{discussion_number}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
discussion_number integer path

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}', {
  team_id: 42,
  discussion_number: 42
})

Default response

Status: 200 OK
{
  "author": {
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "site_admin": false
  },
  "body": "Hi! This is an area for us to collaborate as a team.",
  "body_html": "<p>Hi! This is an area for us to collaborate as a team</p>",
  "body_version": "0d495416a700fb06133c612575d92bfb",
  "comments_count": 0,
  "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments",
  "created_at": "2018-01-25T18:56:31Z",
  "last_edited_at": null,
  "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1",
  "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==",
  "number": 1,
  "pinned": false,
  "private": false,
  "team_url": "https://api.github.com/teams/2343027",
  "title": "Our first team post",
  "updated_at": "2018-01-25T18:56:31Z",
  "url": "https://api.github.com/teams/2343027/discussions/1",
  "reactions": {
    "url": "https://api.github.com/teams/2343027/discussions/1/reactions",
    "total_count": 5,
    "+1": 3,
    "-1": 1,
    "laugh": 0,
    "confused": 0,
    "heart": 1,
    "hooray": 0,
    "eyes": 1,
    "rocket": 1
  }
}

Notes

プレビュー通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


Update a discussion

Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the write:discussion scope.

patch /teams/{team_id}/discussions/{discussion_number}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
discussion_number integer path
title string body

The discussion post's title.

body string body

The discussion post's body text.

コードサンプル

Shell
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42 \
  -d '{"title":"title"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /teams/{team_id}/discussions/{discussion_number}', {
  team_id: 42,
  discussion_number: 42,
  title: 'title'
})

Default response

Status: 200 OK
{
  "author": {
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "site_admin": false
  },
  "body": "Hi! This is an area for us to collaborate as a team.",
  "body_html": "<p>Hi! This is an area for us to collaborate as a team</p>",
  "body_version": "0d495416a700fb06133c612575d92bfb",
  "comments_count": 1,
  "comments_url": "https://api.github.com/teams/2343027/discussions/1/comments",
  "created_at": "2018-01-25T18:56:31Z",
  "last_edited_at": "2018-01-26T18:22:20Z",
  "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1",
  "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMQ==",
  "number": 1,
  "pinned": false,
  "private": false,
  "team_url": "https://api.github.com/teams/2343027",
  "title": "Welcome to our first team post",
  "updated_at": "2018-01-26T18:22:20Z",
  "url": "https://api.github.com/teams/2343027/discussions/1",
  "reactions": {
    "url": "https://api.github.com/teams/2343027/discussions/1/reactions",
    "total_count": 5,
    "+1": 3,
    "-1": 1,
    "laugh": 0,
    "confused": 0,
    "heart": 1,
    "hooray": 0,
    "eyes": 1,
    "rocket": 1
  }
}

Notes

プレビュー通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


Delete a discussion

Delete a discussion from a team's page. OAuth access tokens require the write:discussion scope.

delete /teams/{team_id}/discussions/{discussion_number}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

team_id integer path
discussion_number integer path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /teams/{team_id}/discussions/{discussion_number}', {
  team_id: 42,
  discussion_number: 42
})

Default Response

Status: 204 No Content

Notes


ディスカッションコメント

Team ディスカッションコメント API を使用すると、Team ディスカッション投稿のコメントを取得、作成、編集、削除できます。 Team の Organization に属する全メンバーが、公開のディスカッションについたコメントを作成や表示できます。 The team discussions API allows you to get, create, edit, and delete discussion posts on a team's page. この API は、Team の Organization の、認証済みメンバーのみが利用できます。

List discussion comments

List all comments on a team discussion. OAuth access tokens require the read:discussion scope.

get /teams/{team_id}/discussions/{discussion_number}/comments

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
discussion_number integer path
direction string query

Sorts the discussion comments by the date they were created. To return the oldest comments first, set to asc. Can be one of asc or desc.

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42/comments
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/comments', {
  team_id: 42,
  discussion_number: 42
})

Default response

Status: 200 OK
[
  {
    "author": {
      "login": "octocat",
      "id": 1,
      "node_id": "MDQ6VXNlcjE=",
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "",
      "url": "https://api.github.com/users/octocat",
      "html_url": "https://github.com/octocat",
      "followers_url": "https://api.github.com/users/octocat/followers",
      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
      "organizations_url": "https://api.github.com/users/octocat/orgs",
      "repos_url": "https://api.github.com/users/octocat/repos",
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
      "received_events_url": "https://api.github.com/users/octocat/received_events",
      "type": "User",
      "site_admin": false
    },
    "body": "Do you like apples?",
    "body_html": "<p>Do you like apples?</p>",
    "body_version": "5eb32b219cdc6a5a9b29ba5d6caa9c51",
    "created_at": "2018-01-15T23:53:58Z",
    "last_edited_at": null,
    "discussion_url": "https://api.github.com/teams/2403582/discussions/1",
    "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1",
    "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=",
    "number": 1,
    "updated_at": "2018-01-15T23:53:58Z",
    "url": "https://api.github.com/teams/2403582/discussions/1/comments/1",
    "reactions": {
      "url": "https://api.github.com/teams/2403582/discussions/1/reactions",
      "total_count": 5,
      "+1": 3,
      "-1": 1,
      "laugh": 0,
      "confused": 0,
      "heart": 1,
      "hooray": 0,
      "eyes": 1,
      "rocket": 1
    }
  }
]

Notes

プレビュー通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


Create a discussion comment

Creates a new comment on a team discussion. OAuth access tokens require the write:discussion scope.

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" for details.

post /teams/{team_id}/discussions/{discussion_number}/comments

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
discussion_number integer path
body string body

Required. The discussion comment's body text.

コードサンプル

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42/comments \
  -d '{"body":"body"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/comments', {
  team_id: 42,
  discussion_number: 42,
  body: 'body'
})

Default response

Status: 201 Created
{
  "author": {
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "site_admin": false
  },
  "body": "Do you like apples?",
  "body_html": "<p>Do you like apples?</p>",
  "body_version": "5eb32b219cdc6a5a9b29ba5d6caa9c51",
  "created_at": "2018-01-15T23:53:58Z",
  "last_edited_at": null,
  "discussion_url": "https://api.github.com/teams/2403582/discussions/1",
  "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1",
  "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=",
  "number": 1,
  "updated_at": "2018-01-15T23:53:58Z",
  "url": "https://api.github.com/teams/2403582/discussions/1/comments/1",
  "reactions": {
    "url": "https://api.github.com/teams/2403582/discussions/1/reactions",
    "total_count": 5,
    "+1": 3,
    "-1": 1,
    "laugh": 0,
    "confused": 0,
    "heart": 1,
    "hooray": 0,
    "eyes": 1,
    "rocket": 1
  }
}

Notes

プレビュー通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


Get a discussion comment

Get a specific comment on a team discussion. OAuth access tokens require the read:discussion scope.

get /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
discussion_number integer path
comment_number integer path

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42/comments/42
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}', {
  team_id: 42,
  discussion_number: 42,
  comment_number: 42
})

Default response

Status: 200 OK
{
  "author": {
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "site_admin": false
  },
  "body": "Do you like apples?",
  "body_html": "<p>Do you like apples?</p>",
  "body_version": "5eb32b219cdc6a5a9b29ba5d6caa9c51",
  "created_at": "2018-01-15T23:53:58Z",
  "last_edited_at": null,
  "discussion_url": "https://api.github.com/teams/2403582/discussions/1",
  "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1",
  "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=",
  "number": 1,
  "updated_at": "2018-01-15T23:53:58Z",
  "url": "https://api.github.com/teams/2403582/discussions/1/comments/1",
  "reactions": {
    "url": "https://api.github.com/teams/2403582/discussions/1/reactions",
    "total_count": 5,
    "+1": 3,
    "-1": 1,
    "laugh": 0,
    "confused": 0,
    "heart": 1,
    "hooray": 0,
    "eyes": 1,
    "rocket": 1
  }
}

Notes

プレビュー通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


Update a discussion comment

Edits the body text of a discussion comment. OAuth access tokens require the write:discussion scope.

patch /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
discussion_number integer path
comment_number integer path
body string body

Required. The discussion comment's body text.

コードサンプル

Shell
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42/comments/42 \
  -d '{"body":"body"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}', {
  team_id: 42,
  discussion_number: 42,
  comment_number: 42,
  body: 'body'
})

Default response

Status: 200 OK
{
  "author": {
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "site_admin": false
  },
  "body": "Do you like pineapples?",
  "body_html": "<p>Do you like pineapples?</p>",
  "body_version": "e6907b24d9c93cc0c5024a7af5888116",
  "created_at": "2018-01-15T23:53:58Z",
  "last_edited_at": "2018-01-26T18:22:20Z",
  "discussion_url": "https://api.github.com/teams/2403582/discussions/1",
  "html_url": "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1",
  "node_id": "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=",
  "number": 1,
  "updated_at": "2018-01-26T18:22:20Z",
  "url": "https://api.github.com/teams/2403582/discussions/1/comments/1",
  "reactions": {
    "url": "https://api.github.com/teams/2403582/discussions/1/reactions",
    "total_count": 5,
    "+1": 3,
    "-1": 1,
    "laugh": 0,
    "confused": 0,
    "heart": 1,
    "hooray": 0,
    "eyes": 1,
    "rocket": 1
  }
}

Notes

プレビュー通知

An additional reactions object in the issue comment payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.

To access the API you must provide a custom media type in the Accept header:

application/vnd.github.squirrel-girl-preview

The reactions key will have the following payload where url can be used to construct the API location for listing and creating reactions.


Delete a discussion comment

Deletes a comment on a team discussion. OAuth access tokens require the write:discussion scope.

delete /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

team_id integer path
discussion_number integer path
comment_number integer path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/discussions/42/comments/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}', {
  team_id: 42,
  discussion_number: 42,
  comment_number: 42
})

Default Response

Status: 204 No Content

Notes


メンバー

この API は、Team の Organization の、認証済みメンバーのみが利用できます。 OAuth のアクセストークンは、 read:org スコープを必要とします。

ノート: Organizationのアイデンティティプロバイダ(Idp)でTeamに同期をセットアップしている場合、Teamのメンバーシップを変更するためのこのAPIを使おうとすると、エラーが返されます。 グループのメンバーシップを管理するためにIdpにアクセスできるなら、GitHubのTeamメンバーシップをアイデンティティプロバイダを通じて管理できます。そうすれば、Organizationで自動的にTeamメンバーの追加や削除が行われます。 詳しい情報については「アイデンティティプロバイダとGitHub間でのTeamの同期」を参照してください。

List team members

If you pass the hellcat-preview media type, team members will include the members of child teams.

To list members in a team, the team must be visible to the authenticated user.

get /teams/{team_id}/members

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
role string query

Filters members returned by their role in the team. Can be one of:
* member - normal members of the team.
* maintainer - team maintainers.
* all - all members of the team.

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/members
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/members', {
  team_id: 42
})

Default response

Status: 200 OK
[
  {
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "site_admin": false
  }
]

Notes

プレビュー通知

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

Get team member (Legacy)

The "Get team member" endpoint (described below) is deprecated.

We recommend using the Get team membership for a user endpoint instead. It allows you to get both active and pending memberships.

To list members in a team, the team must be visible to the authenticated user.

get /teams/{team_id}/members/{username}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

team_id integer path
username string path

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/members/USERNAME
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/members/{username}', {
  team_id: 42,
  username: 'username'
})

Response if user is a member

Status: 204 No Content

Response if user is not a member

Status: 404 Not Found

Notes


Add team member (Legacy)

The "Add team member" endpoint (described below) is deprecated.

We recommend using the Add or update team membership for a user endpoint instead. It allows you to invite new organization members to your teams.

Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.

To add someone to a team, the authenticated user must be an organization owner or a team maintainer in the team they're changing. The person being added to the team must be a member of the team's organization.

Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub Enterprise Server team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub Enterprise Server."

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."

put /teams/{team_id}/members/{username}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

team_id integer path
username string path

コードサンプル

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/members/USERNAME
JavaScript (@octokit/core.js)
await octokit.request('PUT /teams/{team_id}/members/{username}', {
  team_id: 42,
  username: 'username'
})

Default Response

Status: 204 No Content

Forbidden

Status: 403 Forbidden

Response if team synchronization is set up

Status: 404 Not Found

Response if you attempt to add an organization to a team

Status: 422 Unprocessable Entity
{
  "message": "Cannot add an organization as a member.",
  "errors": [
    {
      "code": "org",
      "field": "user",
      "resource": "TeamMember"
    }
  ]
}

Response if you attempt to add a user to a team when they are not a member of at least one other team in the same organization

Status: 422 Unprocessable Entity
{
  "message": "User isn't a member of this organization. Please invite them first.",
  "errors": [
    {
      "code": "unaffiliated",
      "field": "user",
      "resource": "TeamMember"
    }
  ]
}

Notes


Remove team member (Legacy)

The "Remove team member" endpoint (described below) is deprecated.

We recommend using the Remove team membership for a user endpoint instead. It allows you to remove both active and pending memberships.

Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.

To remove a team member, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. Removing a team member does not delete the user, it just removes them from the team.

Note: When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub Enterprise Server team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "Synchronizing teams between your identity provider and GitHub Enterprise Server."

delete /teams/{team_id}/members/{username}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

team_id integer path
username string path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/members/USERNAME
JavaScript (@octokit/core.js)
await octokit.request('DELETE /teams/{team_id}/members/{username}', {
  team_id: 42,
  username: 'username'
})

Default Response

Status: 204 No Content

Response if team synchronization is setup

Status: 404 Not Found

Notes


Get team membership for a user

If you pass the hellcat-preview media type, team members will include the members of child teams.

To get a user's membership with a team, the team must be visible to the authenticated user.

Note: The role for organization owners returns as maintainer. For more information about maintainer roles, see Create a team.

get /teams/{team_id}/memberships/{username}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended. プレビューの通知を見る

team_id integer path
username string path

コードサンプル

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/memberships/USERNAME
JavaScript (@octokit/core.js)
await octokit.request('GET /teams/{team_id}/memberships/{username}', {
  team_id: 42,
  username: 'username'
})

Response if user has an active membership with team

Status: 200 OK
{
  "url": "https://api.github.com/teams/1/memberships/octocat",
  "role": "member",
  "state": "active"
}

Response if user is a team maintainer

Status: 200 OK
{
  "url": "https://api.github.com/teams/1/memberships/octocat",
  "role": "maintainer",
  "state": "active"
}

Response if user has a pending membership with team

Status: 200 OK
{
  "url": "https://api.github.com/teams/1/memberships/octocat",
  "role": "member",
  "state": "pending"
}

Notes

プレビュー通知

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

Add or update team membership for a user

If the user is already a member of the team's organization, this endpoint will add the user to the team. To add a membership between an organization member and a team, the authenticated user must be an organization owner or a team maintainer.

If the user is unaffiliated with the team's organization, this endpoint will send an invitation to the user via email. This newly-created membership will be in the "pending" state until the user accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. To add a membership between an unaffiliated user and a team, the authenticated user must be an organization owner.

If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer.

put /teams/{team_id}/memberships/{username}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

team_id integer path
username string path
role string body

The role that this user should have in the team. Can be one of:
* member - a normal member of the team.
* maintainer - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description.

Default: member

コードサンプル

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/memberships/USERNAME \
  -d '{"role":"role"}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /teams/{team_id}/memberships/{username}', {
  team_id: 42,
  username: 'username',
  role: 'role'
})

Response if user's membership with team is now active

Status: 200 OK
{
  "url": "https://api.github.com/teams/1/memberships/octocat",
  "role": "member",
  "state": "active"
}

Response if user's membership with team is now pending

Status: 200 OK
{
  "url": "https://api.github.com/teams/1/memberships/octocat",
  "role": "member",
  "state": "pending"
}

Response if you attempt to add an organization to a team

Status: 422 Unprocessable Entity
{
  "message": "Cannot add an organization as a member.",
  "errors": [
    {
      "code": "org",
      "field": "user",
      "resource": "TeamMember"
    }
  ]
}

Notes


Remove team membership for a user

To remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team.

delete /teams/{team_id}/memberships/{username}

パラメータ

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended.

team_id integer path
username string path

コードサンプル

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/teams/42/memberships/USERNAME
JavaScript (@octokit/core.js)
await octokit.request('DELETE /teams/{team_id}/memberships/{username}', {
  team_id: 42,
  username: 'username'
})

Default Response

Status: 204 No Content

Notes


Team の同期

Team Synchronization API では、GitHub Enterprise Server Team と外部アイデンティティプロバイダ (IdP) グループとの間の接続を管理できます。 この API を使用するには、認証されたユーザーがチームメンテナまたは Team に関連づけられた Organization のコードオーナーである必要があります。 また、認証に使用するトークンも、お使いの IdP (SSO) プロバイダーで使用するための認可を受けている必要があります。 詳しい情報についてはSAML シングルサインオンの Organization で使うために個人アクセストークンを認可するを参照してください。

Team 同期を使用して、IdPを通じて GitHubTeamメンバーを管理できます。 Team Synchronization API を使用するには、チーム同期が有効である必要があります。 詳しい情報については「アイデンティティプロバイダとGitHub間でのTeamの同期」を参照してください。