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

List branches in a repository

Lists branches in a repository, including each branch's commit and protection status. Use protected to filter for protected or unprotected branches, or omit it to include all branches; use page and per_page to paginate the results.

5 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.
protectedbooleanoptional
Filter branches by protection status: `true` returns protected branches, and `false` returns unprotected branches. Omit to return all branches.
per_pageintegeroptional
Number of results per page, up to 100. Defaults to 30 when omitted.
Default:30
pageintegeroptional
Page number of the results to fetch. Defaults to 1 when omitted.
Default:1

2 status codes
200Returns an array of branches with each branch's name, commit, and protection status.
namestringrequired
commitobjectrequired
protectedbooleanrequired
protectionobjectoptional
Branch Protection
protection_urlstringoptional
404Returned when the repository cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 404 is returned when the repository cannot be found. The owner and repo path parameters must identify the repository whose branches you want to list.