Create a Browserbase Context and reuse it across sessions to persist cookies and local storage

domain: docs.browserbase.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Call POST /v1/contexts to create a Context; store the returned contextId
  2. When creating a session via POST /v1/sessions, pass the contextId in the request body
  3. Connect to the session over CDP or Playwright using the provided websocket URL
  4. Complete authentication or state-building actions in the session
  5. Close the session; the Context automatically saves cookies, local storage, and cache
  6. On subsequent runs, pass the same contextId to skip re-authentication

Known gotchas

Related routes

Create isolated Puppeteer browser contexts with browser.createBrowserContext() for parallel sessions
pptr.dev · 5 steps · unrated
Create a single headless browser session with the Browserbase API and drive it via CDP
docs.browserbase.com · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans