---
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/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
        - `user_view_type` 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
        - `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
      - `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
        - `client_id` string
        - `owner` union, required
          - SimpleUser — 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
            - `user_view_type` string
          - Enterprise — An enterprise on GitHub.
            - `description` string, nullable — A short description of the enterprise.
            - `html_url` string, uri, required
            - `website_url` string, uri, nullable — The enterprise's website URL.
            - `id` integer, required — Unique identifier of the enterprise
            - `node_id` string, required
            - `name` string, required — The name of the enterprise.
            - `slug` string, required — The slug url identifier for the enterprise.
            - `created_at` string, date-time, nullable, required
            - `updated_at` string, date-time, nullable, required
            - `avatar_url` string, uri, required
        - `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. Note that the `installation_target`, `security_advisory`, and `meta` events are not included because they are global events and not specific to an installation.
        - `installations_count` integer — The number of installations associated with the GitHub app. Only returned when the integration is requesting details about itself.
      - `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
        - `user_view_type` 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
        - `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
      - `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
        - `client_id` string
        - `owner` union, required
          - SimpleUser — 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
            - `user_view_type` string
          - Enterprise — An enterprise on GitHub.
            - `description` string, nullable — A short description of the enterprise.
            - `html_url` string, uri, required
            - `website_url` string, uri, nullable — The enterprise's website URL.
            - `id` integer, required — Unique identifier of the enterprise
            - `node_id` string, required
            - `name` string, required — The name of the enterprise.
            - `slug` string, required — The slug url identifier for the enterprise.
            - `created_at` string, date-time, nullable, required
            - `updated_at` string, date-time, nullable, required
            - `avatar_url` string, uri, required
        - `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. Note that the `installation_target`, `security_advisory`, and `meta` events are not included because they are global events and not specific to an installation.
        - `installations_count` integer — The number of installations associated with the GitHub app. Only returned when the integration is requesting details about itself.
    - `dismiss_stale_reviews` boolean, required
    - `require_code_owner_reviews` boolean, required
    - `required_approving_review_count` integer
    - `require_last_push_approval` boolean — Whether the most recent push must be approved by someone other than the person who pushed it.
  - `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
      - `user_view_type` string
    - `teams` Team[], required
      - `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
    - `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
        - `user_view_type` string
      - `name` string
      - `client_id` 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
  - `lock_branch` object — Whether to set the branch as read-only. If this is true, users will not be able to push to the branch.
    - `enabled` boolean
  - `allow_fork_syncing` object — 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.
    - `enabled` boolean

## Other responses

- `404` — Resource not found

---

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