Retrieve a specific branch from a repository, including its effective branch protection
const url = 'https://gitea.example.com/api/v1/repos/example/example/branches/example';const options = {method: 'GET', headers: {Authorization: 'Basic <credentials>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://gitea.example.com/api/v1/repos/example/example/branches/example \ --header 'Authorization: Basic <credentials>'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Owner of the repo
Name of the repo
Branch to get
Responses
Section titled “Responses”Branch
Branch represents a repository branch
object
PayloadCommit represents a commit
object
List of files added in this commit
PayloadUser represents the author or committer of a commit
object
Full name of the commit author
Username of the user
PayloadUser represents the author or committer of a commit
object
Full name of the commit author
Username of the user
Sha1 hash of the commit
The commit message
List of files modified in this commit
List of files removed in this commit
The URL to view this commit
PayloadCommitVerification represents the GPG verification of a commit
object
The signed payload content
The reason for the verification status
The GPG signature of the commit
PayloadUser represents the author or committer of a commit
object
Full name of the commit author
Username of the user
Whether the commit signature is verified
EffectiveBranchProtectionName is the name of the effective branch protection rule
EnableStatusCheck indicates if status checks are enabled
Name is the branch name
Protected indicates if the branch is protected
RequiredApprovals is the number of required approvals for pull requests
StatusCheckContexts contains the list of required status check contexts
UserCanMerge indicates if the current user can merge to this branch
UserCanPush indicates if the current user can push to this branch
Examplegenerated
{ "commit": { "added": [ "example" ], "author": { "email": "hello@example.com", "name": "example", "username": "example" }, "committer": { "email": "hello@example.com", "name": "example", "username": "example" }, "id": "example", "message": "example", "modified": [ "example" ], "removed": [ "example" ], "timestamp": "2026-04-15T12:00:00Z", "url": "example", "verification": { "payload": "example", "reason": "example", "signature": "example", "signer": { "email": "hello@example.com", "name": "example", "username": "example" }, "verified": true } }, "effective_branch_protection_name": "example", "enable_status_check": true, "name": "example", "protected": true, "required_approvals": 1, "status_check_contexts": [ "example" ], "user_can_merge": true, "user_can_push": true}APINotFound is a not found empty response