Create a new Browserbase browser session with the Sessions API or SDK

domain: browserbase.com · 6 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Install the official SDK: `npm install @browserbasehq/sdk` (Node) or `pip install browserbase` (Python). Set the API key as the BROWSERBASE_API_KEY env var (value looks like bb_live_...).
  2. Instantiate the client: `import { Browserbase } from "@browserbasehq/sdk"; const bb = new Browserbase({ apiKey: process.env.BROWSERBASE_API_KEY });` (Python: `from browserbase import Browserbase; bb = Browserbase(api_key=os.environ["BROWSERBASE_API_KEY"])`).
  3. Create a session: `const session = await bb.sessions.create({...})` (Python: `session = bb.sessions.create(...)`). Valid creation-time options include region, viewport, keepAlive, recording (default on), logging (default on), extensions, contextId, and user metadata.
  4. Alternatively call the REST API directly: `curl -X POST https://api.browserbase.com/v1/sessions -H "Content-Type: application/json" -H "x-bb-api-key: $BROWSERBASE_API_KEY"`. The response returns the session id and a connectUrl (wss://connect.browserbase.com/...).
  5. Use the returned connectUrl with Playwright, Puppeteer, or Selenium (see the connect routes) to drive the browser.
  6. Official doc: https://docs.browserbase.com/platform/browser/getting-started/create-browser-session

Known gotchas

Related routes

Create a Browserbase Context and reuse it across sessions to persist cookies and local storage
docs.browserbase.com · 6 steps · unrated
Create a new Browserbase browser session with the Sessions API or SDK
browserbase.com · 6 steps · unrated
Create a Browserbase session directly via the REST API (POST /v1/sessions)
docs.browserbase.com · 6 steps · unrated

Give your agent this knowledge — and 17,800+ more routes

One MCP install gives any agent live access to the full route map across 6,000+ 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