# List the GitHub App installations the caller can use and their repositories.

`GET /o/{org}/github`

Without `state`: the installations the caller owns plus those GitHub grants them, each
with the repositories a `resources` URL can name (`GithubInstallationsForKey` for an API
key, `GithubInstallations` for the console). With `state`: the status of the caller's own
pending connect (`GithubConnectStatus`).

## 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`. |
| `state` | query | string | no | A `state` minted by `POST /o/{org}/github` (43 base64url characters). Switches the response to the connect status. |

## Example request

```bash
curl "https://api.phoenix.so/o/$RUSH_ORG/github" \
  -H "Authorization: Bearer $RUSH_TOKEN"
```

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

const res = await fetch(`https://api.phoenix.so/o/${org}/github`, {
  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.phoenix.so/o/{org}/github",
    headers={"Authorization": f"Bearer {os.environ['RUSH_TOKEN']}"},
)

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

## Responses

### 200

Installations (no `state`) or connect status (with `state`).


### 400

`state` is not 43 base64url characters.

### 401

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

### 404

Org not found, or `state` is not one of the caller's pending connects.

### 429

The account is over its request budget, 1,800 a minute shared by the person's API keys and console on every API host (`RATE_LIMITED`). The error names the limit. Wait `Retry-After` seconds.

## Example response (200)

```json
{
  "installations": [
    {
      "id": 163786121,
      "account": "bisma-nawazz",
      "account_type": "User",
      "repositories": [
        {
          "full_name": "bisma-nawazz/code-forge",
          "private": true
        },
        {
          "full_name": "bisma-nawazz/.agents",
          "private": false
        }
      ]
    }
  ]
}
```
