Skip to main content
POST
/
v1
/
sessions
/
{id}
/
connect
Connect Driver
curl --request POST \
  --url https://api.bctrl.ai/v1/sessions/{id}/connect \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "driver": "<string>"
}
'
{
  "id": "<string>",
  "hostId": "<string>",
  "currentDriver": "<string>",
  "defaultContextId": "<string>",
  "defaultPageId": "<string>",
  "storageWorkspace": "<string>"
}
id
string
required
Session ID.
driver
string
Optional driver: playwright, puppeteer, stagehand, or selenium. Defaults to playwright when omitted.

Examples

import { Bctrl } from '@bctrl/sdk';
const bctrl = new Bctrl({ apiKey: process.env.BCTRL_API_KEY! });

// Raw sessions API
const started = await bctrl.sessions.start();
const response = await bctrl.sessions.connect(started.id); // defaults to playwright

// High-level convenience
const defaultSession = await bctrl.session(); // defaults to playwright
const pw = await bctrl.session.playwright();
const pptr = await bctrl.session.puppeteer();
const sh = await bctrl.session.stagehand();
const sel = await bctrl.session.selenium();

Response

id
string
required
Session ID.
hostId
string
required
Host ID.
currentDriver
string
required
Connected driver.
defaultContextId
string
Default browser context ID.
defaultPageId
string
Default page ID.
storageWorkspace
string
Resolved storage workspace for the session.
Response Example
{
  "id": "sess_abc123",
  "hostId": "host_1",
  "currentDriver": "playwright",
  "defaultContextId": "ctx_1",
  "defaultPageId": "page_1",
  "storageWorkspace": "Default"
}