---
title: "Retrieve a specific branch from a repository, including its effective branch protection"
method: GET
path: "/repos/{owner}/{repo}/branches/{branch}"
tags: ["repository"]
---

# Retrieve a specific branch from a repository, including its effective branch protection

`GET /repos/{owner}/{repo}/branches/{branch}`

## Request

- Base URL: `https://demo.gitea.com/api/v1`
- URL: `https://demo.gitea.com/api/v1/repos/{owner}/{repo}/branches/{branch}`
- 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/branches/:branch/get.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

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

## Response `200`

Branch

- Branch: Branch represents a repository branch
  - `commit` PayloadCommit: PayloadCommit represents a commit
    - `added` string[]: List of files added in this commit
    - `author` PayloadUser: PayloadUser represents the author or committer of a commit
      - `email` string, email
      - `name` string: Full name of the commit author
      - `username` string: username of the user
    - `committer` PayloadUser: PayloadUser represents the author or committer of a commit
      - `email` string, email
      - `name` string: Full name of the commit author
      - `username` string: username of the user
    - `id` string: sha1 hash of the commit
    - `message` string: The commit message
    - `modified` string[]: List of files modified in this commit
    - `removed` string[]: List of files removed in this commit
    - `timestamp` string, date-time: The timestamp when the commit was made
    - `url` string: The URL to view this commit
    - `verification` PayloadCommitVerification: PayloadCommitVerification represents the GPG verification of a commit
      - `payload` string: The signed payload content
      - `reason` string: The reason for the verification status
      - `signature` string: The GPG signature of the commit
      - `signer` PayloadUser: PayloadUser represents the author or committer of a commit
        - `email` string, email
        - `name` string: Full name of the commit author
        - `username` string: username of the user
      - `verified` boolean: Whether the commit signature is verified
  - `effective_branch_protection_name` string: EffectiveBranchProtectionName is the name of the effective branch protection rule
  - `enable_status_check` boolean: EnableStatusCheck indicates if status checks are enabled
  - `name` string: Name is the branch name
  - `protected` boolean: Protected indicates if the branch is protected
  - `required_approvals` integer: RequiredApprovals is the number of required approvals for pull requests
  - `status_check_contexts` string[]: StatusCheckContexts contains the list of required status check contexts
  - `user_can_merge` boolean: UserCanMerge indicates if the current user can merge to this branch
  - `user_can_push` boolean: UserCanPush indicates if the current user can push to this branch

## 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/branches/:branch/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)
