> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.chaser.sh/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.chaser.sh/_mcp/server.

# Screenshots

The screenshot endpoint captures the session framebuffer as a PNG. Use it instead of `page.screenshot()`.

## Why a separate endpoint?

`page.screenshot()` reads pixels back through Chromium's compositor. On remote sessions this path can stall or return empty frames. The `/screenshot` endpoint captures the framebuffer directly, avoiding the compositor entirely.

## Taking a screenshot

```bash
curl -s https://api.chaser.sh/v1/sessions/{session_id}/screenshot \
  -X POST \
  -H "Authorization: Bearer $CHASER_KEY" \
  -o screenshot.png
```

The response is a raw PNG (`image/png`). No JSON wrapping.

From TypeScript:

```typescript
const png = await fetch(
  `https://api.chaser.sh/v1/sessions/${sessionId}/screenshot`,
  {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.CHASER_KEY}` },
  }
).then((r) => r.arrayBuffer());

writeFileSync("screenshot.png", Buffer.from(png));
```

From Python:

```python
import requests

png = requests.post(
    f"https://api.chaser.sh/v1/sessions/{session_id}/screenshot",
    headers={"Authorization": f"Bearer {os.environ['CHASER_KEY']}"},
).content

with open("screenshot.png", "wb") as f:
    f.write(png)
```

## Response details

| Property | Value |
|---|---|
| Content-Type | `image/png` |
| Body | Raw PNG bytes |
| Max resolution | Matches the session's screen resolution |

## Timing

Screenshots take roughly 1–3 seconds. The session must be in `ready` status. If the session has expired, the endpoint returns `409`.

## Full-page screenshots

The endpoint captures the visible viewport. To capture the full page, scroll and stitch, or set the viewport size before navigating:

```typescript
await page.setViewportSize({ width: 1280, height: 2000 });
```