Skip to main content
The @bctrl/sdk package provides a TypeScript client for the BCTRL platform. It covers session management, browser profiles, AI agents, script execution, credential vault, file storage, and extension management. By default it targets https://api.bctrl.ai; use environment: 'development' for a local control plane on http://localhost:3000.

Installation

npm install @bctrl/sdk

Authentication

Set your API key via environment variable or pass it directly:
export BCTRL_API_KEY=your_api_key

Quick Start

import { Bctrl } from '@bctrl/sdk';

const bctrl = new Bctrl({ apiKey: process.env.BCTRL_API_KEY! });
// For local development: new Bctrl({ apiKey: process.env.BCTRL_API_KEY!, environment: 'development' })

// One-shot execution (simplest)
const result = await bctrl.execute({
  fn: async ({ page }) => {
    await page.goto('https://example.com');
    return page.title();
  },
});

// Or create a reusable session
const session = await bctrl.session.playwright();
await session.page.goto('https://example.com');
await session.stop();

Reference

SectionDescriptionEndpoints
SessionsEphemeral browser sessionsPOST /v1/sessions, GET /v1/sessions, etc.
ProfilesPersistent browsers with fingerprintsPOST /v1/profiles, GET /v1/profiles, etc.
AI AgentsStagehand & Browser-use AIPOST /v1/sessions/{id}/automation
CaptchaDetect and solve captchasPOST /v1/sessions/{id}/automation
ExecuteOne-shot script executionPOST /v1/sessions/{id}/automation
VaultCredential & TOTP managementGET /v1/vault, GET /v1/vault/{key}, PUT /v1/vault/{key}, DELETE /v1/vault/{key}
StorageWorkspace file storagePOST /v1/storage/objects, GET /v1/storage/objects, DELETE /v1/storage/objects
ExtensionsBrowser extension managementPOST /v1/extensions/upload, GET /v1/extensions, DELETE /v1/extensions/{id}