---
title: "List Repo Branches"
method: GET
path: "/repos/branches"
tags: ["repos"]
---

# List Repo Branches

`GET /repos/branches`

List branches for a GitHub repo so the dashboard form can offer
a branch picker at index time.

Public repos use anon GitHub API. Private repos resolve through the
caller's GitHub App installation token — keeping the same ACL model
as ``/repos/index`` so a private repo never leaks its branch list
to a non-installed user.

One page of 100 is the whole budget. Paginating to completion would be
15 sequential calls on a repo like ``langchain-ai/langchain`` against an
anon hourly quota of 60, per settled keystroke. Two things make one page
enough instead:

* The default branch is **pinned**, never merely hoped for. GitHub pages
  branches alphabetically, so ``master`` sits outside page one on that
  repo and the picker could not offer it at all — the whole reason this
  endpoint grew an envelope.
* ``q`` searches server-side through ``git/matching-refs``, which
  prefix-matches across every ref in one call, so a branch beyond page
  one is reachable by typing rather than by paging.

``truncated`` tells the caller its list is partial so it can say so; a
silent cap reads to the user as "these are all the branches".

## Query parameters

- `url` string, required
- `q` string, nullable — Prefix-match branch names, e.g. 'release/' or 'mas'.

## Response `200`

Successful Response

- RepoBranchList — Envelope for GET /repos/branches. Wraps the branch rows so the response can carry its own bounds. A bare list could not: GitHub pages branches 100 at a time in alphabetical order, so on a repo like ``langchain-ai/langchain`` (1.5k branches) the first page stops at ``c`` and the caller has no way to know it is holding a twentieth of the refs. ``truncated`` says so; ``default_branch`` is named separately because the default may sort well outside page one and is pinned into ``branches`` rather than being found there.
  - `branches` RepoBranchListItem[], required
    - `name` string, required
    - `head_sha` string, required
    - `is_default` boolean
  - `default_branch` string, required
  - `truncated` boolean

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/repowise/apis/repowise-hosted-api.md) · [All operations](https://skmtc.dev/repowise/apis/repowise-hosted-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/repowise/repowise-hosted-api/revisions/1e57283a9737/schema)
