Note: If OpenLoomi readiness is unknown, use openloomi-setup first. If OpenLoomi Desktop is not installed, follow Getting Started.
OpenLoomi API Documentation
API Modules
OpenLoomi ships a local-first HTTP API served from the desktop app (port 3414, fallback 3515). All auth, Memory, AI, RAG, Loop, and Audit data live in a local SQLite database — your data stays on your machine and the OpenLoomi app is the source of truth. The only externally-routed auth path is the Composio OAuth broker that backs the Slack, GitHub, Google, Notion, Linear, HubSpot, LinkedIn, Jira, and Asana Connectors (see openloomi-connectors).
The remote-auth prefix is historical — those routes once proxied to a cloud server; today they are the canonical local endpoints, and the Claude/Codex plugin bridge uses /api/remote-auth/user as a port-discovery + auth-handshake probe.
This reference covers 131 route handlers under 36 top-level /api/* modules. Pair it with openloomi-loop (Loop state, decisions, channels, classifier rules, brief/wrap) and openloomi-memory (Memory search, KB, insights, entities, living connections) for the runtime surfaces used by Chat and Loop.
Functional Modules
| Module |
Base Path |
Routes |
Description |
| Auth |
/api/auth/*, /api/remote-auth/*, /api/remote-feedback/* |
6 |
Guest session, token, user probe, feedback |
| AI |
/api/ai/* |
5 |
Chat, images, audio, embeddings |
| Audit |
/api/audit/* |
1 |
Audit log retrieval |
| Chat Insights |
/api/chat-insights/* |
1 |
Per-chat insight records |
| Chronicle |
/api/chronicle/* |
7 |
Meeting detection, analysis, memories |
| Contacts |
/api/contacts/* |
1 |
Contact query |
| DB Init |
/api/db/* |
1 |
Bootstrap database |
| Files |
/api/files/* |
8 |
File storage, upload, download |
| Insight Tabs |
/api/insight-tabs/* |
3 |
Tab CRUD + reorder |
| Integrations |
/api/integrations/* |
9 |
OAuth + connected accounts |
| Listeners |
/api/listeners/* |
1 |
Listener cleanup |
| LLM Usage |
/api/llm/* |
1 |
Usage summary |
| Loop |
/api/loop/* |
24 |
Attention loop, decisions, channels, classifier rules |
| Markmap |
/api/markmap/* |
1 |
Markmap generation |
| Memory |
/api/memory/* |
2 |
Memory search, raw messages |
| Messages |
/api/messages/* |
4 |
Send, sync, status, raw |
| Native |
/api/native/* |
5 |
Native agent operations, providers, skills |
| Pet |
/api/pet/* |
1 |
Pet state mirror |
| Proxy |
/api/proxy/* |
2 |
CSS/JS proxy |
| RAG |
/api/rag/* |
11 |
Document upload, search, stats |
| Storage |
/api/storage/* |
4 |
Disk usage, sessions, cleanup |
| Workspace |
/api/workspace/* |
11 |
Artifacts, files, skills, previews |
Platform Callback Modules
Each integration platform has its own /api/<platform>/* module:
| Platform |
Base Path |
Routes |
| Slack |
/api/slack/* |
2 |
| Discord |
/api/discord/* |
2 |
| Feishu (Lark) |
/api/feishu/* |
1 |
| DingTalk |
/api/dingtalk/* |
1 |
| QQ Bot |
/api/qqbot/* |
1 |
| Weixin (WeChat) |
/api/weixin/* |
4 |
| Telegram |
/api/telegram/* |
4 |
| WhatsApp |
/api/whatsapp/* |
2 |
| iMessage |
/api/imessage/* |
2 |
| HubSpot |
/api/hubspot/* |
1 |
| LinkedIn |
/api/linkedin/* |
1 |
| Notion |
/api/notion/* |
1 |
Endpoints Reference
Auth Module
| Method |
Endpoint |
Description |
| POST |
/api/auth/set-token |
Set auth token |
| POST |
/api/auth/clear-auth-cookie |
Clear session |
| POST |
/api/auth/token |
Issue session token |
| POST |
/api/remote-auth/guest |
Create anonymous guest session |
| GET |
/api/remote-auth/user |
Get current user (also used by plugin probe) |
| PUT |
/api/remote-auth/user |
Update user info |
| POST |
/api/remote-feedback |
Submit feedback |
Messages Module
| Method |
Endpoint |
Description |
| GET |
/api/messages |
List messages |
| POST |
/api/messages |
Send message |
| GET |
/api/messages/sync |
Sync messages |
| GET |
/api/messages/check |
Check message status |
| GET |
/api/messages/raw |
Get raw message |
Files Module
| Method |
Endpoint |
Description |
| GET |
/api/files/list |
List files |
| GET |
/api/files/[id] |
Get file by ID |
| GET |
/api/files/download |
Download file |
| POST |
/api/files/upload |
Upload file |
| POST |
/api/files/save |
Save file |
| GET |
/api/files/usage |
Get storage usage |
| GET |
/api/files/insights/download |
Download insights file |
| POST |
/api/files/insights/save |
Save insights |
Storage Module
| Method |
Endpoint |
Description |
| GET |
/api/storage/disk-usage |
Get disk usage |
| POST |
/api/storage/cleanup |
Cleanup storage |
| GET |
/api/storage/sessions |
List sessions |
| GET |
/api/storage/sessions/[taskId] |
Get session by task ID |
| DELETE |
/api/storage/sessions/[taskId] |
Delete session |
Integrations Module
| Method |
Endpoint |
Description |
| GET |
/api/integrations/accounts |
List connected accounts |
| GET |
/api/integrations/slack/oauth/start |
Start Slack OAuth |
| GET |
/api/integrations/slack/oauth/exchange |
Exchange Slack OAuth code |
| GET |
/api/integrations/discord/oauth/start |
Start Discord OAuth |
| GET |
/api/integrations/discord/oauth/exchange |
Exchange Discord OAuth code |
| GET |
/api/integrations/x/oauth/start |
Start X OAuth |
| GET |
/api/integrations/hubspot/oauth/start |
Start HubSpot OAuth |
| GET |
/api/integrations/linkedin/oauth/start |
Start LinkedIn OAuth |
| GET |
/api/integrations/notion/oauth/start |
Start Notion OAuth |
Platform Callbacks
| Platform |
Module |
Sample Endpoint |
| Slack |
/api/slack/* |
OAuth + listener endpoints under the module |
| Discord |
/api/discord/* |
OAuth + listener endpoints under the module |
| Feishu |
/api/feishu/* |
POST /api/feishu/listener/init |
| DingTalk |
/api/dingtalk/* |
POST /api/dingtalk/listener/init |
| QQ Bot |
/api/qqbot/* |
POST /api/qqbot/listener/init |
| Weixin (WeChat) |
/api/weixin/* |
POST /api/weixin/listener/init |
| Telegram |
/api/telegram/* |
POST /api/telegram/user-listener/init |
| WhatsApp |
/api/whatsapp/* |
POST /api/whatsapp/register-socket |
| iMessage |
/api/imessage/* |
POST /api/imessage/init-self-listener |
| HubSpot |
/api/hubspot/* |
OAuth start under /api/hubspot/... |
| LinkedIn |
/api/linkedin/* |
OAuth start under /api/linkedin/... |
| Notion |
/api/notion/* |
OAuth start under /api/notion/... |
RAG Module
| Method |
Endpoint |
Description |
| GET |
/api/rag/search |
Search documents |
| GET |
/api/rag/stats |
Get RAG statistics |
| GET |
/api/rag/documents |
List documents |
| GET |
/api/rag/documents/[documentId] |
Get document |
| GET |
/api/rag/documents/[documentId]/binary |
Get document binary |
| DELETE |
/api/rag/documents/[documentId] |
Delete document |
| POST |
/api/rag/upload |
Upload document |
| POST |
/api/rag/upload/init |
Initialize upload |
| POST |
/api/rag/upload/chunk |
Upload chunk |
| POST |
/api/rag/upload/complete |
Complete upload |
| POST |
/api/rag/upload/async |
Async upload |
| GET |
/api/rag/upload/async/status |
Check async upload status |
Workspace Module
| Method |
Endpoint |
Description |
| GET |
/api/workspace/artifacts |
List artifacts |
| GET |
/api/workspace/files |
List files |
| GET |
/api/workspace/file/[...path] |
Get file by path |
| GET |
/api/workspace/preview |
Preview artifact |
| GET |
/api/workspace/external-preview |
External preview |
| GET |
/api/workspace/pptx-preview/[taskId]/[...path] |
Preview PPTX artifact |
| GET |
/api/workspace/skills |
List skills |
| GET |
/api/workspace/skills/[skillId] |
Get skill |
| POST |
/api/workspace/skills |
Create skill |
| PUT |
/api/workspace/skills/[skillId] |
Update skill |
| DELETE |
/api/workspace/skills/[skillId] |
Delete skill |
| POST |
/api/workspace/skills/toggle |
Toggle skill |
| POST |
/api/workspace/skills/upload |
Upload skill |
| GET |
/api/workspace/skills/metadata |
Get skill metadata |
AI Module
| Method |
Endpoint |
Description |
| POST |
/api/ai/v1/chat/completions |
Chat completions (streaming) |
| POST |
/api/ai/v1/messages |
Messages API |
| POST |
/api/ai/v1/images/generations |
Generate images |
| POST |
/api/ai/v1/images/lifestyle/generate |
Lifestyle image generate |
| POST |
/api/ai/v1/images/lifestyle/compose |
Lifestyle image compose |
Chronicle Module
| Method |
Endpoint |
Description |
| POST |
/api/chronicle/analyze |
Run chronicle analysis |
| GET |
/api/chronicle/memories |
List memories |
| GET |
/api/chronicle/memories/[memoryId] |
Get a memory |
| DELETE |
/api/chronicle/memories/[memoryId] |
Delete a memory |
Insight Tabs Module
| Method |
Endpoint |
Description |
| GET |
/api/insight-tabs |
List insight tabs |
| POST |
/api/insight-tabs |
Create insight tab |
| PUT |
/api/insight-tabs/[tabId] |
Update tab |
| POST |
/api/insight-tabs/reorder |
Reorder tabs |
Chat Insights Module
| Method |
Endpoint |
Description |
| GET |
/api/chat-insights |
Get chat insights |
Memory Module
| Method |
Endpoint |
Description |
| GET |
/api/memory/search |
Search memory |
| GET |
/api/memory/raw-messages |
Get raw messages |
Native Module
| Method |
Endpoint |
Description |
| GET |
/api/native/providers |
List native providers |
| GET |
/api/native/skills |
List native skills |
| POST |
/api/native/agent |
Agent invocation |
| POST |
/api/native/agent/password |
Agent password |
| POST |
/api/native/agent/permission |
Agent permission |
Pet Module
| Method |
Endpoint |
Description |
| GET |
/api/pet/state |
Read pet state |
| POST |
/api/pet/state |
Write pet state |
Loop Module (highlights)
24 routes total. Top-level surfaces:
| Endpoint |
Description |
GET /api/loop/connectors |
Connector status |
GET /api/loop/state |
Loop state |
POST /api/loop/tick |
Advance loop tick |
POST /api/loop/activation |
Trigger activation |
GET /api/loop/preferences |
Loop preferences |
GET /api/loop/brief / GET /api/loop/brief/content |
Brief delivery |
GET /api/loop/wrap / GET /api/loop/wrap/content |
Wrap delivery |
GET /api/loop/channels / GET /api/loop/channels/[id] |
Channels |
GET /api/loop/types / GET /api/loop/types/[id] |
Loop types |
GET /api/loop/decisions / GET /api/loop/decision/[id] |
Decisions |
POST /api/loop/action/schedule / GET /api/loop/action/[id] |
Actions |
GET /api/loop/action/by-decision/[id] |
Actions by decision |
GET /api/loop/classifier-rules[/...] |
Classifier rules + dry-run |
GET /api/loop/card/[id] |
Card |
POST /api/loop/dev/reset / GET /api/loop/dev/scene |
Dev tooling |
Agent Goal Module (read-only highlights)
| Endpoint |
Description |
GET /api/agent-goals/active |
Active, paused, and blocked Goals across the authenticated owner's chats |
GET /api/agent-goals?runtimeSessionId=... |
Goals for one Runtime Session |
GET /api/agent-goals/[goalId]?runtimeSessionId=... |
Ordered steps and progress for one Goal |
Other Modules (single-route or paired)
| Module |
Endpoints |
| Audit |
GET /api/audit/logs |
| Contacts |
GET /api/contacts |
| DB |
POST /api/db/init |
| Listeners |
POST /api/listeners/cleanup |
| LLM Usage |
GET /api/llm/usage/summary |
| Markmap |
POST /api/markmap |
| Proxy |
GET /api/proxy/css, GET /api/proxy/js |
Error Handling
Error Response Format
// API errors return standard HTTP status codes
{
error: string; // Error message
code?: string; // Error code for programmatic handling
cause?: string; // Additional context
}
Common Status Codes
| Code |
Meaning |
| 200 |
Success |
| 400 |
Bad Request - Invalid input |
| 401 |
Unauthorized - Not authenticated |
| 403 |
Forbidden - Insufficient permissions |
| 404 |
Not Found |
| 429 |
Too Many Requests |
| 500 |
Internal Server Error |
AI/Agent Usage
Local API Access
When running openloomi desktop app, the local API server runs on port 3414 (fallback: 3515):
| Environment |
Base URL |
| User Local Desktop |
http://localhost:3414 |
| User Local Desktop (fallback) |
http://localhost:3515 |
Authentication Token
The auth token is stored at ~/.openloomi/token (base64 encoded JWT). You must decode it before use:
# Decode base64 to get JWT token
TOKEN=$(cat ~/.openloomi/token | base64 -d)
# Verify token contents (decodes JWT payload)
echo "$TOKEN" | cut -d'.' -f2 | base64 -d 2>/dev/null | python3 -m json.tool
curl Examples
Important: All authenticated requests require the token to be base64 decoded first.
# Helper: Get decoded token
TOKEN=$(cat ~/.openloomi/token | base64 -d)
# 1. Check AI API status (no auth required)
curl http://localhost:3414/api/ai/chat
# 2. Get current user info (also used by Claude/Codex plugin as a port-discovery probe)
TOKEN=$(cat ~/.openloomi/token | base64 -d)
curl http://localhost:3414/api/remote-auth/user \
-H "Authorization: Bearer $TOKEN"
# 3. Create an anonymous guest session (no credentials)
curl -X POST http://localhost:3414/api/remote-auth/guest \
-H "Content-Type: application/json" \
-d '{}'
# 4. Chat with AI (streaming)
TOKEN=$(cat ~/.openloomi/token | base64 -d)
curl -X POST http://localhost:3414/api/ai/chat \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"messages":[{"role":"user","content":"Hello!"}],"stream":true}'
# 5. Get chat insights (requires chatId)
TOKEN=$(cat ~/.openloomi/token | base64 -d)
curl "http://localhost:3414/api/chat-insights?chatId=xxx" \
-H "Authorization: Bearer $TOKEN"
# 6. Search RAG documents
TOKEN=$(cat ~/.openloomi/token | base64 -d)
curl -X POST http://localhost:3414/api/rag/search \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"query":"search term","limit":5}'
# 7. List workspace skills
TOKEN=$(cat ~/.openloomi/token | base64 -d)
curl http://localhost:3414/api/workspace/skills \
-H "Authorization: Bearer $TOKEN"
# 8. Submit feedback
TOKEN=$(cat ~/.openloomi/token | base64 -d)
curl -X POST http://localhost:3414/api/remote-feedback \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"content":"Feedback message","email":"user@example.com"}'
Summary
- 131 route handlers across 22 functional modules + 12 platform callback modules + 2 cross-cutting modules (
proxy, db)
- Local-first: auth, Memory, AI, RAG, Loop, and Audit data live in a local SQLite database; the only externally-routed path is the Composio OAuth broker
- Dual authentication: Session cookies (web) and Bearer tokens (Tauri / CLI)
- RESTful JSON APIs with Zod validation
- SWR utilities for client-side data fetching
- OAuth support for Slack, Discord, X, HubSpot, LinkedIn, Notion
- RAG for Knowledge Base document upload + retrieval (
openloomi-memory owns the user-facing surface)
- AI endpoints for chat, images, audio
- Loop for the proactive judgement engine — signals, decisions, cards, channels, classifier rules (see
openloomi-loop)
- Memory search + raw-message access (full surface in
openloomi-memory)
- Pet state mirror (read/write
/api/pet/state)
1---2name: openloomi-api3description: openloomi HTTP API reference (local-first, served from the OpenLoomi Desktop app at http://localhost:3414). Use when working with openloomi backend routes — auth, AI, files, integrations, RAG, memory, Loop, pet, workspace, platform callbacks. Triggers: API endpoints, backend routes, /api/*, local API, port 3414, integrations REST, OAuth start, RAG search, loop state, memory search, pet state, audit logs4---5
6> **Note:** If OpenLoomi readiness is unknown, use `openloomi-setup` first. If OpenLoomi Desktop is not installed, follow [Getting Started](https://openloomi.ai/docs/getting-started).
7
8# OpenLoomi API Documentation
9
10## API Modules
11
12OpenLoomi ships a **local-first** HTTP API served from the desktop app (port `3414`, fallback `3515`). All auth, Memory, AI, RAG, Loop, and Audit data live in a local SQLite database — your data stays on your machine and the OpenLoomi app is the source of truth. The only externally-routed auth path is the **Composio OAuth broker** that backs the Slack, GitHub, Google, Notion, Linear, HubSpot, LinkedIn, Jira, and Asana Connectors (see `openloomi-connectors`).
13
14The `remote-auth` prefix is historical — those routes once proxied to a cloud server; today they are the canonical local endpoints, and the Claude/Codex plugin bridge uses `/api/remote-auth/user` as a port-discovery + auth-handshake probe.
15
16This reference covers **131 route handlers** under 36 top-level `/api/*` modules. Pair it with `openloomi-loop` (Loop state, decisions, channels, classifier rules, brief/wrap) and `openloomi-memory` (Memory search, KB, insights, entities, living connections) for the runtime surfaces used by Chat and Loop.
17
18### Functional Modules
19
20| Module | Base Path | Routes | Description |
21|--------|-----------|--------|-------------|
22| **Auth** | `/api/auth/*`, `/api/remote-auth/*`, `/api/remote-feedback/*` | 6 | Guest session, token, user probe, feedback |
23| **AI** | `/api/ai/*` | 5 | Chat, images, audio, embeddings |
24| **Audit** | `/api/audit/*` | 1 | Audit log retrieval |
25| **Chat Insights** | `/api/chat-insights/*` | 1 | Per-chat insight records |
26| **Chronicle** | `/api/chronicle/*` | 7 | Meeting detection, analysis, memories |
27| **Contacts** | `/api/contacts/*` | 1 | Contact query |
28| **DB Init** | `/api/db/*` | 1 | Bootstrap database |
29| **Files** | `/api/files/*` | 8 | File storage, upload, download |
30| **Insight Tabs** | `/api/insight-tabs/*` | 3 | Tab CRUD + reorder |
31| **Integrations** | `/api/integrations/*` | 9 | OAuth + connected accounts |
32| **Listeners** | `/api/listeners/*` | 1 | Listener cleanup |
33| **LLM Usage** | `/api/llm/*` | 1 | Usage summary |
34| **Loop** | `/api/loop/*` | 24 | Attention loop, decisions, channels, classifier rules |
35| **Markmap** | `/api/markmap/*` | 1 | Markmap generation |
36| **Memory** | `/api/memory/*` | 2 | Memory search, raw messages |
37| **Messages** | `/api/messages/*` | 4 | Send, sync, status, raw |
38| **Native** | `/api/native/*` | 5 | Native agent operations, providers, skills |
39| **Pet** | `/api/pet/*` | 1 | Pet state mirror |
40| **Proxy** | `/api/proxy/*` | 2 | CSS/JS proxy |
41| **RAG** | `/api/rag/*` | 11 | Document upload, search, stats |
42| **Storage** | `/api/storage/*` | 4 | Disk usage, sessions, cleanup |
43| **Workspace** | `/api/workspace/*` | 11 | Artifacts, files, skills, previews |
44
45### Platform Callback Modules
46
47Each integration platform has its own `/api/<platform>/*` module:
48
49| Platform | Base Path | Routes |
50|----------|-----------|--------|
51| **Slack** | `/api/slack/*` | 2 |
52| **Discord** | `/api/discord/*` | 2 |
53| **Feishu (Lark)** | `/api/feishu/*` | 1 |
54| **DingTalk** | `/api/dingtalk/*` | 1 |
55| **QQ Bot** | `/api/qqbot/*` | 1 |
56| **Weixin (WeChat)** | `/api/weixin/*` | 4 |
57| **Telegram** | `/api/telegram/*` | 4 |
58| **WhatsApp** | `/api/whatsapp/*` | 2 |
59| **iMessage** | `/api/imessage/*` | 2 |
60| **HubSpot** | `/api/hubspot/*` | 1 |
61| **LinkedIn** | `/api/linkedin/*` | 1 |
62| **Notion** | `/api/notion/*` | 1 |
63
64---
65
66## Endpoints Reference
67
68### Auth Module
69
70| Method | Endpoint | Description |
71|--------|----------|-------------|
72| POST | `/api/auth/set-token` | Set auth token |
73| POST | `/api/auth/clear-auth-cookie` | Clear session |
74| POST | `/api/auth/token` | Issue session token |
75| POST | `/api/remote-auth/guest` | Create anonymous guest session |
76| GET | `/api/remote-auth/user` | Get current user (also used by plugin probe) |
77| PUT | `/api/remote-auth/user` | Update user info |
78| POST | `/api/remote-feedback` | Submit feedback |
79
80### Messages Module
81
82| Method | Endpoint | Description |
83|--------|----------|-------------|
84| GET | `/api/messages` | List messages |
85| POST | `/api/messages` | Send message |
86| GET | `/api/messages/sync` | Sync messages |
87| GET | `/api/messages/check` | Check message status |
88| GET | `/api/messages/raw` | Get raw message |
89
90### Files Module
91
92| Method | Endpoint | Description |
93|--------|----------|-------------|
94| GET | `/api/files/list` | List files |
95| GET | `/api/files/[id]` | Get file by ID |
96| GET | `/api/files/download` | Download file |
97| POST | `/api/files/upload` | Upload file |
98| POST | `/api/files/save` | Save file |
99| GET | `/api/files/usage` | Get storage usage |
100| GET | `/api/files/insights/download` | Download insights file |
101| POST | `/api/files/insights/save` | Save insights |
102
103### Storage Module
104
105| Method | Endpoint | Description |
106|--------|----------|-------------|
107| GET | `/api/storage/disk-usage` | Get disk usage |
108| POST | `/api/storage/cleanup` | Cleanup storage |
109| GET | `/api/storage/sessions` | List sessions |
110| GET | `/api/storage/sessions/[taskId]` | Get session by task ID |
111| DELETE | `/api/storage/sessions/[taskId]` | Delete session |
112
113### Integrations Module
114
115| Method | Endpoint | Description |
116|--------|----------|-------------|
117| GET | `/api/integrations/accounts` | List connected accounts |
118| GET | `/api/integrations/slack/oauth/start` | Start Slack OAuth |
119| GET | `/api/integrations/slack/oauth/exchange` | Exchange Slack OAuth code |
120| GET | `/api/integrations/discord/oauth/start` | Start Discord OAuth |
121| GET | `/api/integrations/discord/oauth/exchange` | Exchange Discord OAuth code |
122| GET | `/api/integrations/x/oauth/start` | Start X OAuth |
123| GET | `/api/integrations/hubspot/oauth/start` | Start HubSpot OAuth |
124| GET | `/api/integrations/linkedin/oauth/start` | Start LinkedIn OAuth |
125| GET | `/api/integrations/notion/oauth/start` | Start Notion OAuth |
126
127### Platform Callbacks
128
129| Platform | Module | Sample Endpoint |
130|----------|--------|-----------------|
131| Slack | `/api/slack/*` | OAuth + listener endpoints under the module |
132| Discord | `/api/discord/*` | OAuth + listener endpoints under the module |
133| Feishu | `/api/feishu/*` | `POST /api/feishu/listener/init` |
134| DingTalk | `/api/dingtalk/*` | `POST /api/dingtalk/listener/init` |
135| QQ Bot | `/api/qqbot/*` | `POST /api/qqbot/listener/init` |
136| Weixin (WeChat) | `/api/weixin/*` | `POST /api/weixin/listener/init` |
137| Telegram | `/api/telegram/*` | `POST /api/telegram/user-listener/init` |
138| WhatsApp | `/api/whatsapp/*` | `POST /api/whatsapp/register-socket` |
139| iMessage | `/api/imessage/*` | `POST /api/imessage/init-self-listener` |
140| HubSpot | `/api/hubspot/*` | OAuth start under `/api/hubspot/...` |
141| LinkedIn | `/api/linkedin/*` | OAuth start under `/api/linkedin/...` |
142| Notion | `/api/notion/*` | OAuth start under `/api/notion/...` |
143
144### RAG Module
145
146| Method | Endpoint | Description |
147|--------|----------|-------------|
148| GET | `/api/rag/search` | Search documents |
149| GET | `/api/rag/stats` | Get RAG statistics |
150| GET | `/api/rag/documents` | List documents |
151| GET | `/api/rag/documents/[documentId]` | Get document |
152| GET | `/api/rag/documents/[documentId]/binary` | Get document binary |
153| DELETE | `/api/rag/documents/[documentId]` | Delete document |
154| POST | `/api/rag/upload` | Upload document |
155| POST | `/api/rag/upload/init` | Initialize upload |
156| POST | `/api/rag/upload/chunk` | Upload chunk |
157| POST | `/api/rag/upload/complete` | Complete upload |
158| POST | `/api/rag/upload/async` | Async upload |
159| GET | `/api/rag/upload/async/status` | Check async upload status |
160
161### Workspace Module
162
163| Method | Endpoint | Description |
164|--------|----------|-------------|
165| GET | `/api/workspace/artifacts` | List artifacts |
166| GET | `/api/workspace/files` | List files |
167| GET | `/api/workspace/file/[...path]` | Get file by path |
168| GET | `/api/workspace/preview` | Preview artifact |
169| GET | `/api/workspace/external-preview` | External preview |
170| GET | `/api/workspace/pptx-preview/[taskId]/[...path]` | Preview PPTX artifact |
171| GET | `/api/workspace/skills` | List skills |
172| GET | `/api/workspace/skills/[skillId]` | Get skill |
173| POST | `/api/workspace/skills` | Create skill |
174| PUT | `/api/workspace/skills/[skillId]` | Update skill |
175| DELETE | `/api/workspace/skills/[skillId]` | Delete skill |
176| POST | `/api/workspace/skills/toggle` | Toggle skill |
177| POST | `/api/workspace/skills/upload` | Upload skill |
178| GET | `/api/workspace/skills/metadata` | Get skill metadata |
179
180### AI Module
181
182| Method | Endpoint | Description |
183|--------|----------|-------------|
184| POST | `/api/ai/v1/chat/completions` | Chat completions (streaming) |
185| POST | `/api/ai/v1/messages` | Messages API |
186| POST | `/api/ai/v1/images/generations` | Generate images |
187| POST | `/api/ai/v1/images/lifestyle/generate` | Lifestyle image generate |
188| POST | `/api/ai/v1/images/lifestyle/compose` | Lifestyle image compose |
189
190### Chronicle Module
191
192| Method | Endpoint | Description |
193|--------|----------|-------------|
194| POST | `/api/chronicle/analyze` | Run chronicle analysis |
195| GET | `/api/chronicle/memories` | List memories |
196| GET | `/api/chronicle/memories/[memoryId]` | Get a memory |
197| DELETE | `/api/chronicle/memories/[memoryId]` | Delete a memory |
198
199### Insight Tabs Module
200
201| Method | Endpoint | Description |
202|--------|----------|-------------|
203| GET | `/api/insight-tabs` | List insight tabs |
204| POST | `/api/insight-tabs` | Create insight tab |
205| PUT | `/api/insight-tabs/[tabId]` | Update tab |
206| POST | `/api/insight-tabs/reorder` | Reorder tabs |
207
208### Chat Insights Module
209
210| Method | Endpoint | Description |
211|--------|----------|-------------|
212| GET | `/api/chat-insights` | Get chat insights |
213
214### Memory Module
215
216| Method | Endpoint | Description |
217|--------|----------|-------------|
218| GET | `/api/memory/search` | Search memory |
219| GET | `/api/memory/raw-messages` | Get raw messages |
220
221### Native Module
222
223| Method | Endpoint | Description |
224|--------|----------|-------------|
225| GET | `/api/native/providers` | List native providers |
226| GET | `/api/native/skills` | List native skills |
227| POST | `/api/native/agent` | Agent invocation |
228| POST | `/api/native/agent/password` | Agent password |
229| POST | `/api/native/agent/permission` | Agent permission |
230
231### Pet Module
232
233| Method | Endpoint | Description |
234|--------|----------|-------------|
235| GET | `/api/pet/state` | Read pet state |
236| POST | `/api/pet/state` | Write pet state |
237
238### Loop Module (highlights)
239
24024 routes total. Top-level surfaces:
241
242| Endpoint | Description |
243|----------|-------------|
244| `GET /api/loop/connectors` | Connector status |
245| `GET /api/loop/state` | Loop state |
246| `POST /api/loop/tick` | Advance loop tick |
247| `POST /api/loop/activation` | Trigger activation |
248| `GET /api/loop/preferences` | Loop preferences |
249| `GET /api/loop/brief` / `GET /api/loop/brief/content` | Brief delivery |
250| `GET /api/loop/wrap` / `GET /api/loop/wrap/content` | Wrap delivery |
251| `GET /api/loop/channels` / `GET /api/loop/channels/[id]` | Channels |
252| `GET /api/loop/types` / `GET /api/loop/types/[id]` | Loop types |
253| `GET /api/loop/decisions` / `GET /api/loop/decision/[id]` | Decisions |
254| `POST /api/loop/action/schedule` / `GET /api/loop/action/[id]` | Actions |
255| `GET /api/loop/action/by-decision/[id]` | Actions by decision |
256| `GET /api/loop/classifier-rules[/...]` | Classifier rules + dry-run |
257| `GET /api/loop/card/[id]` | Card |
258| `POST /api/loop/dev/reset` / `GET /api/loop/dev/scene` | Dev tooling |
259
260### Agent Goal Module (read-only highlights)
261
262| Endpoint | Description |
263|----------|-------------|
264| `GET /api/agent-goals/active` | Active, paused, and blocked Goals across the authenticated owner's chats |
265| `GET /api/agent-goals?runtimeSessionId=...` | Goals for one Runtime Session |
266| `GET /api/agent-goals/[goalId]?runtimeSessionId=...` | Ordered steps and progress for one Goal |
267
268### Other Modules (single-route or paired)
269
270| Module | Endpoints |
271|--------|-----------|
272| **Audit** | `GET /api/audit/logs` |
273| **Contacts** | `GET /api/contacts` |
274| **DB** | `POST /api/db/init` |
275| **Listeners** | `POST /api/listeners/cleanup` |
276| **LLM Usage** | `GET /api/llm/usage/summary` |
277| **Markmap** | `POST /api/markmap` |
278| **Proxy** | `GET /api/proxy/css`, `GET /api/proxy/js` |
279
280---
281
282## Error Handling
283
284### Error Response Format
285
286```typescript
287// API errors return standard HTTP status codes
288{
289 error: string; // Error message
290 code?: string; // Error code for programmatic handling
291 cause?: string; // Additional context
292}
293```
294
295### Common Status Codes
296
297| Code | Meaning |
298|------|---------|
299| 200 | Success |
300| 400 | Bad Request - Invalid input |
301| 401 | Unauthorized - Not authenticated |
302| 403 | Forbidden - Insufficient permissions |
303| 404 | Not Found |
304| 429 | Too Many Requests |
305| 500 | Internal Server Error |
306
307---
308
309## AI/Agent Usage
310
311### Local API Access
312
313When running openloomi desktop app, the local API server runs on port **3414** (fallback: **3515**):
314
315| Environment | Base URL |
316|-------------|----------|
317| User Local Desktop | `http://localhost:3414` |
318| User Local Desktop (fallback) | `http://localhost:3515` |
319
320### Authentication Token
321
322The auth token is stored at `~/.openloomi/token` (base64 encoded JWT). You **must decode it** before use:
323
324```bash
325# Decode base64 to get JWT token
326TOKEN=$(cat ~/.openloomi/token | base64 -d)
327
328# Verify token contents (decodes JWT payload)
329echo "$TOKEN" | cut -d'.' -f2 | base64 -d 2>/dev/null | python3 -m json.tool
330```
331
332### curl Examples
333
334**Important**: All authenticated requests require the token to be base64 decoded first.
335
336```bash
337# Helper: Get decoded token
338TOKEN=$(cat ~/.openloomi/token | base64 -d)
339
340# 1. Check AI API status (no auth required)
341curl http://localhost:3414/api/ai/chat
342
343# 2. Get current user info (also used by Claude/Codex plugin as a port-discovery probe)
344TOKEN=$(cat ~/.openloomi/token | base64 -d)
345curl http://localhost:3414/api/remote-auth/user \
346 -H "Authorization: Bearer $TOKEN"
347
348# 3. Create an anonymous guest session (no credentials)
349curl -X POST http://localhost:3414/api/remote-auth/guest \
350 -H "Content-Type: application/json" \
351 -d '{}'
352
353# 4. Chat with AI (streaming)
354TOKEN=$(cat ~/.openloomi/token | base64 -d)
355curl -X POST http://localhost:3414/api/ai/chat \
356 -H "Authorization: Bearer $TOKEN" \
357 -H "Content-Type: application/json" \
358 -d '{"messages":[{"role":"user","content":"Hello!"}],"stream":true}'
359
360# 5. Get chat insights (requires chatId)
361TOKEN=$(cat ~/.openloomi/token | base64 -d)
362curl "http://localhost:3414/api/chat-insights?chatId=xxx" \
363 -H "Authorization: Bearer $TOKEN"
364
365# 6. Search RAG documents
366TOKEN=$(cat ~/.openloomi/token | base64 -d)
367curl -X POST http://localhost:3414/api/rag/search \
368 -H "Authorization: Bearer $TOKEN" \
369 -H "Content-Type: application/json" \
370 -d '{"query":"search term","limit":5}'
371
372# 7. List workspace skills
373TOKEN=$(cat ~/.openloomi/token | base64 -d)
374curl http://localhost:3414/api/workspace/skills \
375 -H "Authorization: Bearer $TOKEN"
376
377# 8. Submit feedback
378TOKEN=$(cat ~/.openloomi/token | base64 -d)
379curl -X POST http://localhost:3414/api/remote-feedback \
380 -H "Authorization: Bearer $TOKEN" \
381 -H "Content-Type: application/json" \
382 -d '{"content":"Feedback message","email":"user@example.com"}'
383```
384
385---
386
387## Summary
388
389- **131 route handlers** across 22 functional modules + 12 platform callback modules + 2 cross-cutting modules (`proxy`, `db`)
390- **Local-first**: auth, Memory, AI, RAG, Loop, and Audit data live in a local SQLite database; the only externally-routed path is the Composio OAuth broker
391- **Dual authentication**: Session cookies (web) and Bearer tokens (Tauri / CLI)
392- **RESTful JSON APIs** with Zod validation
393- **SWR utilities** for client-side data fetching
394- **OAuth support** for Slack, Discord, X, HubSpot, LinkedIn, Notion
395- **RAG** for Knowledge Base document upload + retrieval (`openloomi-memory` owns the user-facing surface)
396- **AI** endpoints for chat, images, audio
397- **Loop** for the proactive judgement engine — signals, decisions, cards, channels, classifier rules (see `openloomi-loop`)
398- **Memory** search + raw-message access (full surface in `openloomi-memory`)
399- **Pet** state mirror (read/write `/api/pet/state`)