---
title: "Get branch protection"
method: GET
path: "/repos/{owner}/{repo}/branches/{branch}/protection"
tags: ["repos"]
---

# Get branch protection

`GET /repos/{owner}/{repo}/branches/{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/enterprise-server@3.5/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.

## Path parameters

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

## Response `200`

Response

- BranchProtection — Branch Protection
  - `url` string
  - `enabled` boolean
  - `required_status_checks` ProtectedBranchRequiredStatusCheck — Protected Branch Required Status Check
    - `url` string
    - `enforcement_level` string
    - `contexts` string[], required
    - `checks` object[], required
      - `context` string, required
      - `app_id` integer, nullable, required
    - `contexts_url` string
    - `strict` boolean
  - `enforce_admins` ProtectedBranchAdminEnforced — Protected Branch Admin Enforced
    - `url` string, uri, required
    - `enabled` boolean, required
  - `required_pull_request_reviews` ProtectedBranchPullRequestReview — Protected Branch Pull Request Review
    - `url` string, uri
    - `dismissal_restrictions` object
      - `users` SimpleUser[] — The list of users with review dismissal access.
        - `name` string, nullable
        - `email` string, nullable
        - `login` string, required
        - `id` integer, required
        - `node_id` string, required
        - `avatar_url` string, uri, required
        - `gravatar_id` string, nullable, required
        - `url` string, uri, required
        - `html_url` string, uri, required
        - `followers_url` string, uri, required
        - `following_url` string, required
        - `gists_url` string, required
        - `starred_url` string, required
        - `subscriptions_url` string, uri, required
        - `organizations_url` string, uri, required
        - `repos_url` string, uri, required
        - `events_url` string, required
        - `received_events_url` string, uri, required
        - `type` string, required
        - `site_admin` boolean, required
        - `starred_at` string
      - `teams` Team[] — The list of teams with review dismissal access.
        - `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
      - `apps` Integration[] — The list of apps with review dismissal access.
        - `id` integer, required — Unique identifier of the GitHub app
        - `slug` string — The slug name of the GitHub app
        - `node_id` string, required
        - `owner` NullableSimpleUser, nullable, required — A GitHub user.
          - `name` string, nullable
          - `email` string, nullable
          - `login` string, required
          - `id` integer, required
          - `node_id` string, required
          - `avatar_url` string, uri, required
          - `gravatar_id` string, nullable, required
          - `url` string, uri, required
          - `html_url` string, uri, required
          - `followers_url` string, uri, required
          - `following_url` string, required
          - `gists_url` string, required
          - `starred_url` string, required
          - `subscriptions_url` string, uri, required
          - `organizations_url` string, uri, required
          - `repos_url` string, uri, required
          - `events_url` string, required
          - `received_events_url` string, uri, required
          - `type` string, required
          - `site_admin` boolean, required
          - `starred_at` string
        - `name` string, required — The name of the GitHub app
        - `description` string, nullable, required
        - `external_url` string, uri, required
        - `html_url` string, uri, required
        - `created_at` string, date-time, required
        - `updated_at` string, date-time, required
        - `permissions` object, required — The set of permissions for the GitHub app
          - `issues` string
          - `checks` string
          - `metadata` string
          - `contents` string
          - `deployments` string
        - `events` string[], required — The list of events for the GitHub app
        - `installations_count` integer — The number of installations associated with the GitHub app
        - `client_id` string
        - `client_secret` string
        - `webhook_secret` string, nullable
        - `pem` string
      - `url` string
      - `users_url` string
      - `teams_url` string
    - `bypass_pull_request_allowances` object — Allow specific users, teams, or apps to bypass pull request requirements.
      - `users` SimpleUser[] — The list of users allowed to bypass pull request requirements.
        - `name` string, nullable
        - `email` string, nullable
        - `login` string, required
        - `id` integer, required
        - `node_id` string, required
        - `avatar_url` string, uri, required
        - `gravatar_id` string, nullable, required
        - `url` string, uri, required
        - `html_url` string, uri, required
        - `followers_url` string, uri, required
        - `following_url` string, required
        - `gists_url` string, required
        - `starred_url` string, required
        - `subscriptions_url` string, uri, required
        - `organizations_url` string, uri, required
        - `repos_url` string, uri, required
        - `events_url` string, required
        - `received_events_url` string, uri, required
        - `type` string, required
        - `site_admin` boolean, required
        - `starred_at` string
      - `teams` Team[] — The list of teams allowed to bypass pull request requirements.
        - `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
      - `apps` Integration[] — The list of apps allowed to bypass pull request requirements.
        - `id` integer, required — Unique identifier of the GitHub app
        - `slug` string — The slug name of the GitHub app
        - `node_id` string, required
        - `owner` NullableSimpleUser, nullable, required — A GitHub user.
          - `name` string, nullable
          - `email` string, nullable
          - `login` string, required
          - `id` integer, required
          - `node_id` string, required
          - `avatar_url` string, uri, required
          - `gravatar_id` string, nullable, required
          - `url` string, uri, required
          - `html_url` string, uri, required
          - `followers_url` string, uri, required
          - `following_url` string, required
          - `gists_url` string, required
          - `starred_url` string, required
          - `subscriptions_url` string, uri, required
          - `organizations_url` string, uri, required
          - `repos_url` string, uri, required
          - `events_url` string, required
          - `received_events_url` string, uri, required
          - `type` string, required
          - `site_admin` boolean, required
          - `starred_at` string
        - `name` string, required — The name of the GitHub app
        - `description` string, nullable, required
        - `external_url` string, uri, required
        - `html_url` string, uri, required
        - `created_at` string, date-time, required
        - `updated_at` string, date-time, required
        - `permissions` object, required — The set of permissions for the GitHub app
          - `issues` string
          - `checks` string
          - `metadata` string
          - `contents` string
          - `deployments` string
        - `events` string[], required — The list of events for the GitHub app
        - `installations_count` integer — The number of installations associated with the GitHub app
        - `client_id` string
        - `client_secret` string
        - `webhook_secret` string, nullable
        - `pem` string
    - `dismiss_stale_reviews` boolean, required
    - `require_code_owner_reviews` boolean, required
    - `required_approving_review_count` integer
  - `restrictions` BranchRestrictionPolicy — Branch Restriction Policy
    - `url` string, uri, required
    - `users_url` string, uri, required
    - `teams_url` string, uri, required
    - `apps_url` string, uri, required
    - `users` object[], required
      - `login` string
      - `id` integer
      - `node_id` string
      - `avatar_url` string
      - `gravatar_id` string
      - `url` string
      - `html_url` string
      - `followers_url` string
      - `following_url` string
      - `gists_url` string
      - `starred_url` string
      - `subscriptions_url` string
      - `organizations_url` string
      - `repos_url` string
      - `events_url` string
      - `received_events_url` string
      - `type` string
      - `site_admin` boolean
    - `teams` object[], required
      - `id` integer
      - `node_id` string
      - `url` string
      - `html_url` string
      - `name` string
      - `slug` string
      - `description` string, nullable
      - `privacy` string
      - `permission` string
      - `members_url` string
      - `repositories_url` string
      - `parent` string, nullable
    - `apps` object[], required
      - `id` integer
      - `slug` string
      - `node_id` string
      - `owner` object
        - `login` string
        - `id` integer
        - `node_id` string
        - `url` string
        - `repos_url` string
        - `events_url` string
        - `hooks_url` string
        - `issues_url` string
        - `members_url` string
        - `public_members_url` string
        - `avatar_url` string
        - `description` string
        - `gravatar_id` string
        - `html_url` string
        - `followers_url` string
        - `following_url` string
        - `gists_url` string
        - `starred_url` string
        - `subscriptions_url` string
        - `organizations_url` string
        - `received_events_url` string
        - `type` string
        - `site_admin` boolean
      - `name` string
      - `description` string
      - `external_url` string
      - `html_url` string
      - `created_at` string
      - `updated_at` string
      - `permissions` object
        - `metadata` string
        - `contents` string
        - `issues` string
        - `single_file` string
      - `events` string[]
  - `required_linear_history` object
    - `enabled` boolean
  - `allow_force_pushes` object
    - `enabled` boolean
  - `allow_deletions` object
    - `enabled` boolean
  - `block_creations` object
    - `enabled` boolean
  - `required_conversation_resolution` object
    - `enabled` boolean
  - `name` string
  - `protection_url` string
  - `required_signatures` object
    - `url` string, uri, required
    - `enabled` boolean, required

## Other responses

- `404` — Resource not found

---

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