GET
/repos/{owner}/{repo}/branches/{branch}/protectionGet 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 in the GitHub Help documentation.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
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).
200Response
urlstringoptional
enabledbooleanoptional
required_status_checksobjectoptional
Protected Branch Required Status Check
enforce_adminsobjectoptional
Protected Branch Admin Enforced
required_pull_request_reviewsobjectoptional
Protected Branch Pull Request Review
restrictionsobjectoptional
Branch Restriction Policy
required_linear_historyobjectoptional
allow_force_pushesobjectoptional
allow_deletionsobjectoptional
block_creationsobjectoptional
required_conversation_resolutionobjectoptional
namestringoptional
protection_urlstringoptional
required_signaturesobjectoptional
lock_branchobjectoptional
Whether to set the branch as read-only. If this is true, users will not be able to push to the branch.
allow_fork_syncingobjectoptional
Whether users can pull changes from upstream when the branch is locked. Set to `true` to allow fork syncing. Set to `false` to prevent fork syncing.
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
Error handling
A 404 is returned: Resource not found.