---
title: "Set team access restrictions"
method: PUT
path: "/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams"
tags: ["repos"]
---

# Set team access restrictions

`PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams`

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](https://docs.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.

Replaces the list of teams that have push access to this branch. This removes all teams that previously had push access and grants push access to the new list of teams. Team restrictions include child teams.

## Path parameters

- `owner` string, required
- `repo` string, required
- `branch` string, required

## Request body

- union
  - object
    - `teams` string[], required — The slug values for teams
  - string[] — The slug values for teams

## Response `200`

Response

- Team[]
  - `id` integer, required
  - `node_id` string, required
  - `name` string, required
  - `slug` string, required
  - `description` string, nullable, required
  - `privacy` string
  - `notification_setting` string
  - `permission` string, required
  - `permissions` object
    - `pull` boolean, required
    - `triage` boolean, required
    - `push` boolean, required
    - `maintain` boolean, required
    - `admin` boolean, required
  - `url` string, uri, required
  - `html_url` string, uri, required
  - `members_url` string, required
  - `repositories_url` string, uri, required
  - `type` 'enterprise' | 'organization', required — The ownership type of the team
  - `access_source` 'direct' | 'organization' | 'enterprise' — 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`.
  - `organization_id` integer — Unique identifier of the organization to which this team belongs
  - `enterprise_id` integer — Unique identifier of the enterprise to which this team belongs
  - `parent` NullableTeamSimple, nullable, required — Groups of organization members that gives permissions on specified repositories.
    - `id` integer, required — Unique identifier of the team
    - `node_id` string, required
    - `url` string, uri, required — URL for the team
    - `members_url` string, required
    - `name` string, required — Name of the team
    - `description` string, nullable, required — Description of the team
    - `permission` string, required — Permission that the team will have for its repositories
    - `privacy` string — The level of privacy this team should have
    - `notification_setting` string — The notification setting the team has set
    - `html_url` string, uri, required
    - `repositories_url` string, uri, required
    - `slug` string, required
    - `ldap_dn` string — Distinguished Name (DN) that team maps to within LDAP environment
    - `type` 'enterprise' | 'organization', required — The ownership type of the team
    - `organization_id` integer — Unique identifier of the organization to which this team belongs
    - `enterprise_id` integer — Unique identifier of the enterprise to which this team belongs

## Other responses

- `422` — Validation failed, or the endpoint has been spammed.

---

[API](https://skmtc.net/github/apis/api-github-com.md) · [All operations](https://skmtc.net/github/apis/api-github-com/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/api-github-com/revisions/a367f7028301/schema)
