Overview
The/browser endpoint fetches a URL with full JavaScript rendering. Unlike /fetch (which returns the raw HTTP response), /browser waits for dynamic content and returns the fully rendered page.
When to use /browser instead of /fetch:
- The page requires JavaScript to load content (SPAs, dynamic sites)
- You need all cookies, including those set by client-side scripts
- You want to execute custom JavaScript to extract data
- You need a screenshot of the rendered page
/fetch (meta, raw, raw_json), with additional fields for cookies, screenshots, and JS evaluation results.
Endpoint
/fetch — all parameters are passed via headers.
Request headers
| Header | Required | Default | Description |
|---|---|---|---|
X-API-Key | Yes | — | Your API key |
X-Target-URL | Yes | — | Target URL to render |
X-Wait-Strategy | No | load | load, networkidle, or selector (details) |
X-Wait-Selector | No | — | CSS selector to wait for (with selector strategy) |
X-Timeout | No | 30 | Timeout in seconds (max 120) |
X-JS-Expression | No | — | JavaScript to evaluate after the page is ready |
X-Screenshot | No | false | Capture screenshot (1 or true) |
X-Expect-Selector | No | — | CSS selector that must exist — retries on a different node if missing |
X-Expect-Contains | No | — | Substring that must exist in the body — retries if missing |
X-Proxy | No | — | Route through a proxy (http:// or socks5://) |
X-Block-Resources | No | — | Comma-separated resource types to block: image,font,stylesheet,media |
X-Geo | No | — | Country filter for node selection (e.g. US, DE,AT) |
X-Agent | No | — | Pin to a specific node (e.g. de1, us3) |
Cookie | No | — | Cookies to inject (name=value; name2=value2) |
X-Cookies | No | — | Cookies as JSON array for full control (format) |
Wait strategies
| Strategy | Description |
|---|---|
load | Wait for DOMContentLoaded event (fastest, works for server-rendered pages) |
networkidle | Wait until there are no more than 2 network connections for 500ms (best for SPAs) |
selector | Wait for X-Wait-Selector to appear in the DOM (most precise for specific content) |
Cookies
Simple cookies — use the standardCookie header:
X-Cookies header with a JSON array when you need domain, path, or httpOnly control:
name, value, domain, path, secure, httpOnly, sameSite, expires.
Resource blocking
Block specific resource types to speed up rendering:Response
| Field | Description |
|---|---|
meta | Same as /fetch — status, final URL, headers, timing, node ID |
raw | Rendered page body as text (HTML or other). null if body was valid JSON |
raw_json | Parsed JSON object if the response was valid JSON, otherwise null |
cookies | All cookies set during rendering, including httpOnly cookies |
screenshot | Base64-encoded PNG of the full page (null if not requested) |
js_result | Return value of X-JS-Expression (null if not provided) |
Response validation
UseX-Expect-Selector and X-Expect-Contains to verify the rendered page has the content you expect. If validation fails, the API automatically retries on a different node before returning an error.
Examples
Render a JavaScript-heavy page
Wait for specific content
Extract data with JavaScript
js_result field in the response contains the return value:
Capture a screenshot
With cookies
Route through a proxy
Validate response content
If the page doesn’t contain the expected content, the API retries on a different node:Python
JavaScript
Browser Stream (SSE)
For live, long-running sessions, use/browser/stream. Instead of capturing a single snapshot, the browser stays open and streams events in real-time via Server-Sent Events.
Use cases:
- Capture WebSocket frames that the page receives (live data feeds)
- Monitor network API calls the page makes (XHR/Fetch responses)
- Watch DOM elements for changes (price updates, content changes)
Endpoint
Headers
Same headers as/browser, plus:
| Header | Default | Description |
|---|---|---|
X-Capture | network,ws,console | Comma-separated event types to stream |
X-DOM-Selector | — | CSS selector to watch for DOM mutations (requires dom in capture) |
X-Network-Filter | — | Regex filter for network URLs (only matching are streamed) |
X-WS-Filter | — | Regex filter for WebSocket URLs (only matching are streamed) |
X-JS-After-Load | — | JavaScript to execute after page load (e.g. click a button, trigger navigation) |
SSE events
| Event | Description |
|---|---|
connected | Browser loaded, streaming started (includes cookies) |
network | HTTP response captured (XHR/Fetch) — includes body, status, content-type |
ws_open | Page opened a WebSocket connection |
ws_message | WebSocket frame received by the page |
ws_close | Page WebSocket closed |
dom | DOM mutation on watched selector |
console | Console output (warn/error) |
error | Error, stream ends |
done | Session ended (timeout or closed) |
Example: Capture page WebSocket feed
Example: Monitor network API calls
Example: Watch DOM element for changes
Python
Next steps
HTTP Fetch
For pages that don’t need JavaScript rendering, use the faster
/fetch endpoint.Error handling
Status codes, block detection, and retry strategies.