Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.
Adds an organization member to a team. An authenticated organization owner or team maintainer can add organization members to a 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 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."
An organization owner can add someone who is not part of the team's organization to a team. When an organization owner adds someone to a team who is not an organization member, this endpoint will send an invitation to the person via email. This newly-created membership will be in the "pending" state until the person 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.
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.
Note: You can also specify a team by org_id
and team_id
using the route PUT /organizations/{org_id}/team/{team_id}/memberships/{username}
.
octokit.teams.addOrUpdateMembershipForUserInOrg({org,team_slug,username,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
username | yes | |
role | no | The role that this user should have in the team. Can be one of: |
See also: GitHub Developer Guide documentation.
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.
Note: You can also specify a team by org_id
and team_id
using the route PUT /organizations/{org_id}/team/{team_id}/projects/{project_id}
.
octokit.teams.addOrUpdateProjectPermissionsInOrg({org,team_slug,project_id,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
project_id | yes | |
permission | no | The permission to grant to the team for this project. Can be one of: |
See also: GitHub Developer Guide documentation.
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."
Note: You can also specify a team by org_id
and team_id
using the route PUT /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}
.
For more information about the permission levels, see "Repository permission levels for an organization".
octokit.teams.addOrUpdateRepoPermissionsInOrg({org,team_slug,owner,repo,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
owner | yes | |
repo | yes | |
permission | no | The permission to grant the team on this repository. Can be one of: If no permission is specified, the team's |
See also: GitHub Developer Guide documentation.
Checks whether a team has read
, write
, or admin
permissions for an organization project. The response includes projects inherited from a parent team.
Note: You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/projects/{project_id}
.
octokit.teams.checkPermissionsForProjectInOrg({org,team_slug,project_id,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
project_id | yes |
See also: GitHub Developer Guide documentation.
Checks whether a team has admin
, push
, maintain
, triage
, or pull
permission for a repository. Repositories inherited through a parent team will also 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 application/vnd.github.v3.repository+json
accept header.
If a team doesn't have permission for the repository, you will receive a 404 Not Found
response status.
Note: You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}
.
octokit.teams.checkPermissionsForRepoInOrg({org,team_slug,owner,repo,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
owner | yes | |
repo | yes |
See also: GitHub Developer Guide documentation.
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".
octokit.teams.create({org,name,});
name | required | description |
---|---|---|
org | yes | |
name | yes | The name of the team. |
description | no | The description of the team. |
maintainers | no | List GitHub IDs for organization members who will become team maintainers. |
repo_names | no | The full name (e.g., "organization-name/repository-name") of repositories to add the team to. |
privacy | no | The level of privacy this team should have. The options are: |
permission | no | Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of: |
parent_team_id | no | The ID of a team to set as the parent team. |
See also: GitHub Developer Guide documentation.
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" and "Dealing with abuse rate limits" for details.
Note: You can also specify a team by org_id
and team_id
using the route POST /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments
.
octokit.teams.createDiscussionCommentInOrg({org,team_slug,discussion_number,body,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
discussion_number | yes | |
body | yes | The discussion comment's body text. |
See also: GitHub Developer Guide documentation.
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" and "Dealing with abuse rate limits" for details.
Note: You can also specify a team by org_id
and team_id
using the route POST /organizations/{org_id}/team/{team_id}/discussions
.
octokit.teams.createDiscussionInOrg({org,team_slug,title,body,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
title | yes | The discussion post's title. |
body | yes | The discussion post's body text. |
private | no | 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 |
See also: GitHub Developer Guide documentation.
Deletes a comment on a team discussion. OAuth access tokens require the write:discussion
scope.
Note: You can also specify a team by org_id
and team_id
using the route DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}
.
octokit.teams.deleteDiscussionCommentInOrg({org,team_slug,discussion_number,comment_number,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
discussion_number | yes | |
comment_number | yes |
See also: GitHub Developer Guide documentation.
Delete a discussion from a team's page. OAuth access tokens require the write:discussion
scope.
Note: You can also specify a team by org_id
and team_id
using the route DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}
.
octokit.teams.deleteDiscussionInOrg({org,team_slug,discussion_number,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
discussion_number | yes |
See also: GitHub Developer Guide documentation.
To delete a team, the authenticated user must be an organization owner or team maintainer.
If you are an organization owner, deleting a parent team will delete all of its child teams as well.
Note: You can also specify a team by org_id
and team_id
using the route DELETE /organizations/{org_id}/team/{team_id}
.
octokit.teams.deleteInOrg({org,team_slug,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
See also: GitHub Developer Guide documentation.
Gets a team using the team's slug
. GitHub 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}
.
octokit.teams.getByName({org,team_slug,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
See also: GitHub Developer Guide documentation.
Get a specific comment on a team discussion. OAuth access tokens require the read:discussion
scope.
Note: You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}
.
octokit.teams.getDiscussionCommentInOrg({org,team_slug,discussion_number,comment_number,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
discussion_number | yes | |
comment_number | yes |
See also: GitHub Developer Guide documentation.
Get a specific discussion on a team's page. OAuth access tokens require the read:discussion
scope.
Note: You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}
.
octokit.teams.getDiscussionInOrg({org,team_slug,discussion_number,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
discussion_number | yes |
See also: GitHub Developer Guide documentation.
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: You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/memberships/{username}
.
Note: The role
for organization owners returns as maintainer
. For more information about maintainer
roles, see Create a team.
octokit.teams.getMembershipForUserInOrg({org,team_slug,username,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
username | yes |
See also: GitHub Developer Guide documentation.
Lists all teams in an organization that are visible to the authenticated user.
octokit.teams.list({org,});
name | required | description |
---|---|---|
org | yes | |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Lists the child teams of the team specified by {team_slug}
.
Note: You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/teams
.
octokit.teams.listChildInOrg({org,team_slug,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List all comments on a team discussion. OAuth access tokens require the read:discussion
scope.
Note: You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments
.
octokit.teams.listDiscussionCommentsInOrg({org,team_slug,discussion_number,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
discussion_number | yes | |
direction | no | One of |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List all discussions on a team's page. OAuth access tokens require the read:discussion
scope.
Note: You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/discussions
.
octokit.teams.listDiscussionsInOrg({org,team_slug,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
direction | no | One of |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
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.
octokit.teams.listForAuthenticatedUser();
name | required | description |
---|---|---|
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Team members will include the members of child teams.
To list members in a team, the team must be visible to the authenticated user.
octokit.teams.listMembersInOrg({org,team_slug,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
role | no | Filters members returned by their role in the team. Can be one of: |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
The return hash contains a role
field which refers to the Organization Invitation role and will be one of the following values: direct_member
, admin
, billing_manager
, hiring_manager
, or reinstate
. If the invitee is not a GitHub member, the login
field in the return hash will be null
.
Note: You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/invitations
.
octokit.teams.listPendingInvitationsInOrg({org,team_slug,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Lists the organization projects for a team.
Note: You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/projects
.
octokit.teams.listProjectsInOrg({org,team_slug,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Lists a team's repositories visible to the authenticated user.
Note: You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/repos
.
octokit.teams.listReposInOrg({org,team_slug,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
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 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.
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 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."
Note: You can also specify a team by org_id
and team_id
using the route DELETE /organizations/{org_id}/team/{team_id}/memberships/{username}
.
octokit.teams.removeMembershipForUserInOrg({org,team_slug,username,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
username | yes |
See also: GitHub Developer Guide documentation.
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. This endpoint removes the project from the team, but does not delete the project.
Note: You can also specify a team by org_id
and team_id
using the route DELETE /organizations/{org_id}/team/{team_id}/projects/{project_id}
.
octokit.teams.removeProjectInOrg({org,team_slug,project_id,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
project_id | yes |
See also: GitHub Developer Guide documentation.
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. This does not delete the repository, it just removes it from the team.
Note: You can also specify a team by org_id
and team_id
using the route DELETE /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}
.
octokit.teams.removeRepoInOrg({org,team_slug,owner,repo,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
owner | yes | |
repo | yes |
See also: GitHub Developer Guide documentation.
Edits the body text of a discussion comment. OAuth access tokens require the write:discussion
scope.
Note: You can also specify a team by org_id
and team_id
using the route PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}
.
octokit.teams.updateDiscussionCommentInOrg({org,team_slug,discussion_number,comment_number,body,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
discussion_number | yes | |
comment_number | yes | |
body | yes | The discussion comment's body text. |
See also: GitHub Developer Guide documentation.
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.
Note: You can also specify a team by org_id
and team_id
using the route PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}
.
octokit.teams.updateDiscussionInOrg({org,team_slug,discussion_number,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
discussion_number | yes | |
title | no | The discussion post's title. |
body | no | The discussion post's body text. |
See also: GitHub Developer Guide documentation.
To edit a team, the authenticated user must either be an organization owner or a team maintainer.
Note: You can also specify a team by org_id
and team_id
using the route PATCH /organizations/{org_id}/team/{team_id}
.
octokit.teams.updateInOrg({org,team_slug,name,});
name | required | description |
---|---|---|
org | yes | |
team_slug | yes | team_slug parameter |
name | yes | The name of the team. |
description | no | The description of the team. |
privacy | no | The level of privacy this team should have. Editing teams without specifying this parameter leaves |
permission | no | Deprecated. The permission that new repositories will be added to the team with when none is specified. Can be one of: |
parent_team_id | no | The ID of a team to set as the parent team. |
See also: GitHub Developer Guide documentation.