API Quick Reference
API Quick Reference
Section titled “API Quick Reference”Authentication
Section titled “Authentication”JWT Authentication
Section titled “JWT Authentication”# LoginPOST /api/v1/auth/login{"username": "user", "password": "pass"}→ {"accessToken": "jwt...", "refreshToken": "jwt..."}
# Use tokenAuthorization: Bearer <accessToken>
API Key Authentication
Section titled “API Key Authentication”# Create keyPOST /api/v1/apikeys{"name": "my-key", "scopes": ["read:session"]}→ {"key": "pk_live_...", "id": "key-123"}
# Use keyX-API-Key: pk_live_...
REST API
Section titled “REST API”Sessions
Section titled “Sessions”POST /api/v1/sessions # Create sessionGET /api/v1/sessions # List sessionsGET /api/v1/sessions/{id} # Get sessionDELETE /api/v1/sessions/{id} # Delete session
Contexts (Browser)
Section titled “Contexts (Browser)”POST /api/v1/contexts # Create browser contextPOST /api/v1/contexts/{id}/execute # Execute browser actionDELETE /api/v1/contexts/{id} # Close browser
Example: Browser Automation
Section titled “Example: Browser Automation”# Create contextPOST /api/v1/contexts{"name": "test", "viewport": {"width": 1920, "height": 1080}}
# NavigatePOST /api/v1/contexts/{id}/execute{"action": "navigate", "params": {"url": "https://example.com"}}
# ScreenshotPOST /api/v1/contexts/{id}/execute{"action": "screenshot", "params": {"fullPage": true}}
gRPC API
Section titled “gRPC API”Service Methods
Section titled “Service Methods”// SessionServiceCreateSession(CreateSessionRequest) → SessionGetSession(GetSessionRequest) → SessionListSessions(ListSessionsRequest) → ListSessionsResponseDeleteSession(DeleteSessionRequest) → Empty
// ContextServiceCreateContext(CreateContextRequest) → ContextExecuteCommand(ExecuteCommandRequest) → ExecuteCommandResponseStreamEvents(StreamEventsRequest) → stream Event
Example Call
Section titled “Example Call”// Create sessionconst session = await client.createSession({ name: 'test-session', metadata: { user: 'john' },});
// Execute browser actionconst result = await client.executeCommand({ contextId: 'ctx-123', command: { action: 'click', params: { selector: '#button' }, },});
WebSocket API
Section titled “WebSocket API”Connection
Section titled “Connection”// Connect with JWTws://localhost:8443/ws?token=<jwt>
// Connect with API keyws://localhost:8443/ws→ {"type": "auth", "apiKey": "pk_live_..."}
Message Format
Section titled “Message Format”{ "id": "msg-123", "type": "execute", "version": "1.0", "payload": { "contextId": "ctx-123", "action": "type", "params": { "selector": "#input", "text": "hello" } }}
Common Messages
Section titled “Common Messages”// Subscribe to events{"type": "subscribe", "topic": "context:ctx-123"}
// Execute action{"type": "execute", "payload": {...}}
// Heartbeat{"type": "ping"}→ {"type": "pong"}
MCP (Model Context Protocol)
Section titled “MCP (Model Context Protocol)”// execute-api{ "tool": "execute-api", "arguments": { "method": "POST", "path": "/api/v1/contexts", "body": {"name": "browser-1"} }}
// execute-in-context{ "tool": "execute-in-context", "arguments": { "contextId": "ctx-123", "command": "screenshot", "parameters": {"fullPage": true} }}
Resources
Section titled “Resources”// List available APIs{"resource": "api-catalog"}
// Get health status{"resource": "health-status"}
Status Codes
Section titled “Status Codes”Success
Section titled “Success”200 OK
- Request succeeded201 Created
- Resource created204 No Content
- Deletion succeeded
Client Errors
Section titled “Client Errors”400 Bad Request
- Invalid input401 Unauthorized
- Missing/invalid auth403 Forbidden
- Insufficient permissions404 Not Found
- Resource not found429 Too Many Requests
- Rate limited
Server Errors
Section titled “Server Errors”500 Internal Server Error
- Server fault503 Service Unavailable
- Temporary outage
Error Response Format
Section titled “Error Response Format”{ "error": { "code": "VALIDATION_ERROR", "message": "Invalid input", "details": [{ "field": "url", "message": "Invalid URL format" }] }}
Rate Limits
Section titled “Rate Limits”Default Limits
Section titled “Default Limits”- Anonymous: 10 req/min
- Authenticated: 100 req/min
- API Key: Based on plan (100-10000 req/min)
Headers
Section titled “Headers”X-RateLimit-Limit: 100X-RateLimit-Remaining: 95X-RateLimit-Reset: 1640995200
Browser Actions
Section titled “Browser Actions”Navigation
Section titled “Navigation”navigate
- Go to URLgoBack
- Browser backgoForward
- Browser forwardreload
- Refresh page
Interaction
Section titled “Interaction”click
- Click elementtype
- Type textselect
- Select dropdownhover
- Hover element
Content
Section titled “Content”screenshot
- Capture screenshotevaluate
- Run JavaScriptcontent
- Get page HTML
Common Parameters
Section titled “Common Parameters”// Click action{"selector": "#button", "timeout": 5000}
// Type action{"selector": "#input", "text": "hello", "delay": 100}
// Screenshot{"fullPage": true, "type": "png"}
Quick Tips
Section titled “Quick Tips”- Always authenticate - All endpoints except
/health
require auth - Use appropriate protocol - REST for CRUD, WebSocket for real-time, gRPC for performance
- Handle rate limits - Implement exponential backoff
- Validate inputs - Server validates, but client validation saves requests
- Monitor health - Check
/api/v1/health
for system status