Relevant source files
The following files were used as context for generating this wiki page:
- apps/api/src/browserbase/browserbase.service.ts
- apps/api/src/browserbase/browserbase.controller.ts
- apps/api/src/device-agent/schemas/device-agent-operations.ts
- apps/api/src/browserbase/dto/browserbase.dto.ts
- apps/api/src/device-agent/device-agent.controller.ts
- apps/api/src/device-agent/device-agent.service.ts
- apps/api/src/health/health.controller.ts
- apps/api/src/health/health.module.ts
- apps/api/src/device-agent/scripts/common.ts
- apps/api/src/devices/devices.controller.ts
- apps/api/src/devices/devices.service.ts
- apps/api/src/lib/fleet.service.ts
This document outlines the various operational endpoints exposed by the API, covering browser automation, device agent management, device listing, and health checks. These endpoints facilitate interaction with external services like Browserbase HQ and internal device management systems, providing functionalities ranging from automated browser tasks to device monitoring and agent distribution.
The API is structured using NestJS controllers and services, with authentication handled by HybridAuthGuard and organization context managed via X-Organization-Id headers or API keys.
Browser Automation Endpoints
The Browser Automation endpoints provide a comprehensive interface for managing and executing automated browser tasks using Browserbase HQ. This includes managing organization-specific browser contexts, controlling browser sessions, performing navigation, and handling the lifecycle of browser automations and their execution runs.
Architecture
The BrowserbaseController exposes the API endpoints, which delegate business logic to the BrowserbaseService. The service interacts with the @browserbasehq/sdk and @browserbasehq/stagehand libraries, as well as an S3 client for screenshot storage and a Prisma client (@trycompai/db) for persistence of automation configurations and run history.
A Browserbase context represents a persistent browser environment for an organization. It allows sessions to share cookies, local storage, and other browser data, enabling consistent authentication and state across multiple automation runs.
API Endpoints
The BrowserbaseController (/browserbase) provides the following endpoints:
| Method | Path | Summary | Description | DTOs (Request/Response) |
|---|---|---|---|---|
/browserbase/org-context | POST | Get or create organization browser context | Gets the existing browser context for the org or creates a new one. | Request: {} (Implicitly uses X-Organization-Id header) Response: ContextResponseDto |