# GitHub Repository Search (`github.search_repositories`)

Search public GitHub repositories with GitHub's query syntax (language:, stars:>, topic:...), sorted by best match, stars, forks or last update.

- **Route:** `POST /v1/run/github.search_repositories`
- **Price:** $0.0024 per request ($2.40 per 1,000) · `cost_usd` on every response
- **Source:** GitHub REST API (`github`) · failover: no
- **Measured latency:** p50 993 ms · p95 993 ms · p99 993 ms (1 calls, 30d)
- **Heavy response:** no

## Input

| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| `query` | string | yes |  | GitHub search query |
| `sort` | string | no | "best" | Sort order |
| `limit` | integer | no | 20 | Results per page |
| `page` | integer | no | 1 | Page number |

## Output (`output` in the run envelope)

| Field | Meaning |
|---|---|
| `repositories` | full_name, description, stars, forks, language, topics, license, dates. |
| `total` | Total matches. |
| `count` | Repositories returned. |

## Example

```bash
curl -s -X POST https://getallapis.com/v1/run/github.search_repositories \
  -H "Authorization: Bearer $GETALLAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"mcp server language:typescript stars:>500","sort":"stars","limit":5}'
```

```python
from getallapis_client import Client
client = Client()  # reads GETALLAPIS_API_KEY
result = client.run('github.search_repositories', {'query': 'mcp server language:typescript stars:>500', 'sort': 'stars', 'limit': 5})
print(result['cost_usd'], result['output'])
```

```bash
getallapis run github.search_repositories '{"query":"mcp server language:typescript stars:>500","sort":"stars","limit":5}'
```

Quote first (free, validates input): `POST /v1/quote/github.search_repositories` with the same body.
