# List repositories

Source: https://docs.coderhelm.com/api/reference/repositories/list-repos

`GET /api/repos`

Lists the repositories connected to the team through the CoderHelm GitHub App, whether CoderHelm works on each, and where its tickets come from. Not paged: a team's repositories come back in one answer.

## Authentication

A team API key: `Authorization: Bearer chk_...`. The key needs the `view` scope. See [Authentication](https://docs.coderhelm.com/api/authentication).

## Responses

### 200

The team's repositories.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `repos` | array of Repo | yes | Every connected repository, in name order. |
| `repos[].enabled` | boolean or null | no | Whether CoderHelm works on it. |
| `repos[].name` | string | yes | `owner/name`. |
| `repos[].onboard_error` | string or null | no | Why reading it failed, when it did. |
| `repos[].onboard_status` | string or null | no | How far CoderHelm got reading it when it was connected, such as `pending`, `ready` or `failed`. |
| `repos[].role` | string or null | no | What the repository is for, as the team set it, such as `web` or `backend`. |
| `repos[].ticket_source` | string or null | no | Where its tickets come from: `github` or `jira`. |

Headers: `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`.

### 401

The key is missing, malformed, revoked or expired, or the person who made it left the team.

### 403

The key lacks the scope this endpoint needs (`missing_scope`).

### 429

Over the key's rate limit (`rate_limited`), or, for endpoints that start work, over the team's monthly token limit (`token_limit_reached`).

Headers: `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, `Retry-After`.

### 500

Something failed on CoderHelm's side. Safe to retry reads.

## Example request

cURL:

```bash
curl -X GET 'https://api.coderhelm.com/api/repos' \
  -H "Authorization: Bearer $CODERHELM_API_KEY"
```

TypeScript:

```ts
const res = await fetch("https://api.coderhelm.com/api/repos", {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CODERHELM_API_KEY}`,
  },
});
if (!res.ok) {
  const { error, code } = await res.json();
  throw new Error(`${res.status} ${code}: ${error}`);
}
const data = await res.json();
```

Python:

```python
import os
import requests

headers = {
    "Authorization": f"Bearer {os.environ['CODERHELM_API_KEY']}",
}
res = requests.request("GET", "https://api.coderhelm.com/api/repos", headers=headers)
if not res.ok:
    raise RuntimeError(f"{res.status_code}: {res.json().get('error')}")
data = res.json()
```

## Example response

```json
{
  "repos": [
    {
      "enabled": true,
      "name": "acme/web",
      "onboard_error": null,
      "onboard_status": "ready",
      "role": "web",
      "ticket_source": "github"
    }
  ]
}
```
