GitHub v3 REST API

Check team permissions for a repository

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

get
{protocol}://{hostname}/api/v3/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}

Path Parameters

orgstringrequired
team_slugstringrequired

team_slug parameter

ownerstringrequired
repostringrequired

Response

application/json

Alternative response with repository permissions

Team Repository

A team’s access to a repository.

idintegerrequired

Unique identifier of the repository

Example:42

node_idstringrequired

Example:MDEwOlJlcG9zaXRvcnkxMjk2MjY5

namestringrequired

The name of the repository.

Example:Team Environment

full_namestringrequired

Example:octocat/Hello-World

licenseobject | nullrequired

License Simple

Show Child Parameters
forksintegerrequired
permissionsobject
Show Child Parameters
ownerobject | nullrequired

Simple User

Show Child Parameters
privatebooleanrequired

Whether the repository is private or public.

Default:false

html_urlstring(uri)required

Example:https://github.com/octocat/Hello-World

descriptionstring | nullrequired

Example:This your first repo!

forkbooleanrequired
urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World

archive_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}

assignees_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/assignees{/user}

blobs_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}

branches_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/branches{/branch}

collaborators_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}

comments_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/comments{/number}

commits_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/commits{/sha}

compare_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}

contents_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/contents/{+path}

contributors_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/contributors

deployments_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/deployments

downloads_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/downloads

events_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/events

forks_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/forks

git_commits_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}

git_refs_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}

git_tags_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}

git_urlstringrequired

Example:git:github.com/octocat/Hello-World.git

issue_comment_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}

issue_events_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/issues/events{/number}

issues_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/issues{/number}

keys_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/keys{/key_id}

labels_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/labels{/name}

languages_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/languages

merges_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/merges

milestones_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/milestones{/number}

notifications_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}

pulls_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/pulls{/number}

releases_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/releases{/id}

ssh_urlstringrequired

Example:git@github.com:octocat/Hello-World.git

stargazers_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/stargazers

statuses_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/statuses/{sha}

subscribers_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/subscribers

subscription_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/subscription

tags_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/tags

teams_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/teams

trees_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}

clone_urlstringrequired

Example:https://github.com/octocat/Hello-World.git

mirror_urlstring | null(uri)required

Example:git:git.example.com/octocat/Hello-World

hooks_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/hooks

svn_urlstring(uri)required

Example:https://svn.github.com/octocat/Hello-World

homepagestring | null(uri)required

Example:https://github.com

languagestring | nullrequired
forks_countintegerrequired

Example:9

stargazers_countintegerrequired

Example:80

watchers_countintegerrequired

Example:80

sizeintegerrequired

Example:108

default_branchstringrequired

The default branch of the repository.

Example:master

open_issues_countintegerrequired

Example:0

is_templateboolean

Whether this repository acts as a template that can be used to generate new repositories.

Default:false

Example:true

topicsarray[string]
has_issuesbooleanrequired

Whether issues are enabled.

Default:true

Example:true

has_projectsbooleanrequired

Whether projects are enabled.

Default:true

Example:true

has_wikibooleanrequired

Whether the wiki is enabled.

Default:true

Example:true

has_pagesbooleanrequired
has_downloadsbooleanrequired

Whether downloads are enabled.

Default:true

Example:true

archivedbooleanrequired

Whether the repository is archived.

Default:false

disabledbooleanrequired

Returns whether or not this repository disabled.

visibilitystring

The repository visibility: public, private, or internal.

Default:public

pushed_atstring | null(date-time)required

Example:2011-01-26T19:06:43Z

created_atstring | null(date-time)required

Example:2011-01-26T19:01:12Z

updated_atstring | null(date-time)required

Example:2011-01-26T19:14:43Z

allow_rebase_mergeboolean

Whether to allow rebase merges for pull requests.

Default:true

Example:true

template_repositoryobject | null

A git repository

Show Child Parameters
temp_clone_tokenstring
allow_squash_mergeboolean

Whether to allow squash merges for pull requests.

Default:true

Example:true

delete_branch_on_mergeboolean

Whether to delete head branches when pull requests are merged

Default:false

Example:false

allow_merge_commitboolean

Whether to allow merge commits for pull requests.

Default:true

Example:true

allow_forkingboolean

Whether to allow forking this repo

Default:false

Example:false

subscribers_countinteger
network_countinteger
open_issuesintegerrequired
watchersintegerrequired
master_branchstring
get/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}
 
application/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.”

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

put
{protocol}://{hostname}/api/v3/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}

Path Parameters

orgstringrequired
team_slugstringrequired

team_slug parameter

ownerstringrequired
repostringrequired

Body

application/json
permissionstring

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.
* maintain - team members can manage the repository without access to sensitive or destructive actions. Recommended for project managers. Only applies to repositories owned by organizations.
* triage - team members can proactively manage issues and pull requests without write access. Recommended for contributors who triage a repository. Only applies to repositories owned by organizations.

If no permission is specified, the team’s permission attribute will be used to determine what permission to grant the team on this repository.

Allowed values:pullpushadminmaintaintriage

Default:push

Response

204

Response

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

Body

{}
 
204

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

delete
{protocol}://{hostname}/api/v3/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}

Path Parameters

orgstringrequired
team_slugstringrequired

team_slug parameter

ownerstringrequired
repostringrequired

Response

204

Response

delete/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}
 
204

List child teams

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.

get
{protocol}://{hostname}/api/v3/orgs/{org}/teams/{team_slug}/teams

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

orgstringrequired
team_slugstringrequired

team_slug parameter

Response

200 application/json

if child teams exist

Groups of organization members that gives permissions on specified repositories.

idintegerrequired
node_idstringrequired
namestringrequired
slugstringrequired
descriptionstring | nullrequired
privacystring
permissionstringrequired
permissionsobject
Show Child Parameters
urlstring(uri)required
html_urlstring(uri)required

Example:https://github.com/orgs/rails/teams/core

members_urlstringrequired
repositories_urlstring(uri)required
parentobject | nullrequired

Groups of organization members that gives permissions on specified repositories.

Show Child Parameters
get/orgs/{org}/teams/{team_slug}/teams
 
200 application/json

Get a team (Legacy)

DEPRECATED

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the Get a team by name endpoint.

get
{protocol}://{hostname}/api/v3/teams/{team_id}

Path Parameters

team_idintegerrequired

Response

application/json

Response

Full Team

Groups of organization members that gives permissions on specified repositories.

idintegerrequired

Unique identifier of the team

Example:42

node_idstringrequired

Example:MDQ6VGVhbTE=

urlstring(uri)required

URL for the team

Example:https://api.github.com/organizations/1/team/1

html_urlstring(uri)required

Example:https://github.com/orgs/rails/teams/core

namestringrequired

Name of the team

Example:Developers

slugstringrequired

Example:justice-league

descriptionstring | nullrequired

Example:A great team.

privacystring

The level of privacy this team should have

Allowed values:closedsecret

Example:closed

permissionstringrequired

Permission that the team will have for its repositories

Example:push

members_urlstringrequired

Example:https://api.github.com/organizations/1/team/1/members{/member}

repositories_urlstring(uri)required

Example:https://api.github.com/organizations/1/team/1/repos

parentobject | null

Groups of organization members that gives permissions on specified repositories.

Show Child Parameters
members_countintegerrequired

Example:3

repos_countintegerrequired

Example:10

created_atstring(date-time)required

Example:2017-07-14T16:53:42Z

updated_atstring(date-time)required

Example:2017-08-17T12:37:15Z

organizationobjectrequired

Organization Full

Show Child Parameters
ldap_dnstring

Distinguished Name (DN) that team maps to within LDAP environment

Example:uid=example,ou=users,dc=github,dc=com

get/teams/{team_id}
 
application/json