Skip to content

API Reference

All endpoints are served by the Purple8 gateway on port 8081 in development. Every authenticated request must include a valid Bearer token from /api/v1/auth/login.

Base URL: http://localhost:8081

Authentication

POST /api/v1/auth/login

Obtain a JWT access token.

json
// Request
{ "username": "user@example.com", "password": "s3cret" }

// Response
{ "access_token": "eyJ...", "token_type": "bearer", "expires_in": 3600 }
EndpointMethodDescription
/api/v1/auth/loginPOSTObtain JWT
/api/v1/auth/meGETCurrent user profile and roles
/api/v1/auth/logoutPOSTInvalidate token
/api/v1/auth/refreshPOSTExchange near-expired token

POST /pipeline/v2/stream

Start a build session. Returns text/event-stream.

json
{
  "prompt": "Build a FastAPI CRUD app with PostgreSQL and JWT auth",
  "goal": "prototype",
  "mode": "plus",
  "hitl_enabled": true,
  "hitl_phases": ["planning"],
  "project_name": "my-crud-api"
}
FieldValues
goalprototype · mvp · production
modestandard · plus

SSE events emitted:

event: phase_start
data: {"phase": "planning", "agents": ["IdeationAgent", "ArchitectureAgent"]}

event: agent_output
data: {"agent": "IdeationAgent", "content": "...", "tokens": 412}

event: checkpoint
data: {"checkpoint_id": "chk_a1b2c3", "phase": "planning", "type": "hitl"}

event: phase_complete
data: {"phase": "planning", "duration_s": 28.4}

event: build_complete
data: {"project_name": "my-crud-api", "files": 47, "lines": 3820, "ctq_score": 84}
EndpointMethodDescription
/pipeline/v2/streamPOSTStart session (SSE)
/pipeline/v2/sessionsGETList sessions
/pipeline/v2/session/{id}GETSession detail and outputs
/pipeline/v2/session/{id}DELETECancel or delete session
/pipeline/v2/checkpoint/{id}/resolvePOSTResume HITL checkpoint

Checkpoint resolve body: { "action": "approve" | "reject" | "modify", "feedback": "..." }


BRD Generation

EndpointMethodDescription
/api/brd/generatePOSTGenerate a full BRD from a description
/api/brd/enhancePOSTRefine an existing BRD
json
// POST /api/brd/generate
{
  "project_name": "customer-portal",
  "description": "A self-service portal for customers to manage subscriptions",
  "include_sections": ["executive_summary", "functional_requirements", "data_model"]
}

IDE Copilot

Edit Mode

EndpointMethodDescription
/api/ide/copilot/edit/completePOSTInline code completion at cursor
/api/ide/copilot/edit/actionPOSTNamed action (explain, refactor, add-tests)
/api/ide/copilot/edit/suggestPOSTSuggest improvements for selected code

Agent Mode

EndpointMethodDescription
/api/ide/copilot/agent/chatPOSTChat message + response
/api/ide/copilot/agent/chat/streamPOSTStreaming chat (SSE)

Quick Actions

EndpointMethodDescription
/api/ide/copilot/quick/explainPOSTExplain selected code
/api/ide/copilot/quick/fixPOSTSuggest fix for an error

Sandbox

EndpointMethodDescription
/api/sandbox/sessionsPOSTCreate sandbox session
/api/sandbox/sessionsGETList active sessions
/api/sandbox/sessions/{id}GETSession status and logs
/api/sandbox/sessions/{id}DELETETerminate session
/api/sandbox/sessions/{id}/launchPOSTExecute command in sandbox
/api/sandbox/sessions/from-project/{name}GETGet or create session for project
json
// POST /api/sandbox/sessions
{ "runtime": "python3.12", "project_name": "my-crud-api", "timeout_seconds": 300 }

// POST /api/sandbox/sessions/{id}/launch
{ "command": "pytest tests/ -v --tb=short", "cwd": "/workspace" }

runtime values: python3.12 · node20


Git Integration

EndpointMethodDescription
/api/git/statusGETWorking tree status
/api/git/diffGETUnstaged changes
/api/git/stagePOSTStage files
/api/git/commitPOSTCommit staged files
/api/git/quick-commitPOSTStage all + commit in one call
/api/git/branchGETList branches
/api/git/pushPOSTPush to remote

Promotion

EndpointMethodDescription
/promotion/statusGETPromotion status across environments
/promotion/checkPOSTValidate project is ready to promote
/promotion/requestPOSTRequest promotion to next environment
/promotion/approvePOSTApprove request (admin / lead)
/promotion/rejectPOSTReject request with reason
/promotion/executePOSTExecute approved promotion
/promotion/rollbackPOSTRoll back most recent promotion
/promotion/environmentsGETAll configured environments

Quality / CTQ

EndpointMethodDescription
/quality/portfolioGETCTQ summary across all projects
/quality/project/{name}GETFull CTQ scorecard
/quality/ctq-scorecardGETAggregate platform metrics
/quality/trendsGETHistorical CTQ data
/quality/refreshPOSTTrigger a fresh quality scan

Memory

EndpointMethodDescription
/api/memory/memoriesPOSTStore a memory
/api/memory/memoriesGETList memories (?project=&tags=&limit=)
/api/memory/memories/{id}DELETEDelete a memory
/api/memory/memories/searchGETSemantic search (?q=&project=)
/api/memory/memories/recentGETRecently accessed memories

Checkpoints

EndpointMethodDescription
/api/checkpointsGETList checkpoints (?session_id=&status=)
/api/checkpoints/{id}GETCheckpoint detail
/api/checkpoints/resumable-tasksGETSessions awaiting HITL input
/api/checkpoints/{id}DELETEDismiss checkpoint

Observability

EndpointMethodDescription
/api/observability/agentsGETPer-agent execution metrics
/api/observability/system-metricsGETCPU, memory, container health
/api/observability/logsGETStructured log stream
/api/observability/tracesGETDistributed traces per session
/api/observability/coverageGETTest coverage across all projects
/api/observability/run-testsPOSTTrigger test suite, stream results

Pipeline v1 (Legacy)

EndpointMethodDescription
/pipeline/runPOSTRun full pipeline synchronously
/pipeline/ideatePOSTRun ideation phase only
/pipeline/ideate/approvePOSTApprove ideation, start implementation
/pipeline/register-promptPOSTSave prompt to memory store

Purple8 Builder is proprietary software. All rights reserved.