AbstractSend a raw HTTP request to the Browser Run API.
Used by libraries like @cloudflare/puppeteer to acquire and connect to a browser instance.
Optionalinit: RequestInit<CfProperties<unknown>>Take a screenshot of a web page.
Must be 'screenshot'.
Screenshot options including viewport, selectors, and image format.
A Response containing one of:
Success (HTTP 200):
Content-Type: image/png, image/jpeg, or image/webp (when encoding: 'binary', the default)Content-Type: text/plain (when encoding: 'base64')Error:
BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)Headers:
X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)Generate a PDF of a web page.
Must be 'pdf'.
PDF generation options including page size, margins, and headers/footers.
A Response containing one of:
Success (HTTP 200):
Content-Type: application/pdfError:
BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)Headers:
X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)Get the HTML content of a web page.
Must be 'content'.
Navigation and page interaction options.
A Response containing one of:
Success (HTTP 200):
BrowserRunContentSuccessResponse JSON with Content-Type: application/jsonError:
BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)Headers:
X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)Scrape elements from a web page by CSS selector.
Must be 'scrape'.
Scrape options with CSS selectors for elements to extract.
A Response containing one of:
Success (HTTP 200):
BrowserRunScrapeSuccessResponse JSON with Content-Type: application/jsonError:
BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)Headers:
X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)Extract all links from a web page.
Must be 'links'.
Options to filter visible or internal links only.
A Response containing one of:
Success (HTTP 200):
BrowserRunLinksSuccessResponse JSON with Content-Type: application/jsonError:
BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)Headers:
X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)Get both the HTML content and a base64-encoded screenshot of a web page.
Must be 'snapshot'.
Snapshot options including screenshot settings (encoding is always base64).
A Response containing one of:
Success (HTTP 200):
BrowserRunSnapshotSuccessResponse JSON with Content-Type: application/jsonError:
BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)Headers:
X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)Extract structured JSON data from a web page using AI.
Must be 'json'.
JSON extraction options with prompt or response_format schema.
A Response containing one of:
Success (HTTP 200):
BrowserRunJsonSuccessResponse JSON with Content-Type: application/jsonError:
BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)2012 for HTML-to-markdown conversion failuresrawAiResponse field)Headers:
X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)Convert a web page to Markdown.
Must be 'markdown'.
Navigation and page interaction options.
A Response containing one of:
Success (HTTP 200):
BrowserRunMarkdownSuccessResponse JSON with Content-Type: application/jsonError:
BrowserRunErrorResponse JSON with appropriate HTTP status code (400, 422, 429, 500, 503)2012 for HTML-to-markdown conversion failuresHeaders:
X-Browser-Ms-Used: Browser time consumed in milliseconds (set when status < 500)
Browser Run API binding for automating headless browsers.
See
https://developers.cloudflare.com/browser-run/