cURL
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>" }
Connect a browser driver to an existing session
playwright
puppeteer
stagehand
selenium
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();
{ "id": "sess_abc123", "hostId": "host_1", "currentDriver": "playwright", "defaultContextId": "ctx_1", "defaultPageId": "page_1", "storageWorkspace": "Default" }