Features & API Reference.

Reference for the API route modules. Every endpoint needs a signed-in user except the /api/webhooks routes, which verify the provider's signature instead.

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/plans · /balance/:userId · /transactions/:userId, POST /api/credits/purchase

Plans, the signed-in user's balance and their credit history. POST /purchase opens a Stripe Checkout page for a plan and returns its URL — nothing is credited there. Credits are added when Stripe confirms the payment to POST /api/webhooks/stripe (signed with STRIPE_WEBHOOK_SECRET), once per payment. Without STRIPE_SECRET_KEY, purchasing answers 503.

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/process, GET /api/orchestrator/insights/:companyId, GET /api/orchestrator/churn-risk/:companyId

POST /process classifies a message's intent and runs it through the orchestrator for the signed-in user (body: { message, … }; message is required). The two GETs return the orchestrator's business insights and churn signals for a company.

POST /api/alpha/*

Specialist reasoning endpoints, each with its own system prompt: /negotiate, /handle_objection, /sales_script, /analyze_pipeline, /competitor, /review_contract, /draft_argument, and /process (routes a request to the right one).

GET/POST /api/canvas/:agentId

An agent configuration's visual workflow. GET returns its canvasState ({ nodes, edges }); POST saves a new one, which is injected as workflow rules for that agent.

GET /api/brain-graph/:userId/{stats,nodes,edges,search,visualize}, GET /api/brain-graph/entity-types

Read the memory graph built from a user's conversations: node and edge counts, the nodes and edges themselves, a search, and a visualisation-ready graph. All read-only.

GET /api/memory/:userId, POST /api/memory/:userId/store · /search, DELETE /api/memory/:id, POST /api/memory/consolidate

Read, store, search and delete a user's memories. /consolidate compresses the raw buffer into structured memories and prunes stale entries.

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 /api/inbox/:userId/pending, POST /api/inbox/:requestId/resolve, POST /api/inbox/messages/:id/read

The owner's Inbox: approvals waiting on a decision (each with a plain-words summary) and messages from the team (with the sender's title and, for business-profile questions, a link to answer them). /resolve approves or denies — owner or admin only — and runs the approved action. Roles write to it; it has no public send endpoint.

GET /api/decisions/:userId/pending · /:userId/all · /:id, POST /api/decisions/:id/approve · /:id/deny

Decisions an agent paused on (pending_decisions): list the pending ones or all of them, read one, and approve or deny it.

GET /api/dashboard/:userId

The overview's numbers for the signed-in user (the path segment is ignored): credits, leads in the pipeline (total, new, talking or booked, and per stage), media created, and recent activity. Answers 503 — never zeros — when the numbers cannot be read.

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/:userId, POST /api/settings/:userId/api-key, GET/DELETE /api/settings/:userId/api-key/:service

The signed-in user's settings and preferences (the path segment is ignored). Saved API keys are encrypted at rest and never returned — only whether one is configured and its last four characters.

POST /api/feedback

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

GET /api/onboarding/presets · /status/:uid, POST /api/onboarding/complete · /sync-user

/complete creates the account if needed, writes the workspace files, seeds memory, and puts the answers — and the Google Maps listing the owner picked, if any — into the business profile (GET /api/profile), which every role works from.