Check team permissions for a repository
/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.
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.
If the repository is private, you must have at least read permission for that repository, and your token must have the repo or admin:org scope. Otherwise, you will receive a 404 Not Found response status.
[!NOTE] You can also specify a team by
org_idandteam_idusing the routeGET /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}.
Parameters
path Path Parameters
| Name | Type |
|---|---|
org
required
The organization name. The name is not case sensitive. | string |
team_slug
required
The slug of the team name. | string |
owner
required
The account owner of the repository. The name is not case sensitive. | string |
repo
required
The name of the repository without the | string |
Responses
Alternative response with repository permissions
id: number;
node_id: string;
name: string;
full_name: string;
license:
forks: number;
permissions?: {
admin: boolean;
pull: boolean;
triage?: boolean;
push: boolean;
maintain?: boolean;
};
role_name?: string;
owner:
private: boolean;
html_url: string;
description: string | null;
fork: boolean;
url: string;
archive_url: string;
assignees_url: string;
blobs_url: string;
branches_url: string;
collaborators_url: string;
comments_url: string;
commits_url: string;
compare_url: string;
contents_url: string;
contributors_url: string;
deployments_url: string;
downloads_url: string;
events_url: string;
forks_url: string;
git_commits_url: string;
git_refs_url: string;
git_tags_url: string;
git_url: string;
issue_comment_url: string;
issue_events_url: string;
issues_url: string;
keys_url: string;
labels_url: string;
languages_url: string;
merges_url: string;
milestones_url: string;
notifications_url: string;
pulls_url: string;
releases_url: string;
ssh_url: string;
stargazers_url: string;
statuses_url: string;
subscribers_url: string;
subscription_url: string;
tags_url: string;
teams_url: string;
trees_url: string;
clone_url: string;
mirror_url: string | null;
hooks_url: string;
svn_url: string;
homepage: string | null;
language: string | null;
forks_count: number;
stargazers_count: number;
watchers_count: number;
size: number;
default_branch: string;
open_issues_count: number;
is_template?: boolean;
topics?: string[];
has_issues: boolean;
has_projects: boolean;
has_wiki: boolean;
has_pages: boolean;
has_downloads: boolean;
archived: boolean;
disabled: boolean;
visibility?: string;
pushed_at: string | null;
created_at: string | null;
updated_at: string | null;
allow_rebase_merge?: boolean;
temp_clone_token?: string;
allow_squash_merge?: boolean;
allow_auto_merge?: boolean;
delete_branch_on_merge?: boolean;
allow_merge_commit?: boolean;
allow_forking?: boolean;
web_commit_signoff_required?: boolean;
subscribers_count?: number;
network_count?: number;
open_issues: number;
watchers: number;
master_branch?: string;
}
Response if team has permission for the repository. This is the response when the repository media type hasn't been provded in the Accept header.
Client Errors
Not Found if team does not have permission for the repository