Screenshots

View as Markdown

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

$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:

1const png = await fetch(
2 `https://api.chaser.sh/v1/sessions/${sessionId}/screenshot`,
3 {
4 method: "POST",
5 headers: { Authorization: `Bearer ${process.env.CHASER_KEY}` },
6 }
7).then((r) => r.arrayBuffer());
8
9writeFileSync("screenshot.png", Buffer.from(png));

From Python:

1import requests
2
3png = requests.post(
4 f"https://api.chaser.sh/v1/sessions/{session_id}/screenshot",
5 headers={"Authorization": f"Bearer {os.environ['CHASER_KEY']}"},
6).content
7
8with open("screenshot.png", "wb") as f:
9 f.write(png)

Response details

PropertyValue
Content-Typeimage/png
BodyRaw PNG bytes
Max resolutionMatches 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:

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