webcapture Get a free key

Wait for the page in Python with requests

A page that paints late gets captured before it exists. settle holds the render after load, and waitFor names an element the page must actually show before the capture.

Both knobs ride the same JSON body as the url. settle is a plain hold in milliseconds after the page loads; waitFor goes further and blocks until a css selector matches, capped at ten seconds or the settle budget, whichever is smaller. A selector that never matches fails the render rather than shipping a half-painted page, so pick something the page reliably shows: this recipe waits for a paragraph.

The recipe

import requests
from pathlib import Path

ORIGIN = "https://webcapture.io"

receipt = requests.post(
    f"{ORIGIN}/v1/convert",
    headers={"Authorization": "Bearer wc_your_key", "Content-Type": "application/json"},
    json={"url": "https://example.com/", "settle": 1500, "waitFor": "p"},
    timeout=60,
).json()

# the download url names /v1/conversions/<id>.pdf at the serving origin
pdf = requests.get(
    receipt["download"],
    headers={"Authorization": "Bearer wc_your_key"},
    timeout=60,
)
pdf.raise_for_status()
Path("page.pdf").write_bytes(pdf.content)

settle takes 0 to 10000 milliseconds and replaces the endpoint's own default hold; waitFor takes a selector of 1 to 500 characters validated by Chromium. The two compose: the selector wait runs first, the settle hold runs on top of it, and both sit inside the same render budget the 60 second client timeout already covers. A late chart, a web font, or a client-side table is what these two fields are for.

Same-key GET: 401 without it; 404 for another key.

The fields this recipe uses

Related

Method

Source: convert field reference, checked 2026-10-05. Corrections.