Skip to content

API Reference

Your Name edited this page Feb 4, 2026 · 3 revisions

API Reference

Complete reference for the Luna Chat backend API. All requests except Authentication require a Bearer token.


🔐 Authentication

Headers

Authorization: Bearer <access_token>

Login

POST /api/auth/login

  • Body: { "email": "...", "password": "..." }
  • Response: { "accessToken": "...", "refreshToken": "...", "user": { ... } }

💬 Chat & Voice

Create Session

POST /api/chat/sessions

  • Body: { "mode": "assistant" | "companion" | "voice" }

Send Message (Streaming)

POST /api/chat/sessions/:id/send

  • Body: { "message": "..." }
  • Response (SSE): Includes router_metadata (Nano/Pro/Tools).

Real-time Voice (WebSocket)

WS /ws/voice

  • Protocol: Binary (PCM Audio) or JSON.
  • Handshake: Requires JWT in Authorization header or query string.
  • Features: Streaming STT (Whisper) and TTS (ElevenLabs/OpenAI).

🧠 Memory & Graph

User Facts

GET /api/abilities/facts

  • Params: category, limit, offset.

Graph Nodes (Neo4j)

GET /api/graph/nodes

  • Params: type, origin, minTrust.

Graph Relationships

GET /api/graph/edges

  • Params: sourceNodeId, targetNodeId.

🤖 Autonomous & Agents

Theater Mode (Live Thinking)

GET /api/autonomous/deliberations/live

  • Response (SSE): Live feed of Council deliberations and actions.

Agent Delegation (Sanhedrin)

POST /api/abilities/agents/execute

  • Body: { "agent": "coder" | "researcher", "task": "...", "useSanhedrin": true }

📈 Trading (Trader Luna)

Portfolio

GET /api/trading/portfolio

  • Response: Current balances across Binance and Crypto.com.

Order Execution

POST /api/trading/order

  • Body: { "symbol": "BTCUSDT", "side": "BUY", "type": "MARKET", "quantity": 0.001 }

🔌 Integrations

MCP Execution

POST /api/mcp/execute

  • Body: { "serverId": "...", "toolName": "...", "arguments": { ... } }

Telegram Link

POST /api/triggers/telegram/link

  • Response: { "code": "123-456" } (Valid for 10 minutes).

🔍 System & Activity

Activity Stream

GET /api/activity/stream

  • Response (SSE): Real-time system activity logs (Tools used, API calls, Agent status).

Metrics

GET /api/settings/metrics

  • Response: CPU, Memory, Disk, and LLM usage statistics.

Clone this wiki locally