GET
/repos/{owner}/{repo}/branchesList repository branches
Lists branches for a repository, including each branch's commit, protection status, and protection details. Use protected to filter by branch protection status, and use page and per_page to paginate the results.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
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
Set to `true` to return only protected branches or `false` to return only unprotected branches. Omitting it returns all branches.
per_pageintegeroptional
The number of results per page, up to 100. Defaults to 30 when omitted.
pageintegeroptional
The page number of results to fetch. Defaults to 1 when omitted.
200Returns an array of branch objects containing each branch's name, latest commit, protection status, and protection details.
namestringrequired
commitobjectrequired
protectedbooleanrequired
protectionobjectoptional
Branch Protection
protection_urlstringoptional
404Returned when the specified repository cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
Error handling
A 404 is returned when the repository cannot be found. per_page must not exceed 100, and owner and repo must identify the repository whose branches you want to list.