---
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/enterprise-server@3.6/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

- 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
  - `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
  - `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
    - `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

## Other responses

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

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-5.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-5/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-5/versions/50ae54440071/schema)
