Get branch protection
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.
/repos/{owner}/{repo}/branches/{branch}/protection- Source
github-v3-rest.json- Revision
f5f067c1e6f6- Active snapshot
85e53e3d0d65
Request
Path Parameters
- owner stringrequired
- repo stringrequired
- branch stringrequired
The name of the branch.
Responses
Response
allow_deletions objectoptional
allow_force_pushes objectoptional
enforce_admins Protected Branch Admin Enforced objectoptionalProtected Branch Admin Enforced
Protected Branch Admin Enforced
Example: true
Example: https://api.github.com/repos/octocat/Hello-World/branches/master/protection/enforce_admins
Example: "branch/with/protection"
"https://api.github.com/repos/owner-79e94e2d36b3fd06a32bb213/AAA_Public_Repo/branches/branch/with/protection/protection" required_conversation_resolution objectoptional
required_linear_history objectoptional
required_pull_request_reviews Protected Branch Pull Request Review objectoptionalProtected Branch Pull Request Review
Protected Branch Pull Request Review
Example: true
dismissal_restrictions objectoptional
The list of teams with review dismissal access.
"https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions/teams""https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions"The list of users with review dismissal access.
"https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions/users"Example: true
Example: 2
https://api.github.com/repos/octocat/Hello-World/branches/master/protection/dismissal_restrictions required_signatures objectoptional
Example: true
Example: https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_signatures
required_status_checks Protected Branch Required Status Check objectoptionalProtected Branch Required Status Check
Protected Branch Required Status Check
restrictions Branch Restriction Policy objectoptionalBranch Restriction Policy
Branch Restriction Policy
apps array[object]required
items object
teams array[object]required
items object
users array[object]required
items object
Resource not found