---
title: "List branches with head, base, author, ahead and behind, mergeable and checks"
description: "Answered at once from stored facts. `ahead`, `behind`, `base` and\n`mergeable` are computed on change, by a queue: when a branch is\npushed, and in a sweep when main moves (the 100 open branches pushed\nmost recently in the last 7 days). Until a row's facts are for the\ncurrent main and head it is `stale: true`, with `mergeable: \"pending\"`\nand `last_mergeable`; a `branch.updated` event brings the fresh row. A\nlist computes at most 25 rows itself, those stale for over 30 s (a\nbranch no sweep reaches). The default branch is not in the list; its\nname and head are at the top.\n\nNewest first, as GitHub lists active branches: an open branch by its\nlast push, a merged one by its merge time; branches with the same time\nby name. Pages stay stable when two share a time: `next_cursor` holds\nthe last row's time and name.\n"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.gitpando.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Pando API › branches

`GET /v1/monorepos/{owner}/{monorepo}/repos/{repo}/branches`

Answered at once from stored facts. `ahead`, `behind`, `base` and
`mergeable` are computed on change, by a queue: when a branch is
pushed, and in a sweep when main moves (the 100 open branches pushed
most recently in the last 7 days). Until a row's facts are for the
current main and head it is `stale: true`, with `mergeable: "pending"`
and `last_mergeable`; a `branch.updated` event brings the fresh row. A
list computes at most 25 rows itself, those stale for over 30 s (a
branch no sweep reaches). The default branch is not in the list; its
name and head are at the top.

Newest first, as GitHub lists active branches: an open branch by its
last push, a merged one by its merge time; branches with the same time
by name. Pages stay stable when two share a time: `next_cursor` holds
the last row's time and name.

## Authentication

Requires one of the following:

- `credential`, http, header `Authorization`
- `session`, apiKey, in cookie

## Path parameters

- `listBranches.path.owner` (string, required) — The monorepo's owner, a namespace (a person's login or an organization). Matched without case.
  - pattern `^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$`
- `listBranches.path.monorepo` (string, required) — The monorepo's name within its owner (or an old name). Matched without case.
  - pattern `^[a-z0-9](?:[a-z0-9._]|-(?!-)){0,38}$`
- `listBranches.path.repo` (string, required) — The repo's `name` (`projects-web`).

## Query parameters

- `listBranches.query.state` (string, optional)
  - one of `"open"`, `"merged"`, `"all"`; default `"open"`
- `listBranches.query.limit` (integer, optional)
  - min 1; max 500; default `100`
- `listBranches.query.cursor` (string, optional) — `next_cursor` from the previous page, as it came (the last row's time and name).

## Code samples

### cURL

```curl
curl --request GET \
  --url https://app.gitpando.com/v1/monorepos/string/string/repos/string/branches \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://app.gitpando.com/v1/monorepos/string/string/repos/string/branches';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://app.gitpando.com/v1/monorepos/string/string/repos/string/branches"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "default_branch": "string",
  "default_head": "string",
  "branches": [
    {
      "name": "string",
      "head": "string",
      "base": "string",
      "author": "string",
      "title": "string",
      "description": "string",
      "ahead": 0,
      "behind": 0,
      "mergeable": "clean",
      "stale": true,
      "last_mergeable": "string",
      "conflict_paths": [
        "string"
      ],
      "facts_at": "2019-08-24T14:15:22Z",
      "checks": {
        "sha": "string",
        "state": "success",
        "required": [
          "string"
        ],
        "checks_unknown": "string",
        "missing": [
          "string"
        ],
        "statuses": [
          {
            "sha": "string",
            "context": "string",
            "state": "pending",
            "target_url": "string",
            "description": "string",
            "creator": "string",
            "app": "string",
            "created_at": "2019-08-24T14:15:22Z"
          }
        ]
      },
      "state": "open",
      "merge_commit": "string",
      "merged_by": "string",
      "merged_at": "2019-08-24T14:15:22Z",
      "merged_machine": "string",
      "merged_agent": "string",
      "pushed_machine": "string",
      "forced": true,
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "next_cursor": "string"
}
```

- `listBranches.response.200.default_branch` (string, required)
- `listBranches.response.200.default_head` (string | null, required) — null while the repo is empty.
- `listBranches.response.200.branches` (array<object>, required)
  - `listBranches.response.200.branches.name` (string, required)
  - `listBranches.response.200.branches.head` (string, required)
  - `listBranches.response.200.branches.checks` (object, required) — GitHub's combined status, plus the required contexts and which are missing.
    - `listBranches.response.200.branches.checks.sha` (string | null, required)
    - `listBranches.response.200.branches.checks.state` (string, required) — `success` when the merge gate passes; `missing` when a required context has not reported; `unknown` while the required checks are (an unforced merge is refused).
      - one of `"success"`, `"pending"`, `"failure"`, `"error"`, `"missing"`, `"unknown"`
    - `listBranches.response.200.branches.checks.required` (array | null, required) — Null while unknown.
    - `listBranches.response.200.branches.checks.checks_unknown` (string | null, required) — Why the required checks are unknown, in plain words: "Pando couldn't read this monorepo's required checks; try again", or "pando.toml line 3: expected comma or end of structure; fix it on main, or merge with force". Null otherwise.
    - `listBranches.response.200.branches.checks.statuses` (array<object>, required) — The latest status per context.
      - `listBranches.response.200.branches.checks.statuses.sha` (string, required)
      - `listBranches.response.200.branches.checks.statuses.context` (string, required)
      - `listBranches.response.200.branches.checks.statuses.state` (string, required)
        - one of `"pending"`, `"success"`, `"failure"`, `"error"`
      - `listBranches.response.200.branches.checks.statuses.created_at` (string, required)
        - format `date-time`
      - `listBranches.response.200.branches.checks.statuses.target_url` (string | null, optional)
      - `listBranches.response.200.branches.checks.statuses.description` (string | null, optional)
      - `listBranches.response.200.branches.checks.statuses.creator` (string, optional) — The member who posted it (a login); `app:<slug>` for a status posted with a status token or by a CI integration; `hook:<hook id>` for a status token from a web hook with no app.
      - `listBranches.response.200.branches.checks.statuses.app` (string | null, optional) — The CI service that reported it (`buildkite`, `github-actions`, ...), stamped by Pando from a status token or a CI integration, never from the body or `target_url`. Null when a member posted it with their own credential. The web shows the service's mark for a slug it knows.
    - `listBranches.response.200.branches.checks.missing` (array<string>, optional)
  - `listBranches.response.200.branches.state` (string, required) — `merged` when the branch's current head was landed by a Pando merge.
    - one of `"open"`, `"merged"`
  - `listBranches.response.200.branches.base` (string | null, optional) — The merge base with the default branch; null when there is none.
  - `listBranches.response.200.branches.author` (string | null, optional) — The user whose first push (or createBranch) made the branch.
  - `listBranches.response.200.branches.title` (string | null, optional)
  - `listBranches.response.200.branches.description` (string | null, optional)
  - `listBranches.response.200.branches.ahead` (integer | null, optional) — Commits on the branch that are not on the default branch.
  - `listBranches.response.200.branches.behind` (integer | null, optional) — Commits on the default branch that are not on the branch.
  - `listBranches.response.200.branches.mergeable` (string, optional) — From the merge engine's dry run. `up_to_date`: the branch adds nothing. `pending`: not yet computed for the current main and head (see `last_mergeable`).
    - one of `"clean"`, `"conflicts"`, `"up_to_date"`, `"unknown"`, `"pending"`
  - `listBranches.response.200.branches.stale` (boolean, optional) — True while ahead, behind, base and mergeable are not yet for the current main and head.
  - `listBranches.response.200.branches.last_mergeable` (string | null, optional) — When stale: the last known mergeable answer.
  - `listBranches.response.200.branches.conflict_paths` (array | null, optional) — The paths changed differently on both sides, from the same dry run as `mergeable` (or `last_mergeable` while stale), so a branch page shows them before Merge is pressed. Null unless that answer is `conflicts`. No cap: the same list a refused merge's 409 carries in `paths`.
  - `listBranches.response.200.branches.facts_at` (string | null, optional) — When the facts were computed.
    - format `date-time`
  - `listBranches.response.200.branches.merge_commit` (string | null, optional)
  - `listBranches.response.200.branches.merged_by` (string | null, optional) — The user who merged (state merged only).
  - `listBranches.response.200.branches.merged_at` (string | null, optional)
    - format `date-time`
  - `listBranches.response.200.branches.merged_machine` (string | null, optional) — The name of the credential used to merge: the machine or sandbox.
  - `listBranches.response.200.branches.merged_agent` (string | null, optional) — The agent that merged, from X-Pando-Agent, if one said so.
  - `listBranches.response.200.branches.pushed_machine` (string | null, optional) — The name of the credential that last pushed the branch: the machine or sandbox.
  - `listBranches.response.200.branches.forced` (boolean | null, optional) — True when the merge went past red or missing checks with force=1.
  - `listBranches.response.200.branches.created_at` (string | null, optional)
    - format `date-time`
  - `listBranches.response.200.branches.updated_at` (string | null, optional)
    - format `date-time`
- `listBranches.response.200.next_cursor` (string | null, required) — Pass as `cursor` for the next page; null on the last.


Source: https://docs.gitpando.com/api/branches/listBranches/index.md
