API Endpoint
GET /screenshot
Captures a PNG screenshot of the specified URL.The website URL to screenshot (must be http or https)
Example Request
Success Response
Returns a PNG image with the following headers:Error Response
Human-readable error message
Error code indicating the failure type
Error Codes
400— Missing or invalidurlparameter (not http/https)502— Screenshot operation failed (navigation timeout, unreachable site, rendering error)
Implementation Details
The API uses the following configuration:- Viewport: 1280x800 pixels
- Wait condition:
networkidle0(waits until network is idle) - Navigation timeout: 20 seconds
- Image format: PNG
Deployment
Enable Browser Rendering
This experiment requires Cloudflare Browser Rendering to be enabled on your account. Visit the Browser Rendering docs for setup instructions.
Local Development
Use
--remote flag to access a real browser instance. Local development without this flag will not work as Browser Rendering requires Cloudflare infrastructure.Cloudflare Features Used
- Workers — Edge compute runtime
- Browser Rendering — Headless Chromium via Puppeteer
- Fetch API — Network requests within the browser