Features & API Reference.

Complete reference for all 28 API route modules.

POST /api/chat, POST /api/chat/stream

Send a message to an agent. Body: { message, userId, agentId?, history?, channel? }. The blocking endpoint returns { success, response, toolCalls, tokens, iterations, sentiment }. The streaming endpoint returns an SSE stream with events: status, token, tool_call, done. Memory extraction fires async after every response.

GET/POST/PATCH/DELETE /api/agent-config

Manage agent configurations. Each config has: name, role, systemPrompt, voiceId, firstMessage, knowledgeBaseSources, assignedPhoneNumber, whatsappNumber, transferPhoneNumber, canvasState, guardrails, customTools, isActive. Stored in agent_configurations table.

GET /api/templates, POST /api/templates/:id/clone

List all published agent templates (agent_templates table). Clone a template to create a user_agent. The clone endpoint copies the template's systemPrompt, skills, and tools into a new user_agents row with the requesting userId.

GET /api/credits, POST /api/credits/purchase

Get current credit balance and transaction history from credit_transactions. Purchase credits using a credit plan from credit_plans. Stripe integration handles payment processing via STRIPE_SECRET_KEY.

GET /api/marketplace, POST /api/marketplace/:id/install

Browse community templates from marketplace_templates. Filter by category, sort by rating or downloads. Install a template to add it to the user's agent skill set. Reviews stored in marketplace_reviews.

POST /api/orchestrator/route

Route a message to the best-fit agent using LLM intent classification. Body: { message, userId, availableAgents }. Returns { selectedAgent, confidence, reasoning }. Used by the dashboard to automatically select the right agent for a task.

POST /api/alpha/*

Advanced reasoning endpoints. /api/alpha/sales for negotiation strategy. /api/alpha/legal for contract analysis. /api/alpha/strategy for competitive analysis. /api/alpha/finance for financial modeling. Each uses a specialized Claude system prompt with extended reasoning.

GET/POST /api/canvas

Manage Canvas UI workflows. GET retrieves the visual node graph for an agent configuration. POST saves a new state machine configuration, which gets injected as workflow rules for the agent.

GET/POST /api/brain-graph

Interact with the Memgraph knowledge graph. GET /api/brain-graph/stats retrieves total node and edge counts. Other endpoints are used by the Code Review Graph and Memory extraction pipelines to trace dependencies.

GET/POST /api/memory

Read and write agent memory. Combines simple entity extraction with Brain-Graph relation building.

GET/POST/PUT /api/workspace

Manage workspace files. GET returns all active files for a userId. POST creates a new file. PUT updates an existing file. Files are stored in workspace_files with userId, companyId, filename, content, and isActive flag.

GET/POST /api/inbox

Agent-to-agent messaging. GET returns messages for a userId filtered by status and priority. POST sends a message from one agent to another. Messages stored in inbox_messages with fromAgent, toAgent, subject, body, priority, status.

GET/POST /api/decisions

Human-in-the-loop approvals. GET returns pending decisions for a userId. POST approves or rejects a decision (body: { decisionId, action: "approve"|"reject" }). Stored in pending_decisions with decisionType, context, status, resolvedAt.

GET /api/dashboard

Aggregated business metrics. Returns: totalAgents, activeAgents, totalContacts, salesClosed, winRate, totalJobs, credits, recentActivity. Queries multiple tables and returns a single dashboard payload.

GET/POST /api/skills

List and manage skills. GET returns all skills filtered by category and isBuiltin. POST installs a skill to an agent (updates user_agents.skills array). Skills stored in skills table with name, description, category, emoji, requiresAuth, config.

GET/PUT /api/settings

User settings and preferences. GET returns the full users row for the authenticated user. PUT updates preferences JSON (theme, notifications, BYOK API keys, onboarding state, trust rules, dashboard tile configuration).

POST /api/feedback

Submit feedback on agent responses. Body: { messageId, rating, comment }. Used to improve agent quality and flag problematic responses.

POST /api/onboarding

Multi-step onboarding flow. Handles business type selection, persona style, dashboard tile configuration, and initial workspace file generation. Stores onboarding state in users.preferences.onboarding.