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

Get a branch

Retrieves a branch and its protection details from a repository. Use branch to identify the branch; its name cannot contain wildcard characters.

3 parameters
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The repository name without the `.git` extension. The name is not case sensitive.
branchstringrequired
The branch name to retrieve. Cannot contain wildcard characters.

3 status codes
200Returns the branch, including its commit, links, and protection details.
namestringrequired
commitobjectrequired
Commit
_linksobjectrequired
protectedbooleanrequired
protectionobjectrequired
Branch Protection
protection_urlstringrequired
patternstringoptional
required_approving_review_countintegeroptional
301Redirects permanently when the requested resource has moved.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the repository or branch cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 404 is returned when the repository or branch cannot be found. The branch path parameter cannot contain wildcard characters.