Note: If you haven't downloaded or installed openloomi yet, please refer to Getting Started for installation instructions.
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 |
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-api-23description: 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---56> **Note:** If you haven't downloaded or installed openloomi yet, please refer to [Getting Started](https://openloomi.ai/docs/getting-started) for installation instructions.78# OpenLoomi API Documentation910## API Modules1112OpenLoomi 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`).1314The `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.1516This 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.1718### Functional Modules1920| 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 |4445### Platform Callback Modules4647Each integration platform has its own `/api/<platform>/*` module:4849| 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 |6364---6566## Endpoints Reference6768### Auth Module6970| 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 |7980### Messages Module8182| 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 |8990### Files Module9192| 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 |102103### Storage Module104105| 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 |112113### Integrations Module114115| 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 |126127### Platform Callbacks128129| 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/...` |143144### RAG Module145146| 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 |160161### Workspace Module162163| 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 |179180### AI Module181182| 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 |189190### Chronicle Module191192| 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 |198199### Insight Tabs Module200201| 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 |207208### Chat Insights Module209210| Method | Endpoint | Description |211|--------|----------|-------------|212| GET | `/api/chat-insights` | Get chat insights |213214### Memory Module215216| Method | Endpoint | Description |217|--------|----------|-------------|218| GET | `/api/memory/search` | Search memory |219| GET | `/api/memory/raw-messages` | Get raw messages |220221### Native Module222223| 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 |230231### Pet Module232233| Method | Endpoint | Description |234|--------|----------|-------------|235| GET | `/api/pet/state` | Read pet state |236| POST | `/api/pet/state` | Write pet state |237238### Loop Module (highlights)23924024 routes total. Top-level surfaces:241242| 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 |259260### Other Modules (single-route or paired)261262| Module | Endpoints |263|--------|-----------|264| **Audit** | `GET /api/audit/logs` |265| **Contacts** | `GET /api/contacts` |266| **DB** | `POST /api/db/init` |267| **Listeners** | `POST /api/listeners/cleanup` |268| **LLM Usage** | `GET /api/llm/usage/summary` |269| **Markmap** | `POST /api/markmap` |270| **Proxy** | `GET /api/proxy/css`, `GET /api/proxy/js` |271272---273274## Error Handling275276### Error Response Format277278```typescript279// API errors return standard HTTP status codes280{281 error: string; // Error message282 code?: string; // Error code for programmatic handling283 cause?: string; // Additional context284}285```286287### Common Status Codes288289| Code | Meaning |290|------|---------|291| 200 | Success |292| 400 | Bad Request - Invalid input |293| 401 | Unauthorized - Not authenticated |294| 403 | Forbidden - Insufficient permissions |295| 404 | Not Found |296| 429 | Too Many Requests |297| 500 | Internal Server Error |298299---300301## AI/Agent Usage302303### Local API Access304305When running openloomi desktop app, the local API server runs on port **3414** (fallback: **3515**):306307| Environment | Base URL |308|-------------|----------|309| User Local Desktop | `http://localhost:3414` |310| User Local Desktop (fallback) | `http://localhost:3515` |311312### Authentication Token313314The auth token is stored at `~/.openloomi/token` (base64 encoded JWT). You **must decode it** before use:315316```bash317# Decode base64 to get JWT token318TOKEN=$(cat ~/.openloomi/token | base64 -d)319320# Verify token contents (decodes JWT payload)321echo "$TOKEN" | cut -d'.' -f2 | base64 -d 2>/dev/null | python3 -m json.tool322```323324### curl Examples325326**Important**: All authenticated requests require the token to be base64 decoded first.327328```bash329# Helper: Get decoded token330TOKEN=$(cat ~/.openloomi/token | base64 -d)331332# 1. Check AI API status (no auth required)333curl http://localhost:3414/api/ai/chat334335# 2. Get current user info (also used by Claude/Codex plugin as a port-discovery probe)336TOKEN=$(cat ~/.openloomi/token | base64 -d)337curl http://localhost:3414/api/remote-auth/user \338 -H "Authorization: Bearer $TOKEN"339340# 3. Create an anonymous guest session (no credentials)341curl -X POST http://localhost:3414/api/remote-auth/guest \342 -H "Content-Type: application/json" \343 -d '{}'344345# 4. Chat with AI (streaming)346TOKEN=$(cat ~/.openloomi/token | base64 -d)347curl -X POST http://localhost:3414/api/ai/chat \348 -H "Authorization: Bearer $TOKEN" \349 -H "Content-Type: application/json" \350 -d '{"messages":[{"role":"user","content":"Hello!"}],"stream":true}'351352# 5. Get chat insights (requires chatId)353TOKEN=$(cat ~/.openloomi/token | base64 -d)354curl "http://localhost:3414/api/chat-insights?chatId=xxx" \355 -H "Authorization: Bearer $TOKEN"356357# 6. Search RAG documents358TOKEN=$(cat ~/.openloomi/token | base64 -d)359curl -X POST http://localhost:3414/api/rag/search \360 -H "Authorization: Bearer $TOKEN" \361 -H "Content-Type: application/json" \362 -d '{"query":"search term","limit":5}'363364# 7. List workspace skills365TOKEN=$(cat ~/.openloomi/token | base64 -d)366curl http://localhost:3414/api/workspace/skills \367 -H "Authorization: Bearer $TOKEN"368369# 8. Submit feedback370TOKEN=$(cat ~/.openloomi/token | base64 -d)371curl -X POST http://localhost:3414/api/remote-feedback \372 -H "Authorization: Bearer $TOKEN" \373 -H "Content-Type: application/json" \374 -d '{"content":"Feedback message","email":"user@example.com"}'375```376377---378379## Summary380381- **131 route handlers** across 22 functional modules + 12 platform callback modules + 2 cross-cutting modules (`proxy`, `db`)382- **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 broker383- **Dual authentication**: Session cookies (web) and Bearer tokens (Tauri / CLI)384- **RESTful JSON APIs** with Zod validation385- **SWR utilities** for client-side data fetching386- **OAuth support** for Slack, Discord, X, HubSpot, LinkedIn, Notion387- **RAG** for Knowledge Base document upload + retrieval (`openloomi-memory` owns the user-facing surface)388- **AI** endpoints for chat, images, audio389- **Loop** for the proactive judgement engine — signals, decisions, cards, channels, classifier rules (see `openloomi-loop`)390- **Memory** search + raw-message access (full surface in `openloomi-memory`)391- **Pet** state mirror (read/write `/api/pet/state`)