Skip to main content
Getting output out of the browser: page screenshots (viewport, full page, or a single element), PDF rendering, file downloads with their bytes, and a live watch URL a human can open. CLI and cURL examples assume $RT holds a browser-small runtime id with browser b1 open (see Browser Sessions).

Endpoints

Screenshot

screenshot captures the page — the viewport by default, full_page for the whole scrollable document, or element to clip to one element. Returns {data, format, width, height} with data base64.

PDF

pdf renders a tab to PDF — invoices, reports, printable views. The tab’s target_id is in the path; read it from targets. Returns {data, format} with data base64.

Downloads

Files the page downloads are saved inside the runtime. GET /downloads lists them; POST /downloads with wait_name blocks until a file whose name contains wait_name finishes — the pattern after clicking a download link — and returns the list, or 408 after timeout_ms (default 30000). GET /downloads/{download_id} returns {entry, data} with the file’s bytes base64 in data (null with ?meta_only=true).
Each download entry is {id, filename, path, bytes, state, mime, url} — state is in progress while the file transfers, then completed or canceled. In TypeScript, downloads returns the entry array directly; in Python it returns {"downloads": [...]}.

Live view

view publishes a private watch URL for a browser — the display’s view when the browser is headed, or a screencast of the tab (target_id, empty = current tab) when it is headless. Open browser_url — it carries a one-time auth token. The token is returned only the first time a view URL is published; later calls extend expires_at (one hour) but return browser_url without it, so keep the first one.
The call returns 201 with the web-service record — browser_url, url, port, expires_at, and token (first publish only). fps defaults to 15 and caps at 30; quality is JPEG quality 1–100.

Notes

  • Screenshots, PDFs, and download bytes come back base64 — decode before writing to disk (the CLI writes files for you; cURL needs the jq | base64 -d hop).
  • For anything visible but not downloadable — chart canvases, video frames — take a screenshot; PDF is for print-formatted output.