> ## Documentation Index
> Fetch the complete documentation index at: https://docs.r28.ai/charter/llms.txt
> Use this file to discover all available pages before exploring further.

# search_code

> Search code across GitHub. Only default branches are indexed and only files under 384 KB. The query needs a real search term, not just qualifiers. This endpoint allows ten requests per minute and returns at most 1,000 results.

<div className="tool-route"><span className="tool-row-method" data-method="GET">GET</span><code>{"https://api.github.com/search/code"}</code></div>

```python github_search_code.py theme={null}
from charter.packs import github

result = await github.search_code.ainvoke({"q": ...})
```

<Note>
  Requires `repo`, `read:user`. Pages by number: `page` with `per_page`.
</Note>

## Query parameters

<div className="reference-table">
  | Field                                                     | Type      | Description                                                                                                                                                                                                    |
  | --------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `perPage`                                                 | `integer` | The number of results per page (max 100). Defaults to 30. <span className="field-constraints">≥ 1; ≤ 100; defaults to `30`</span>                                                                              |
  | `page`                                                    | `integer` | The page number of the results to fetch. Defaults to 1. <span className="field-constraints">≥ 1; defaults to `1`</span>                                                                                        |
  | `q` <span className="required" title="required">\*</span> | `string`  | The search query. Combine a term with qualifiers: 'retry in:file language:python repo:owner/name'. Useful qualifiers are in:file, in:path, language:, repo:, org:, user:, path:, filename:, extension:, size:. |
</div>
