Quick Start

Browser Forest is a cloud browser API platform that provides anti-detection browser services for developers and AI agents. Create and control browser sessions through a simple REST API, with support for persistent Contexts, proxy configuration, and web scraping.

1. Login & Get API Key

Log in via browser (enterprise email, GitHub, or Google OAuth), then create an API Key on the Settings page:

# Log in and create an API Key on the Settings page
# Format: bf_live_xxxxxxxxxxxxxxxx

2. Launch a Browser Session

curl -X POST https://bf.mktindex.com/api/v1/sessions \
  -H "X-API-Key: bf_live_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{}'

# Returns:
{
  "id": "ses_xxxx",
  "cdpUrl": "wss://bf.mktindex.com/ws/session/ses_xxxx",
  "status": "running"
}

3. Control the Browser via CDP

Use cdpUrl to connect via Chrome DevTools Protocol. Works with Puppeteer, Playwright, or any CDP client:

import puppeteer from 'puppeteer-core';

const browser = await puppeteer.connect({
  browserWSEndpoint: 'wss://bf.mktindex.com/ws/session/ses_xxxx',
});

const page = await browser.newPage();
await page.goto('https://example.com');
const title = await page.title();
console.log(title); // "Example Domain"

await browser.disconnect();

4. Stop the Session

curl -X DELETE https://bf.mktindex.com/api/v1/sessions/ses_xxxx \
  -H "X-API-Key: bf_live_xxxxxxxxxxxx"

Using the Node.js SDK

We recommend using the official SDK for simpler workflows:

npm install @browser-forest/sdk
import { BrowserForestClient } from '@browser-forest/sdk';

const client = new BrowserForestClient({ apiKey: 'bf_live_xxxx' });

const session = await client.sessions.create({});
console.log(session.cdpUrl); // wss://...

// Connect to the browser
const browser = await puppeteer.connect({
  browserWSEndpoint: session.cdpUrl,
});

// ... operate the browser ...

await client.sessions.stop(session.id);

5. Cookie API (Session State Migration)

No need to hand-write CDP — directly export/inject cookies from active Sessions, or write them to a Context for automatic restoration on the next Session. See Sessions and Contexts docs for details; see Web Scraping use case for approach C.

# Inject cookies into an active Session
curl -X PUT https://bf.mktindex.com/api/v1/sessions/ses_xxxx/cookies \
  -H "X-API-Key: bf_live_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"cookies": [{"name":"token","value":"...","domain":".example.com","path":"/"}]}'

# Write to Context (auto-injected on next session create)
curl -X PUT https://bf.mktindex.com/api/v1/contexts/ctx_xxxx/cookies \
  -H "X-API-Key: bf_live_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"cookies": [ ... ]}'
Note: API Base URL: https://bf.mktindex.com/api/v1. Test environment: bftest.mktindex.com (new features are validated here first). Example scripts in repo: test/pm-agent-login.py, test/cookie-api-test.py (configure via test/.env.example).