# List repositories

List repositories available to Hoplite through connected GitHub App installations.

`GET /api/source-control/github/repositories`

Required permission: `repo:read`.

## Example request

```bash
curl --request GET \
  --url https://api.hoplite.sh/api/source-control/github/repositories \
  --header "X-Api-Key: $HOPLITE_API_KEY"
```

## 200 response

Connected repositories.

Content type: `application/json`. Response type: `GitHubRepositoriesResponse`.

| Field | Type | Required | Constraints | Description |
| --- | --- | --- | --- | --- |
| `ok` | `boolean` | Yes | constant true | — |
| `repositories` | `RepositoryRef[]` | Yes | — | — |
| `repositories.id` | `string` | Yes | — | — |
| `repositories.fullName` | `string` | Yes | — | — |
| `repositories.defaultBranch` | `string` | Yes | — | — |
| `repositories.private` | `boolean` | Yes | — | — |

```json
{
  "ok": true,
  "repositories": [
    {
      "id": "repo_987654321",
      "fullName": "acme/storefront",
      "defaultBranch": "main",
      "private": true
    }
  ]
}
```

## Response headers

| Header | Type | Statuses | Description |

| --- | --- | --- | --- |

| `RateLimit` | `string` | `200`, `401`, `402`, `403`, `429`, `500`, `501`, `503` | Current ingress policy, remaining requests, and seconds until reset, for example `"ingress";r=599;t=60`. |

| `RateLimit-Policy` | `string` | `200`, `401`, `402`, `403`, `429`, `500`, `501`, `503` | Ingress quota and window, for example `"ingress";q=600;qu="requests";w=60`. |

| `X-RateLimit-Limit` | `integer` | `200`, `401`, `402`, `403`, `429`, `500`, `501`, `503` | Maximum requests allowed in the current rolling window. |

| `X-RateLimit-Remaining` | `integer` | `200`, `401`, `402`, `403`, `429`, `500`, `501`, `503` | Requests remaining in the current rolling window. |

| `X-RateLimit-Reset` | `integer` | `200`, `401`, `402`, `403`, `429`, `500`, `501`, `503` | Unix timestamp when the current rolling window resets. |

| `x-request-id` | `string` | `200`, `401`, `402`, `403`, `429`, `500`, `501`, `503` | Request correlation ID. |

| `Retry-After` | `integer` | `429`, `503` | Seconds until another request should be attempted. |

| `X-Retry-After` | `integer` | `429`, `503` | Legacy retry delay in seconds. |

## Status codes

- `200` — Connected repositories.

- `401` — The API key is missing, invalid, or lacks the operation's permission.

- `402` — The organization does not have access to the requested product capability.

- `403` — The key's current user no longer has the required organization membership or role.

- `429` — The API-key rate limit has been exceeded.

- `500` — The API encountered an unexpected failure.

- `501` — The deployment has not configured the requested capability.

- `503` — A required API dependency, including the rate limiter, is unavailable.