> ## 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.

# code_scanning_list_alerts

> List code scanning alerts, each with the rule that fired and the file and line it fired on. Filter to one pull request with `pr`, or to a branch with `ref`. Needs GitHub Advanced Security on a private repository, which answers 403 without it.

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

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

result = await github.code_scanning_list_alerts.ainvoke({"owner": ..., "repo": ...})
```

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

## Path parameters

<div className="reference-table">
  | Field                                                         | Type     | Description                                                                              |
  | ------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------- |
  | `owner` <span className="required" title="required">\*</span> | `string` | The account owner of the repository. The name is not case sensitive.                     |
  | `repo` <span className="required" title="required">\*</span>  | `string` | The name of the repository without the `.git` extension. The name is not case sensitive. |
</div>

## 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>                                               |
  | `toolName`  | `string`                                                                              | The name of a code scanning tool. Only results by this tool will be listed. You can specify the tool by using either `tool_name` or `tool_guid`, but not both.        |
  | `toolGuid`  | `string`                                                                              | The GUID of a code scanning tool. Note that some code scanning tools may not include a GUID in their analysis data. Cannot be combined with `tool_name`.              |
  | `ref`       | `string`                                                                              | The Git reference for the results you want to list. A branch can be `refs/heads/BRANCH` or simply `BRANCH`. To reference a pull request use `refs/pull/NUMBER/merge`. |
  | `pr`        | `integer`                                                                             | The number of the pull request for the results you want to list.                                                                                                      |
  | `state`     | [CodeScanningState](/charter/charter/packs/github/monitoring/objects#codescanningstate)       | If specified, only code scanning alerts with this state will be returned.                                                                                             |
  | `severity`  | [CodeScanningSeverity](/charter/charter/packs/github/monitoring/objects#codescanningseverity) | If specified, only code scanning alerts with this severity will be returned.                                                                                          |
  | `assignees` | `string`                                                                              | Filter alerts by assignees, as a comma-separated list of user handles. Use `*` for at least one assignee or `none` for unassigned.                                    |
  | `sort`      | [CodeScanningSort](/charter/charter/packs/github/pulls/objects#codescanningsort)              | The property by which to sort the results. GitHub uses `created` when this is absent.                                                                                 |
  | `direction` | [SortDirection](/charter/charter/packs/github/issues/objects#sortdirection)                   | The direction to sort the results by. GitHub uses `desc` when this is absent.                                                                                         |
</div>
