---
title: "Get a specific branch protection for the repository"
method: GET
path: "/repos/{owner}/{repo}/branch_protections/{name}"
tags: ["repository"]
---

# Get a specific branch protection for the repository

`GET /repos/{owner}/{repo}/branch_protections/{name}`

## Request

- Base URL: `https://demo.gitea.com/api/v1`
- URL: `https://demo.gitea.com/api/v1/repos/{owner}/{repo}/branch_protections/{name}`
- Auth: one of:
  - HTTP basic
  - API key in query parameter `token`
  - API key in query parameter `access_token`
  - API key in header `Authorization`
  - API key in query parameter `sudo`
  - API key in header `Sudo`
  - API key in header `X-GITEA-OTP`
- TypeScript: <https://skmtc.dev/gitea/apis/gitea-api/docs/repos/:owner/:repo/branch_protections/:name/get.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `owner` string, required
- `repo` string, required
- `name` string, required

## Response `200`

BranchProtection

- BranchProtection: BranchProtection represents a branch protection for a repository
  - `approvals_whitelist_teams` string[]
  - `approvals_whitelist_username` string[]
  - `block_admin_merge_override` boolean
  - `block_on_codeowner_reviews` boolean
  - `block_on_official_review_requests` boolean
  - `block_on_outdated_branch` boolean
  - `block_on_rejected_reviews` boolean
  - `branch_name` string
  - `bypass_allowlist_teams` string[]
  - `bypass_allowlist_usernames` string[]
  - `created_at` string, date-time
  - `deletion_allowlist_teams` string[]
  - `deletion_allowlist_usernames` string[]
  - `dismiss_stale_approvals` boolean
  - `enable_approvals_whitelist` boolean
  - `enable_bypass_allowlist` boolean
  - `enable_deletion` boolean
  - `enable_deletion_allowlist` boolean
  - `enable_force_push` boolean
  - `enable_force_push_allowlist` boolean
  - `enable_merge_whitelist` boolean
  - `enable_push` boolean
  - `enable_push_whitelist` boolean
  - `enable_status_check` boolean
  - `force_push_allowlist_deploy_keys` boolean
  - `force_push_allowlist_teams` string[]
  - `force_push_allowlist_usernames` string[]
  - `ignore_stale_approvals` boolean
  - `merge_whitelist_teams` string[]
  - `merge_whitelist_usernames` string[]
  - `priority` integer: Priority is the priority of this branch protection rule
  - `protected_file_patterns` string
  - `push_whitelist_deploy_keys` boolean
  - `push_whitelist_teams` string[]
  - `push_whitelist_usernames` string[]
  - `require_signed_commits` boolean
  - `required_approvals` integer
  - `rule_name` string: RuleName is the name of the branch protection rule
  - `status_check_contexts` string[]
  - `unprotected_file_patterns` string
  - `updated_at` string, date-time

## Other responses

- `default`: APIError is error format response

## Changes

- **2026-10-28** `7ef50c4c527f`: 1 info
  - removed the non-success response with the status `404`

[Operation history](https://skmtc.dev/gitea/apis/gitea-api/changes/repos/:owner/:repo/branch_protections/:name/get.md)

---

[API](https://skmtc.dev/gitea/apis/gitea-api.md) - [All operations](https://skmtc.dev/gitea/apis/gitea-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gitea/apis/gitea-api/revisions/7ef50c4c527f?raw)
