Docs Desktop Client API Server (serve) Copy page Copy as Markdown Copy page content for LLM
Open in ChatGPT Ask ChatGPT about this page
Open in Claude Ask Claude about this page
API Server (pocketpaw serve) The pocketpaw serve command starts PocketPaw as a headless API server without the web dashboard frontend. It exposes the full REST API and WebSocket endpoints, making it ideal for:
The desktop client (Tauri app) connecting over localhost Custom scripts and automationExternal integrations that only need the APIDocker and headless server deploymentsQuick Start # Start the API server (default: localhost:8888)
pocketpaw serve --host 0.0.0.0 --port 9000
# Development mode with auto-reload
What’s Included The API server starts the full PocketPaw backend:
Component Status REST API (/api/v1/) Active WebSocket (/ws, /api/v1/ws) Active Message bus Active Agent loop Active Memory system Active Scheduler Active Channel adapters Active (if configured) Web dashboard UI Not served
The only difference from the default pocketpaw command is that no HTML/CSS/JS frontend is served. All API endpoints work identically.
Authentication The API server supports multiple authentication methods:
Master Token On first run, PocketPaw generates a master access token saved at ~/.pocketpaw/access_token. Use it as a Bearer token:
curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:8888/api/v1/health
Session Tokens Exchange the master token for a short-lived session token:
curl -X POST http://localhost:8888/api/v1/auth/session \
-H "Authorization: Bearer YOUR_MASTER_TOKEN"
# Response: { "session_token": "uuid:hmac_signature" }
API Keys Create scoped API keys for long-lived access:
curl -X POST http://localhost:8888/api/v1/auth/api-keys \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-script", "scopes": ["chat", "sessions"]}'
# Response includes the key (shown once): { "key": "pp_xxxx...", "id": "..." }
OAuth2 (PKCE) For desktop and third-party apps, use the OAuth2 PKCE flow:
GET /api/v1/oauth/authorize?client_id=...&code_challenge=...User approves consent POST /api/v1/oauth/token with authorization codeUse the returned access token (ppat_* prefix) Localhost Bypass By default, requests from 127.0.0.1 or ::1 skip authentication. Disable this with:
export POCKETPAW_LOCALHOST_AUTH_BYPASS = false
API Endpoints All endpoints are prefixed with /api/v1/. Here’s a summary by category:
Chat Method Endpoint Description POST/chatSend message, get complete response (blocking) POST/chat/streamSend message, receive SSE stream POST/chat/stopCancel in-flight response
Sessions Method Endpoint Description POST/sessionsCreate new session GET/sessionsList sessions (paginated) DELETE/sessions/{id}Delete session POST/sessions/{id}/titleUpdate session title GET/sessions/searchSearch sessions by content GET/sessions/{id}/historyGet message history GET/sessions/{id}/exportExport as JSON or Markdown
Settings Method Endpoint Description GET/settingsGet current settings PUT/settingsUpdate settings
Memory Method Endpoint Description GET/memory/long_termGet long-term memories (paginated) DELETE/memory/long_term/{id}Delete memory entry GET/memory/settingsGet memory backend config POST/memory/settingsSave memory backend config GET/memory/statsGet memory statistics
Health & Diagnostics Method Endpoint Description GET/versionVersion and backend info GET/healthHealth engine summary GET/health/errorsRecent errors (paginated) POST/health/checkTrigger health check GET/auditAudit log entries POST/security-auditRun security audit GET/metrics/systemCPU, RAM, disk, battery GET/metrics/usageToken usage and costs
Identity Method Endpoint Description GET/identityGet all identity files PUT/identitySave identity file edits
Channels Method Endpoint Description GET/channels/statusStatus of all channel adapters POST/channels/saveSave channel configuration POST/channels/toggleStart or stop a channel
MCP Servers Method Endpoint Description GET/mcp/statusStatus of MCP servers POST/mcp/addAdd MCP server POST/mcp/removeRemove MCP server POST/mcp/toggleToggle MCP server POST/mcp/testTest connection GET/mcp/presetsList presets POST/mcp/presets/installInstall preset
Skills Method Endpoint Description GET/skillsList installed skills GET/skills/searchSearch skill library POST/skills/installInstall skill POST/skills/removeRemove skill
Reminders & Intentions Method Endpoint Description GET/remindersList reminders POST/remindersCreate reminder (natural language) DELETE/reminders/{id}Delete reminder GET/intentionsList intentions POST/intentionsCreate intention POST/intentions/{id}/toggleToggle intention
Backends Method Endpoint Description GET/backendsList backends with availability POST/backends/installInstall backend SDK
Kits (Command Centers) Method Endpoint Description GET/kits/catalogList kit catalog POST/kits/catalog/{id}/installInstall kit GET/kitsList installed kits DELETE/kits/{id}Uninstall kit POST/kits/{id}/activateActivate kit
Files Method Endpoint Description GET/files/browseList directory contents GET/files/contentGet file content GET/files/recentRecently accessed files
Remote Access Method Endpoint Description GET/remote/statusTunnel status POST/remote/startStart Cloudflare tunnel POST/remote/stopStop tunnel
Events (SSE) Method Endpoint Description GET/events/streamSubscribe to real-time system events
WebSocket Connect to the WebSocket for real-time streaming:
const ws = new WebSocket ( 'ws://localhost:8888/api/v1/ws?token=YOUR_TOKEN' );
content: 'Hello, PocketPaw!' ,
// Receive streaming responses
ws. onmessage = ( event ) => {
const data = JSON . parse (event.data);
// data.type: 'chunk', 'stream_end', 'tool_start', 'tool_result', 'thinking', 'error'
WebSocket paths: /ws, /api/v1/ws, /v1/ws (all equivalent).
Comparison: serve vs Default Mode pocketpaw (default)pocketpaw serveWeb dashboard Served at root Not served REST API /api/v1//api/v1/WebSocket Available Available Auto-opens browser Yes No All backend services Running Running Best for Browser-based usage Desktop app, scripts, headless
OpenAPI Documentation When the API server is running, interactive API docs are available at:
Swagger UI: http://localhost:8888/api/v1/docsReDoc: http://localhost:8888/api/v1/redocOpenAPI JSON: http://localhost:8888/api/v1/openapi.json