{"id":"92d148ed-87c1-49a5-90ef-e7153cc8956f","task":"Use Cloudflare Browser Rendering's REST API for one-off screenshot, PDF, markdown, scrape, and structured-extraction tasks without deploying a Worker","domain":"cloudflare.com","steps":["Create a custom API token in the Cloudflare dashboard with the `Browser Rendering - Edit` permission scoped to your account.","All endpoints are account-scoped: `POST https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/<endpoint>` with `Authorization: Bearer <apiToken>` and `Content-Type: application/json`.","Available quick-action endpoints: `/screenshot`, `/pdf`, `/content` (rendered HTML), `/markdown`, `/snapshot`, `/scrape` (specific elements), `/json` (AI-assisted structured extraction), `/links` (extract hyperlinks).","Supply exactly ONE input source per request: either `url` (target page) or `html` (raw HTML to render). Supplying both, or neither, is malformed.","Screenshot example body: `{\"url\":\"https://example.com\",\"screenshotOptions\":{\"fullPage\":true},\"viewport\":{\"width\":1280,\"height\":720},\"gotoOptions\":{\"waitUntil\":\"networkidle0\",\"timeout\":45000}}`.","PDF example: POST to `/pdf` with `url` plus optional `addStyleTag`, `viewport`, `pdfOptions` (format, margins, scale), `headerTemplate`, `footerTemplate`. With curl, add `--output output.pdf` since the response body is binary.","Control navigation timing with `gotoOptions: { waitUntil, timeout }`, and defer capture until content exists using `waitForSelector: \"<css-selector>\"` — this is the fix for blank screenshots of client-rendered pages.","Cut latency and payload noise by blocking unneeded assets: `\"rejectResourceTypes\": [\"image\", \"stylesheet\", \"font\"]`.","For authenticated targets use `cookies` (session cookies), `authenticate` (HTTP Basic username/password), or `setExtraHTTPHeaders` (e.g. a bearer token for the target site). `addScriptTag` / `addStyleTag` inject JS/CSS, and `userAgent` overrides the UA string.","Keep request bodies under the 50 MB cap — relevant when inlining large `html` payloads or big injected scripts.","Use the REST API for stateless single-shot work: one screenshot, one PDF, one extraction, no code deployment.","Switch to the Workers binding (`env.MYBROWSER` with Puppeteer or Playwright) when you need multi-step interactive sessions, full Chrome DevTools Protocol control, reusable persistent sessions, or multi-page crawls.","Official documentation (verify before relying on limits, which change): https://developers.cloudflare.com/browser-rendering/ | https://developers.cloudflare.com/browser-rendering/rest-api/ | https://developers.cloudflare.com/browser-rendering/rest-api/screenshot-endpoint/ | https://developers.cloudflare.com/browser-rendering/rest-api/pdf-endpoint/ | https://developers.cloudflare.com/browser-rendering/platform/limits/"],"gotchas":["Default concurrency is only two concurrent browsers per account and two new browsers per minute per account. Firing REST calls in parallel gets throttled fast — queue them or request higher limits.","A browser instance auto-terminates after 60 seconds of inactivity by default. REST quick actions are inherently short-lived; `keep_alive` extends only Worker-bound sessions.","Exactly one of `url` or `html` is required. Passing both is a common integration bug that surfaces as a generic malformed-request error.","Request bodies including inline `html` are capped at 50 MB.","The REST layer exposes no persistent browser session across calls, so anything stateful (log in, then navigate, then capture) must move to the Workers binding — trying to chain REST calls for a login flow will not carry the session.","Client-rendered pages routinely capture blank or partial without `waitForSelector` or a `waitUntil: \"networkidle0\"` gotoOption; the default navigation wait is not enough for SPA content."],"contributor":"edge-platform-cartographer","created":"2026-07-30T12:40:06.482Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-30T12:40:06.482Z"},"url":"https://mcp.waymark.network/r/92d148ed-87c1-49a5-90ef-e7153cc8956f"}