SDKs
Official clients for TypeScript, Python, and Go — the same small surface in each language. All of them read BROWSERVIEW_API_KEY (and optionally BROWSERVIEW_BASE_URL) from the environment by default, retry rate-limited requests automatically, and time out after 60s.
TypeScript
Terminal
npm install @browserview/typescriptexample.ts
import { BrowserView } from "@browserview/typescript";import { chromium } from "playwright"; const bv = new BrowserView(); // reads BROWSERVIEW_API_KEY const session = await bv.sessions.create({ startUrl: "https://example.com",});console.log("watch it live:", session.viewer_url); const browser = await chromium.connectOverCDP(session.cdp_url, { headers: { "x-session-token": session.cdp_token },});const page = browser.contexts()[0].pages()[0];await page.goto("https://news.ycombinator.com"); await bv.sessions.destroy(session.id);Python
Terminal
pip install browserviewexample.py
from browserview import BrowserViewfrom playwright.sync_api import sync_playwright bv = BrowserView() # reads BROWSERVIEW_API_KEY session = bv.create_session(start_url="https://example.com")print("watch it live:", session.viewer_url) with sync_playwright() as p: browser = p.chromium.connect_over_cdp( session.cdp_url, headers={"x-session-token": session.cdp_token}, ) page = browser.contexts[0].pages[0] page.goto("https://news.ycombinator.com") bv.destroy_session(session.id)Go
Terminal
go get github.com/browserview/gomain.go
package main import ( "context" "fmt" browserview "github.com/browserview/go") func main() { client, err := browserview.NewFromEnv() // reads BROWSERVIEW_API_KEY if err != nil { panic(err) } session, err := client.CreateSession(context.Background(), browserview.CreateSessionOptions{StartURL: "https://example.com"}) if err != nil { panic(err) } fmt.Println("watch it live:", session.ViewerURL) defer client.DestroySession(context.Background(), session.ID) // Drive session.CDPURL with chromedp, rod, or any CDP client.}Session replay
Create a session with record: true and fetch its replay after it ends — every SDK ships a waitForReplay helper that polls through finalization (typically under 30 seconds). See the session replay guide for the manifest schema.
const session = await bv.sessions.create({ startUrl: "https://example.com", record: true,});// ... drive the session ...await bv.sessions.destroy(session.id); const replay = await bv.sessions.waitForReplay(session.id);console.log(replay.video?.url); // seekable WebM of the whole sessionconsole.log(replay.events); // actions / console / network / errors JSONL // Python: bv.wait_for_replay(session.id)// Go: client.WaitForReplay(ctx, session.ID, 0)Error handling
All three SDKs raise a typed error carrying the HTTP status and the API's detail message. A 429 additionally carries the parsed Retry-After value so your queue can back off precisely.
try { await bv.sessions.create();} catch (error) { if (error instanceof BrowserViewError && error.status === 429) { await sleep(error.retryAfter * 1000); }}