# List a repository's branches through an installation the caller can use.

`GET /o/{org}/github/branches`

`owner/repo` must be one of the repositories the installation grants the caller. Reads at most 2,000 branches.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `org` | path | string | yes | The org's slug or id. A caller with no role in the org gets `404`. |
| `installation_id` | query | string | yes |  |
| `owner` | query | string | yes |  |
| `repo` | query | string | yes |  |

## Example request

```bash
curl "https://api.prix.dev/o/$RUSH_ORG/github/branches?installation_id=string&owner=string&repo=string" \
  -H "Authorization: Bearer $RUSH_TOKEN"
```

```typescript
const org = process.env.RUSH_ORG;

const res = await fetch(`https://api.prix.dev/o/${org}/github/branches?installation_id=string&owner=string&repo=string`, {
  headers: {
    Authorization: `Bearer ${process.env.RUSH_TOKEN}`,
  },
});

console.log(res.status, await res.json());
```

```python
import os

import requests

org = os.environ["RUSH_ORG"]

res = requests.get(
    f"https://api.prix.dev/o/{org}/github/branches?installation_id=string&owner=string&repo=string",
    headers={"Authorization": f"Bearer {os.environ['RUSH_TOKEN']}"},
)

print(res.status_code, res.json())
```

## Responses

### 200

The default branch and every branch name.

- `default_branch` (string, required)
- `branches` (array of string, required)

### 400

`owner`/`repo` missing or `installation_id` invalid.

### 401

No bearer, an unknown, revoked or expired one, or an API key on a route keys cannot call.

### 403

The caller cannot use this installation, or it is suspended.

### 404

Org not found, or the repository is not in this installation.

### 502

GitHub did not return the branch list.

## Example response (200)

```json
{
  "default_branch": "string",
  "branches": [
    "string"
  ]
}
```
