OpenQAOpenQA
API Reference

Brain API

API endpoints for controlling the autonomous Brain.

POST/api/brain/analyze

Analyze the application and get suggestions without running tests

Response
{
  "understanding": "E-commerce app with user auth, catalog, cart, checkout",
  "techStack": {
    "framework": "Next.js 14",
    "database": "PostgreSQL",
    "auth": "NextAuth.js"
  },
  "suggestedTests": [
    "Test cart persistence across sessions",
    "Test checkout validation with invalid cards",
    "Test product search functionality"
  ],
  "suggestedAgents": [
    "Payment Flow Specialist",
    "Inventory Checker"
  ],
  "risks": [
    "Cart race conditions",
    "Payment double-charge"
  ]
}
POST/api/brain/run

Start a full autonomous testing session

Response
{
  "sessionId": "session_abc123",
  "status": "started",
  "message": "Autonomous testing session started"
}
POST/api/brain/generate-test

Generate a specific test

Request Body
{
  "type": "security",
  "target": "Login form SQL injection",
  "context": "The login form at /login accepts email and password"
}
Response
{
  "testId": "test_xyz789",
  "name": "test_login_sql_injection.spec.ts",
  "type": "security",
  "code": "import { test, expect } from '@playwright/test';..."
}
POST/api/brain/create-agent

Create a custom specialized agent

Request Body
{
  "purpose": "Test the multi-step checkout process with various payment methods"
}
Response
{
  "agentId": "agent_def456",
  "name": "Checkout Flow Tester",
  "purpose": "Test the multi-step checkout process with various payment methods",
  "status": "created"
}
POST/api/brain/run-test/:id

Execute a specific test by ID

Response
{
  "testId": "test_xyz789",
  "status": "running",
  "startedAt": "2024-01-15T10:30:00Z"
}

Test Types

TypeDescription
unitIsolated function/component tests
functionalUser workflow tests
e2eComplete user journey tests
securitySQL injection, XSS, auth bypass
regressionBug fix verification
performanceLoad times, resource usage