← All tags

Teams API Reference

Interact with GitHub Teams.

32 endpoints tagged teams, each listing its parameters and possible responses. Search or scroll the index below to jump to a specific endpoint.

No endpoints match your search.

List teams

GET /orgs/{org}/teams

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

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
team_typequerynoFilter team results by their type. For more information, see "What kind of team should I use?"

Responses

StatusDescriptionHas JSON body
200Responseyes
403Forbiddenyes

Create a team

POST /orgs/{org}/teams

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."

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
403Forbiddenyes

Get a team by name

GET /orgs/{org}/teams/{team_slug}

Gets a team using the team's slug. To create the slug, GitHub replaces special characters in the name string, changes all words to lowercase, and replaces spaces with a - separator. For example, "My TEam Näme" would become my-team-name.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes

Update a team

PATCH /orgs/{org}/teams/{team_slug}

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

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.

Responses

StatusDescriptionHas JSON body
200Response when the updated information already existsyes
201Responseyes
404Resource not foundyes
422Validation failed, or the endpoint has been spammed.yes
403Forbiddenyes

Delete a team

DELETE /orgs/{org}/teams/{team_slug}

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

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.

Responses

StatusDescriptionHas JSON body
204Responseno
422Unprocessable entity if you attempt to modify an enterprise team at the organization level.no

List pending team invitations

GET /orgs/{org}/teams/{team_slug}/invitations

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.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
422Unprocessable entity if you attempt to modify an enterprise team at the organization level.no

List team members

GET /orgs/{org}/teams/{team_slug}/members

Team members will include the members of child teams.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.
rolequerynoFilters members returned by their role in the team.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes

Get team membership for a user

GET /orgs/{org}/teams/{team_slug}/memberships/{username}

Team members will include the members of child teams.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
200Responseyes
404if user has no team membershipno

Add or update team membership for a user

PUT /orgs/{org}/teams/{team_slug}/memberships/{username}

Adds an organization member to a team. An authenticated organization owner or team maintainer can add organization members to a team.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
200Responseyes
403Forbidden if team synchronization is set upno
422Unprocessable Entity if you attempt to add an organization to a teamno

Remove team membership for a user

DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}

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.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
204Responseno
403Forbidden if team synchronization is set upno

List team repositories

GET /orgs/{org}/teams/{team_slug}/repos

Lists a team's repositories visible to the authenticated user.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes

Check team permissions for a repository

GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}

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.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
200Alternative response with repository permissionsyes
204Response if team has permission for the repository. This is the response when the repository media type hasn't been provded in the Accept header.no
404Not Found if team does not have permission for the repositoryno

Add or update team repository permissions

PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}

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 method."

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
204Responseno

Remove a repository from a team

DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}

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.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
204Responseno

List child teams

GET /orgs/{org}/teams/{team_slug}/teams

Lists the child teams of the team specified by {team_slug}.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
team_slugpathyesThe slug of the team name.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200if child teams existyes

Get a team (Legacy)

GET /teams/{team_id}

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes

Update a team (Legacy)

PATCH /teams/{team_id}

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

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.

Responses

StatusDescriptionHas JSON body
200Response when the updated information already existsyes
201Responseyes
404Resource not foundyes
422Validation failed, or the endpoint has been spammed.yes
403Forbiddenyes

Delete a team (Legacy)

DELETE /teams/{team_id}

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

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.

Responses

StatusDescriptionHas JSON body
204Responseno
404Resource not foundyes
422Validation failed, or the endpoint has been spammed.yes

List pending team invitations (Legacy)

GET /teams/{team_id}/invitations

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.

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes

List team members (Legacy)

GET /teams/{team_id}/members

Team members will include the members of child teams.

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
rolequerynoFilters members returned by their role in the team.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes

Get team member (Legacy)

GET /teams/{team_id}/members/{username}

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

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
204if user is a memberno
404if user is not a memberno

Add team member (Legacy)

PUT /teams/{team_id}/members/{username}

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

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
204Responseno
404Not Found if team synchronization is set upno
422Unprocessable Entity if you attempt to add an organization to a team or you attempt to add a user to a team when they are not a member of at least one other team in the same organizationno
403Forbiddenyes

Remove team member (Legacy)

DELETE /teams/{team_id}/members/{username}

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

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
204Responseno
404Not Found if team synchronization is setupno

Get team membership for a user (Legacy)

GET /teams/{team_id}/memberships/{username}

Team members will include the members of child teams.

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes

Add or update team membership for a user (Legacy)

PUT /teams/{team_id}/memberships/{username}

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

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
200Responseyes
403Forbidden if team synchronization is set upno
422Unprocessable Entity if you attempt to add an organization to a teamno
404Resource not foundyes

Remove team membership for a user (Legacy)

DELETE /teams/{team_id}/memberships/{username}

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

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
204Responseno
403if team synchronization is set upno

List team repositories (Legacy)

GET /teams/{team_id}/repos

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes

Check team permissions for a repository (Legacy)

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

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:

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
200Alternative response with extra repository informationyes
204Response if repository is managed by this teamno
404Not Found if repository is not managed by this teamno

Add or update team repository permissions (Legacy)

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

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.

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
204Responseno
403Forbiddenyes
422Validation failed, or the endpoint has been spammed.yes

Remove a repository from a team (Legacy)

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

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.

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
204Responseno

List child teams (Legacy)

GET /teams/{team_id}/teams

Parameters

NameInRequiredDescription
team_idpathyesThe unique identifier of the team.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200if child teams existyes
404Resource not foundyes
403Forbiddenyes
422Validation failed, or the endpoint has been spammed.yes

List teams for the authenticated user

GET /user/teams

List all of the teams across all of the organizations to which the authenticated

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes