Sample - GitHub REST API
GET/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams

Get teams with access to the protected branch

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Lists the teams who have push access to this branch. The list includes child teams.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

3 parameters
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
branchstringrequired
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use [the GraphQL API](https://docs.github.com/graphql).

2 status codes
200Response
idintegerrequired
node_idstringrequired
namestringrequired
slugstringrequired
descriptionstringrequired
privacystringoptional
notification_settingstringoptional
permissionstringrequired
permissionsobjectoptional
urlstringrequired
html_urlstringrequired
members_urlstringrequired
repositories_urlstringrequired
typestringrequired
The ownership type of the team
Allowed:enterpriseorganization
access_sourcestringoptional
How the team's access to the repository was granted. This property is only present when the team is returned in a repository context, such as `GET /repos/{owner}/{repo}/teams`.
Allowed:directorganizationenterprise
organization_idintegeroptional
Unique identifier of the organization to which this team belongs
enterprise_idintegeroptional
Unique identifier of the enterprise to which this team belongs
parentobjectrequired
Groups of organization members that gives permissions on specified repositories.
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 404 is returned: Resource not found.