# The pull request's checks: GitHub's and Koidog's own.

> Reads GitHub now: every check run and commit status on the head commit, with `required` from the repository's rules.
> https://koi.dog/docs/api/pull-requests/list-pull-request-checks/

`GET /api/v1/pull-requests/{id}/checks` · Scope: `read`

Then Koidog's own evidence: each check command a Koidog machine ran on the branch before it was pushed, with its exit code and saved log, from the task's run and any CI fix task's run. When GitHub cannot be read, GitHub's checks come from the last successful read and the answer says so in `X-Koidog-Stale: true`.

## Path parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The pull request's id. |

## Query parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `source` | `array` | no | Only GitHub's checks (`github`) or only the checks Koidog's machines ran before the push (`koidog`). Any of `github`, `koidog`. At least 1 item. |
| `state` | `array` | no | One or more states, comma-separated. Any of `pending`, `passing`, `failing`, `skipped`, `neutral`. At least 1 item. |
| `limit` | `1–200` | no | Page size. Default `50`. |
| `cursor` | `string` | no | Previous page’s `nextCursor`. Keep filters and order. At least 1 character. |
| `order` | `enum` | no | Sort by creation time, then ID. `desc` newest, `asc` oldest. One of `asc`, `desc`. Default `asc`. |
| `createdAfter` | `string` | no | From this UTC timestamp, inclusive (e.g. `2027-01-01T00:00:00Z`). Uses run start, node pairing, move request, event or log time, otherwise creation. |
| `createdBefore` | `string` | no | Through this UTC timestamp, inclusive. See `createdAfter`. |

## Response.

200 OK · `data`: `object[]`. Pass `nextCursor` as `cursor` when `hasMore` is true.

## Request.

```sh
curl "https://api.koi.dog/api/v1/pull-requests/$ID/checks" \
    -H "Authorization: Bearer $KOIDOG_API_KEY"
```

```js
const res = await fetch(`https://api.koi.dog/api/v1/pull-requests/${process.env.ID}/checks`, {
  headers: {
    Authorization: `Bearer ${process.env.KOIDOG_API_KEY}`,
  },
});
console.log(await res.json());
```

```python
import os

import requests

r = requests.get(
    f"https://api.koi.dog/api/v1/pull-requests/{os.environ['ID']}/checks",
    headers={
        "Authorization": f"Bearer {os.environ['KOIDOG_API_KEY']}",
    },
)
r.raise_for_status()
print(r.json())
```

## Response example.

```json
{
  "data": [],
  "nextCursor": "string",
  "hasMore": false
}
```
