---
title: "A branch's sessions, numbered 1, 2, 3 by their earliest commit there, and each commit's session numbers"
description: "A commit links to a session by a `Pando-Session:` line anywhere in\nits message, read from the branch's own commits (at most 250) with its\nfacts after each push, and from the commits that reach main. A\nrewritten commit drops out. A commit's model is the one in force in\nthe session at its commit time, and null when its sessions disagree.\nSessions that ran in the branch's worktree with no commit there yet\nfollow, with no number.\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 › sessions

`GET /v1/monorepos/{owner}/{monorepo}/sessions/on-branch`

A commit links to a session by a `Pando-Session:` line anywhere in
its message, read from the branch's own commits (at most 250) with its
facts after each push, and from the commits that reach main. A
rewritten commit drops out. A commit's model is the one in force in
the session at its commit time, and null when its sessions disagree.
Sessions that ran in the branch's worktree with no commit there yet
follow, with no number.

## Authentication

Requires one of the following:

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

## Path parameters

- `getBranchSessions.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}$`
- `getBranchSessions.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}$`

## Query parameters

- `getBranchSessions.query.repo` (string, required)
- `getBranchSessions.query.branch` (string, required)

## Code samples

### cURL

```curl
curl --request GET \
  --url 'https://app.gitpando.com/v1/monorepos/string/string/sessions/on-branch?repo=string&branch=string' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://app.gitpando.com/v1/monorepos/string/string/sessions/on-branch?repo=string&branch=string';
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/sessions/on-branch?repo=string&branch=string"

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

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

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "sessions": [
    {
      "number": 0,
      "id": "string",
      "session": null,
      "commits": [
        {
          "repo": "string",
          "sha": "string",
          "branch": "string",
          "title": "string",
          "committed_at": "2019-08-24T14:15:22Z",
          "on_main": true,
          "model": "string"
        }
      ]
    }
  ],
  "commits": [
    {
      "sha": "string",
      "sessions": [
        0
      ],
      "model": "string"
    }
  ]
}
```

- `getBranchSessions.response.200.sessions` (array<object>, required)
  - `getBranchSessions.response.200.sessions.number` (integer | null, required)
  - `getBranchSessions.response.200.sessions.id` (string, required)
  - `getBranchSessions.response.200.sessions.session` (unknown, required) — The session, its deleted stub, or null when no record of it is here.
  - `getBranchSessions.response.200.sessions.commits` (array<object>, required)
    - `getBranchSessions.response.200.sessions.commits.repo` (string, required)
    - `getBranchSessions.response.200.sessions.commits.sha` (string, required)
    - `getBranchSessions.response.200.sessions.commits.branch` (string | null, required)
    - `getBranchSessions.response.200.sessions.commits.title` (string, required)
    - `getBranchSessions.response.200.sessions.commits.committed_at` (string, required)
      - format `date-time`
    - `getBranchSessions.response.200.sessions.commits.on_main` (boolean, required)
    - `getBranchSessions.response.200.sessions.commits.model` (string | null, required) — The model in force in the session at the commit's time; null when the sessions naming the commit disagree or one has none, the same in every view.
- `getBranchSessions.response.200.commits` (array<object>, required)
  - `getBranchSessions.response.200.commits.sha` (string, required)
  - `getBranchSessions.response.200.commits.sessions` (array<integer>, required)
  - `getBranchSessions.response.200.commits.model` (string | null, required)


Source: https://docs.gitpando.com/api/sessions/getBranchSessions/index.md
