API Overview
Canonical reference: docs/api-reference.md (generated endpoint directory) — this page is a task-oriented summary.
ZERG (Sol) exposes 202 spec rows (180 route tuples, including
6 catch-all routers) via a Cowboy HTTP server. All endpoints
accept and return JSON (Content-Type: application/json) unless documented
otherwise (SSE streams, WebSocket, Prometheus text).
Base URL
http://localhost:21434 # dev (zerg-sol container / local node)
https://sol.example.com # production — the operator's edge host
# (WILDZERG fronts Sol with its own reverse proxy)
All paths below are absolute paths on the host. Most application endpoints live
under /api/v1/...; the OpenAI- and Anthropic-compatible inference endpoints
live directly under /v1/... (see OpenAI-compatible).
curl http://localhost:21434/health
Authentication
When mango_auth_enabled is true, most endpoints require authentication.
Three delivery mechanisms are honoured, in priority order:
| Mechanism | Header / value | Notes |
|---|---|---|
| Bearer token (preferred) | Authorization: Bearer <token> | Highest priority; always wins when present. |
| Session cookie | Cookie: zerg_session=<token> | Set on login; used by browser UIs and the WebSocket chat endpoint. |
?token=<token> query | URL query string | Deprecated. Still accepted for SSE/WebSocket clients that cannot set headers, but logs a warning. Prefer the cookie or header. |
Tokens are issued by Authentication (POST /api/v1/auth/login) and
validated through Mango. RBAC permissions are resource:action strings; admin is
the literal permission "*".
Three distinct exemption/gating mechanisms apply at the middleware and handler layers — do not conflate them:
- Auth-exempt paths (
DEFAULT_EXEMPT_PATHS, no token required):/health,/api/v1/health,/api/v1/ready,/api/v1/infra/status,/api/v1/infra/maintenance,/api/v1/shares,/auth/login,/auth/validate,/auth/logout,/api/v1/auth/{login,validate,logout}, and the/api/v1/webhook/prefix (webhook signature IS the auth)./metricsis NOT auth-exempt: tokenless scrapes pass only when the peer is on the loopback topology (or the peer-scopedmetrics_gate_peerallowance); otherwise the middleware answers 403insufficient_permissions. Token-bearing scrapes need themetrics:readRBAC grant. - Maintenance-exempt paths (still require auth; reachable while
maintenance mode 503s everything else):
/health,/api/v1/health,/api/v1/ready,/metrics(subject to the peer/RBAC gate above), the/api/v1/infraprefix,/openapi.json, and/api-docs— note/openapi.jsonand/api-docsare maintenance-exempt only, NOT auth-exempt. /debug/pprof/*is NOT auth-exempt: it is admin-scoped at the middleware (403for non-admins) AND gated by theenable_pprofconfig (defaultfalse→404even for admins until opted in). The OpenResty LAN rule is defense-in-depth for credential-less scrapers, not the authorization.
OpenAI- & Anthropic-compatible
These live at the /v1/ prefix (no /api/) so they can be dropped into
existing OpenAI/Anthropic SDKs and gateway tools:
| Method | Path | Handler action |
|---|---|---|
| POST | /v1/chat/completions | completions |
| POST | /v1/completions | text_completions (FIM; suffix supported) |
| GET | /v1/models | openai_models |
| POST | /v1/messages | messages |
| GET | /v1/messages/:message_id | message_get |
Pagination Envelope
List endpoints paginate via sol_http_pagination. Input is read from the query
string — either ?page=N&per_page=M (1-indexed page) or ?limit=N&offset=M.
limit/per_page are clamped to a maximum of 500.
The response envelope is consistent across all paginated collections:
{
"items": [ ... ],
"total": 137,
"limit": 50,
"offset": 0,
"page": 1,
"total_pages": 3,
"has_more": true
}
Single resources are returned as bare maps (no envelope). Errors speak the
dialect of the API family — drop-in openai/anthropic SDK
clients parse error.message correctly:
| Family | Routes | Error body |
|---|---|---|
| OpenAI | /v1/chat/completions, /v1/models | {"error":{"message":"...","type":"invalid_request_error","param":null,"code":null}} |
| Anthropic | /v1/messages* | {"type":"error","error":{"type":"...","message":"..."}} |
| Zerg | /api/v1/* | {"ok":false,"error":{"code":"...","message":"..."}} (legacy plain {"error":"..."} persists on some handler-level paths) |
Middleware 401 and 403 are family-aware (the route family’s error dialect):
401 carries code unauthorized; auth-rate-limit saturation is a
Fail-closed 503 + Retry-After (rate_limiter_unavailable), never a
401; 403 carries code insufficient_permissions. Capacity is never 500:
429 + Retry-After for seats/quotas, 503 for license/circuit outages,
413 for oversized bodies.
Interactive Docs
Swagger UI: /api-docs
OpenAPI 3.1 spec: /openapi.json
Prometheus metrics: /metrics (text exposition format; peer-gated —
tokenless only on the loopback topology, otherwise metrics:read)
Endpoint Categories
Counts below are the generated tag families in the spec (202 rows total;
the generated directory in docs/api-reference.md is the authoritative
list; ci/gen_api_reference.py --check derives both the total and the
per-family counts).
| Family (generated tag) | Count | Description |
|---|---|---|
| ACP Agents | 5 | Agent Capability Protocol discovery/dispatch |
| Audit | 6 | Audit read surface + anchored chain verify |
| Auth | 10 | Login / validate / revoke / password / service tokens / admin erasure |
| Channels | 8 | Delivery channels + inbound webhook |
| Chat | 16 | Interactive chat (HTTP + SSE + WebSocket) |
| Cluster | 6 | Cluster membership + circuit breakers + catalog |
| Completions | 3 | OpenAI chat + FIM + Anthropic Messages |
| Conversations | 6 | Conversation sessions and streams |
| Events | 2 | Event query + SSE stream |
| Goals | 6 | Goal tracking |
| Health | 8 | Liveness + deep readiness |
| Inference | 13 | Model registry, lifecycle, prepare |
| Infra | 9 | Maintenance, cache invalidation, status, cache affinity |
| Marketplace | 13 | Browse / publish / rate / report skills |
| Memory | 13 | Vector + scalar memory store |
| Persistence | 3 | Event-store flush + stats |
| Plugins | 3 | Luerl plugin eval + workers |
| Providers | 1 | Provider health + declarative reload |
| Recipes | 4 | Declarative workflow templates |
| Replay | 1 | Session event replay |
| Scheduler | 7 | Cron / every / at jobs |
| Seats | 1 | Seat/license surface |
| Sessions | 4 | Session shares |
| Skills | 2 | Local skill registry |
| Supervisor | 2 | OTP supervisor tree introspection |
| Teams | 11 | Team + role + mailbox management |
| Telemetry | 3 | Per-agent telemetry |
| Webhooks | 1 | Inbound webhook receiver |
| Workers | 16 | ZMQ dispatch, tasks, orchestration, local/bg workers |
| Workflows | 11 | Multi-step agent workflows |
| Workspace | 5 | File operations |
| ZMQ | 3 | Worker/fleet status |
Endpoint Index (grouped)
Health & Readiness
GET /health — liveness (always 200)
GET /api/v1/health — shallow health ({status, models_running})
GET /api/v1/ready — deep readiness (19 subsystem checks)
Infra
GET /api/v1/infra/status
GET /api/v1/infra/maintenance
POST /api/v1/infra/maintenance/enable
POST /api/v1/infra/maintenance/disable
POST /api/v1/infra/cache-invalidate
GET /api/v1/infra/cache-affinity
DELETE /api/v1/infra/cache-affinity
Inference (models)
GET /api/v1/models
GET /api/v1/models/metadata
GET /api/v1/models/:name
GET /api/v1/ps
GET /api/v1/metrics
POST /api/v1/discover
POST /api/v1/start
POST /api/v1/stop
POST /api/v1/stop-all
POST /api/v1/prepare/:name (POST-only; GET answers 405)
OpenAI- & Anthropic-compatible
POST /v1/chat/completions
POST /v1/completions (FIM; suffix supported)
GET /v1/models
POST /v1/messages
GET /v1/messages/:message_id
Workers — ZMQ
GET /api/v1/zmq/workers
POST /api/v1/zmq/dispatch
GET /api/v1/zmq/status
GET /api/v1/tasks
GET /api/v1/tasks/:task_id
DELETE /api/v1/tasks/:task_id
POST /api/v1/orchestrate
GET /api/v1/orchestrate/:id
Workers — local JSONL agents
GET /api/v1/agents
POST /api/v1/agents/spawn
GET /api/v1/agents/:id
POST /api/v1/agents/:id/task
POST /api/v1/agents/:id/kill
Workers — background
POST /api/v1/workers/bg/start
GET /api/v1/workers/bg
GET /api/v1/workers/bg/:bg_id
GET /api/v1/workers/bg/:bg_id/status
GET /api/v1/workers/bg/:bg_id/logs
POST /api/v1/workers/bg/:bg_id/kill
Scheduler (singular /schedule)
GET /api/v1/schedule
POST /api/v1/schedule/spawn
GET /api/v1/schedule/:id
DELETE /api/v1/schedule/:id
POST /api/v1/schedule/:id/pause
POST /api/v1/schedule/:id/unpause
POST /api/v1/schedule/:id/run
Channels
GET /api/v1/channels
POST /api/v1/channels/spawn
GET /api/v1/channels/:id
DELETE /api/v1/channels/:id
POST /api/v1/channels/:id/test
POST /api/v1/channels/:id/message
POST /api/v1/channels/:id/pause
POST /api/v1/channels/:id/resume
POST /api/v1/webhook/:channel_id (inbound webhook receiver)
Workflows
GET /api/v1/workflows
POST /api/v1/workflows/start
GET /api/v1/workflows/:id
POST /api/v1/workflows/:id/cancel
POST /api/v1/workflows/:id/branch
GET /api/v1/workflows/:id/tree
GET /api/v1/workflows/:id/lineage
POST /api/v1/workflows/:id/pause
POST /api/v1/workflows/:id/resume
GET /api/v1/workflows/:id/stream (SSE)
Recipes
GET /api/v1/recipes
POST /api/v1/recipes/reload
GET /api/v1/recipes/:name
POST /api/v1/recipes/:name/run
Memory
POST /api/v1/memory/store
GET /api/v1/memory/stats
GET /api/v1/memory/:agent_id
GET /api/v1/memory/:agent_id/search
POST /api/v1/memory/:agent_id/clear
GET /api/v1/memory/:agent_id/:key
POST /api/v1/memory/:agent_id/:key/delete
POST /api/v1/memory/:agent_id/vector-search
POST /api/v1/memory/:agent_id/decay
GET /api/v1/memory/:agent_id/reflections
POST /api/v1/memory/:agent_id/:key/pin
Conversations
GET /api/v1/conversations
GET /api/v1/conversations/:conv_id
POST /api/v1/conversations/:conv_id/delete
GET /api/v1/conversations/:conv_id/usage
GET /api/v1/conversations/:conv_id/stream
Chat
POST /api/v1/chat
GET /api/v1/chat/:id
DELETE /api/v1/chat/:id
POST /api/v1/chat/:id/message
GET /api/v1/chat/:id/stream (SSE)
GET /api/v1/chat/:id/history
GET /api/v1/chat/:session_id/ws (WebSocket)
ACP (Agent Capability Protocol)
GET /api/v1/acp/agents
GET /api/v1/acp/agents/discover
GET /api/v1/acp/agents/capabilities
GET /api/v1/acp/agents/:agent_id
POST /api/v1/acp/agents/:agent_id/message
Skills & Marketplace
GET /api/v1/skills
GET /api/v1/skills/:name
GET /api/v1/marketplace
GET /api/v1/marketplace/search
POST /api/v1/marketplace/feature
POST /api/v1/marketplace/rate
GET /api/v1/marketplace/ratings
GET /api/v1/marketplace/reports
POST /api/v1/marketplace/reports/:id/dismiss
GET /api/v1/marketplace/:name
GET /api/v1/marketplace/:name/:author
POST /api/v1/marketplace/:name/:author/report
Lua Plugins (Luerl)
POST /api/v1/lua/eval
GET /api/v1/lua/workers
POST /api/v1/lua/workers/spawn
Events
GET /api/v1/events
GET /api/v1/sync-events (SSE)
Audit
GET /api/v1/audit/events
GET /api/v1/audit/tool-executions
GET /api/v1/audit/permission-decisions
GET /api/v1/audit/llm-decisions
GET /api/v1/audit/summary
Auth
POST /api/v1/auth/login
GET /api/v1/auth/validate
POST /api/v1/auth/logout
Cluster & Circuit Breakers
GET /api/v1/cluster
POST /api/v1/cluster/join
POST /api/v1/cluster/leave
GET /api/v1/catalog
GET /api/v1/circuits
POST /api/v1/circuits/reset
Providers
GET /api/v1/providers/health
GET /api/v1/providers/health/:name
POST /api/v1/providers/reload
Persistence
GET /api/v1/persistence/status
POST /api/v1/persistence/flush
GET /api/v1/persistence/audit-stats
Telemetry
GET /api/v1/telemetry
POST /api/v1/telemetry/clear
GET /api/v1/telemetry/:agent_id
Supervisor
GET /api/v1/supervisor/tree
GET /api/v1/supervisor/children/:name
Teams
GET /api/v1/teams
POST /api/v1/teams
GET /api/v1/teams/:id
DELETE /api/v1/teams/:id
POST /api/v1/teams/:id/members
DELETE /api/v1/teams/:id/members/:worker_id
POST /api/v1/teams/:id/mail
Sessions & Shares
… /api/v1/sessions/... (catch-all router)
GET /api/v1/shares/:share_id
Goals / Replay / Workspace (catch-all routers)
… /api/v1/goals/...
… /api/v1/replay/...
… /api/v1/workspace/...
Managed Settings
GET /api/v1/managed-settings
Debug & Profiling
POST /debug/pprof/profile
POST /debug/pprof/heap (admin-scoped + enable_pprof opt-in — 404 while disabled; not auth-exempt; POST-only)
POST /api/v1/debug/flamegraph (admin; POST-only)
Self-documentation & Scrape
GET /openapi.json (conditional on openapi_enabled)
GET /api-docs (conditional on openapi_enabled)
GET /metrics (conditional on prometheus_enabled; peer-gated)
Conventions
Shell is POSIX for any CLI examples; curl is used throughout.
IDs in paths (:id, :task_id, :agent_id, :name) are URL path
segments, not query parameters.
/api/v1/schedule is singular (not /schedules) — see
Scheduler.
Catch-all routers (/api/v1/sessions/[...], /api/v1/infra/[...],
/api/v1/goals/[...], /api/v1/replay/[...],
/api/v1/auth/[...], /api/v1/workspace/[...]) dispatch internally on path
segments and method — see each handler for the resolved sub-routes.