Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Engine reference — generated from the canonical engineering source. Do not edit this page by hand.

API Reference

Sol exposes a Cowboy HTTP API on port 21434 (configurable). All endpoints return JSON unless otherwise noted. Streaming endpoints use Server-Sent Events (SSE).

Base URL

http://127.0.0.1:21434

Default bind address is 127.0.0.1. Change with http_ip config or SOL_HTTP_IP env var.

Authentication

Bearer token authentication via Authorization: Bearer <key> header. Auth modes: Local mode — static API keys configured in sys.config ({auth_tokens, ["key1", "key2"]}) or with per-token permissions ({auth_tokens, [{<<"key1">>, [<<"tasks:read">>]}]}); a bare token grants * (CRITICAL-logged at boot until migrated). Mango mode — tokens validated against Mango auth service at /auth/validate

Mango validation is the FIRST layer: a valid token is not admission. Sol’s middleware then runs its OWN per-route RBAC/ownership layer against the validated grant ({METHOD, path} => scope, owner scopes, admin rules). A route with no rule is refused by default (authz_unmapped, 403) — the token alone never authorizes a route.

x-api-key: <key> is accepted as a bearer-equivalent credential (the native Anthropic SDK header). Authorization wins when both are present; neither is an ambient credential, so both follow the bearer CSRF contract.

Health endpoint (/health) is exempt. Unauthenticated requests to other endpoints return 401.

Pagination

All list endpoints support two mutually exclusive cursor styles (source: sol_http_pagination.erl parse_pagination/1):

ParameterDefaultMaxDescription
limit50500Maximum items to return
offset0—Number of items to skip
page0—1-based page number — only honored when per_page is also given
per_page0—Items per page (capped at 500) — when BOTH page and per_page are > 0 they override limit/offset (offset = (page-1) × per_page)

Paginated response format (paginate_list/2):

{
    "items": [...],
    "total": 142,
    "limit": 50,
    "offset": 0,
    "page": 1,
    "total_pages": 3,
    "has_more": true
}

page/total_pages are always present (1-based); has_more is false on the last page.

Paginated endpoints: GET /api/v1/models, GET /api/v1/agents, GET /api/v1/tasks, GET /api/v1/catalog, GET /api/v1/channels, GET /api/v1/circuits, GET /api/v1/schedule, GET /api/v1/zmq/workers, GET /api/v1/events, GET /api/v1/skills, GET /api/v1/workflows, GET /api/v1/goals, GET /api/v1/cluster, GET /api/v1/audit/events, GET /api/v1/memory/:agent_id (default limit 50), GET /api/v1/memory/:agent_id/search (default limit 20). The marketplace browse is deliberately NOT in this list — it answers the flat {"skills": [...]} shape (see its section below).

Response Format

Success (JSON) — three real dialects

There is no single success envelope. The body is the resource projection itself, in one of three dialects (the code is the source; every client already parses them this way):

DialectShapeExamples
Resource objectthe resource’s own fields at the top levelGET /api/v1/health → {"status":"ok","models_running":2}; GET /api/v1/models/:name → a model row
Page{"items":[...],"total":N,"limit":50,"offset":0,"page":1,"total_pages":3,"has_more":true} — see Paginationevery list endpoint in the pagination table (/api/v1/models, /api/v1/tasks, /api/v1/events, …); GET /api/v1/goals answers the same metadata with goals in place of items
Ack envelope{"ok":true,...} where ... carries the affected resource when one existsGET /api/v1/teams → {"ok":true,"teams":[...]}; POST /api/v1/teams → {"ok":true,"team":{...}}; mutations → {"ok":true}

The OpenAI (/v1/chat/completions) and Anthropic (/v1/messages) routes keep their upstream dialects; see the family table under Error below.

Error (JSON) — one envelope per API family

Errors speak the dialect of the API family that produced them, so drop-in openai/anthropic SDK clients parse error.message correctly. Since Every handler error — and the auth middleware’s 401/403 — emits the family envelope; the retired flat {"error":"string"} shape is gone:

FamilyRoutesError body
OpenAI/v1/chat/completions, /v1/models{"error":{"message":"...","type":"invalid_request_error","param":null,"code":null}}
Anthropic/v1/messages, /v1/messages/:id{"type":"error","error":{"type":"invalid_request_error","message":"..."}}
Zerg/api/v1/*{"ok":false,"error":{"code":"...","message":"..."}}

Mango identity API is a DOCUMENTED second dialect: the Mango service (/auth/* on the Mango base URL) still emits the flat {"error":"string"} body on errors — a deliberate cheap-honest deferral, not an oversight. Limon’s HTTP clients unwrap BOTH shapes (envelope error.message/error.code first, legacy flat string as the fallback), and both unwraps are contract-tested. Sol’s /api/v1/auth/* proxy rows answer the Zerg envelope like every other /api/v1/* route. Teams speaks the Zerg envelope everywhere: the teams handler was the last Sol surface still replying flat bodies on some arms . All teams 4xx now carry {"ok":false,"error":{"code","message"}} with the catalog vocabulary (forbidden, not_found, method_not_allowed, body_too_large, bad_request, invalid_worker_id, unroutable_to).

Mango identity-plane contract notes:

GET /ready caches its DB/migration/instance verdict for ~1s for non-loopback callers (loopback stays live); every other outcome is a typed 503 + Retry-After. POST /auth/service-token answers the uniform 403 {"error": "forbidden"} for every non-success credential/shape failure; the service/bridge/audit/archive secrets have a 16-byte boot floor. Security booleans (on/off, true/false, 1/0, yes/no) refuse boot on any other spelling; MANGO_REQUIRE_AUTH=true blocks anonymous requests centrally (401). POST /orchestrator/lease is bound to the token user; a stale steal by a different principal requires takeover authority, and an optional epoch in the body is CAS-checked (409 lease_epoch_stale). POST /api/mango/audit-archive validates timestamp/source/ aggregate_id/event_type types and lengths (400) and maps DB failures to a typed 503; the audit-chain verdict is ok=false when unanchored/truncated, and a restored older checkpoint is refused.

401/403 from the auth middleware are family-aware: both the 401 and the 403 render the route family’s dialect — 401 carries code unauthorized; auth-rate-limit saturation is a fail-closed 503 + Retry-After (rate_limiter_unavailable), never a 401; the 403 code vocabulary is in the catalog below. Capacity is never a 500: seat/worker exhaustion → 429 with Retry-After: 1 (seat_cap_reached, max_workers_reached); license outage → 503 license_unavailable; scheduler quotas → 429 (max_jobs_reached, per_user_limit_reached); all provider circuits open → 503. Upstream timeouts are never a 500: on the buffered completion surfaces a pipeline timeout family — total timeout, first_token_timeout, idle_timeout — answers 504 (server_error on the OpenAI wire, overloaded_error on the Anthropic wire); connect failures (connect_failed, connect_exhausted, connection_down) answer 502 api_error; every provider key cooling down (provider_exhausted) answers 429 rate_limit_error with Retry-After: 1. The same ladder runs on both dialects (/v1/chat/completions and /v1/messages). SSE connection-budget refusal is 429 on every route (; body envelope re-anchored ): when the max_sse_connections budget is full, ALL completion/stream surfaces — /v1/chat/completions (stream and buffered), /v1/messages (stream and buffered), the chat stream, and the event/workflow/conversation streams — answer 429 sse_limit_reached with Retry-After: 1 and the Zerg OBJECT envelope {"ok":false,"error":{"code":"sse_limit_reached","message":"..."}} (one shape, previous the completion planes answered 503; previous the body was the retired flat string form). The check runs BEFORE the serving slot is reserved: a refused request never occupies an admission slot. The chat stream additionally holds its slot for the WHOLE stream (, — previous the slot was released at handshake and the budget never bounded chat). Malformed /v1/messages blocks are 400: assistant/user tool_use blocks require string id + string name + object input, tool_result blocks require string tool_use_id — violations answer 400 invalid_request_error with the offending block type named . Unknown block types keep the pass-through posture. Retired responses wire: the OpenAI Responses API adapter is a documented refusal — declarative provider configs declaring format: "responses" fail validation, boot registers no responses-adapter models, and requests naming a responses model cannot resolve. Use the openai or anthropic wire. Oversized bodies → 413 with the ONE code body_too_large everywhere (the payload_too_large spelling is retired — one catalog entry, ). Mango identity API: the 10MB body cap is enforced on the DECODED length regardless of transfer encoding (chunked bodies carry no Content-Length; Tornado’s Application-level max_body_size closes the bypass, with a decoded-length re-check on direct paths). 409 conflict semantics: JSON read-modify-write endpoints (Mango PATCH /users, team cost-centers/caps) return 409 conflict on concurrent modification — the updated_at compare-and-swap detects a stale read; retry the operation. trusted_proxies (app setting or MANGO_TRUSTED_PROXIES) controls which peers may supply X-Forwarded-For/X-Real-IP; the client is the rightmost-untrusted hop. Global-trust CIDRs (0.0.0.0/0, ::/0) are REJECTED at parse (CRITICAL + dropped — fail toward untrusted) unless MANGO_ALLOW_GLOBAL_TRUST=true . Provider failures are 503 (never 500): provider circuits and all_circuits_open → 503 circuit open / all providers unavailable; upstream errors (http_error, connect_exhausted, output_exceeded_cap, timeout, first_token_timeout, idle_timeout, parse_error) → 503 with the reason in the body. Interrupted streams: an SSE error frame emitted AFTER content tokens carries "truncated": true so clients can distinguish a partial answer from a failed-before-output one.

Error-code catalog

One shared classifier (sol_http_json:classify_error) turns every {error, Reason} backend failure into a status + code. The classes:

StatusCodeWhen
503service_unavailableStore/gen_server outage — mnesia aborted/no_exists, noproc, timeout, shutdown, killed, local econnrefused, resource exhaustion (enospc/enfile/emfile). Temporary; safe to retry.
502upstream_errorRemote/upstream failure — exec-class exit_status, cluster node_unreachable/noconnection, remote http_error/connect_exhausted.
500internal_errorGenuinely-internal fault (the catch-all armor arms only). A 500 is always a bug worth reporting.

Catalog codes clients should dispatch on (Zerg family, error.code):

CodeStatusSemantics
body_too_large413The ONE oversized-body code (request body, session-share data, file reads past the cap).
forbidden403Resource-ownership denial — the record exists but belongs to another user (owner-check arms).
insufficient_permissions403RBAC/route-gate denial — the token lacks the permission or admin bit (middleware 403, admin-gated endpoints).
unauthorized401Missing/invalid/expired token (middleware 401).
service_unavailable503Backend outage (the 503 class above).
upstream_error502Remote failure (the 502 class above).

Endpoint-specific codes (seat_cap_reached, share_quota_exceeded, max_jobs_reached, workflow not found-class 404s, …) keep their documented statuses; the catalog above is the shared vocabulary on top.

Additional catalog entries:

CodeStatusMeaning
worker_unavailable503The session’s worker is not serving — dead worker, noproc, or the typed worker_not_found pipeline-attach refusal (worker died between the stream-liveness gate and pipeline start). Both the REST message path and the WS path share one classifier.
auth_disabled503POST /api/v1/auth/login with Mango auth disabled system-wide — an outage of the auth subsystem, never a success.
unknown_parameter400A removed/unrecognized query pseudo-value — currently ?aggregate=all on GET /api/v1/events.
aggregate_scan_limit_exceeded400A caller-scoped aggregate read would scan past the server’s bounded index-row cap; narrow the aggregate scope or resume with from_seq/cursor.
invalid_cursor400?cursor= is not the <seq>:<event_id> form returned in next_cursor.
cursor_with_offset / cursor_with_from_seq400The {seq,event_id} cursor already names the resume point; combining it with offset or from_seq would skip/duplicate rows.
pprof_disabled / profiling_failed / heap_profiling_failed / flamegraph_failed / not_found404/403/500The debug endpoints’ envelope codes.
auth_rate_limited503Token validation was refused because Mango answered 429 (the global auth limiter’s burst response) — a RETRYABLE-TRANSIENT condition, never cached as a failed validation; the response carries retry-after and the next request re-validates.
csrf_required403A mutating request whose credential is the ambient zerg_session cookie without the zerg_csrf double-submit pair.
invalid_request_path400The raw path cannot be represented unambiguously by the router: an encoded separator (%2F/%5C), an empty internal segment (//), an invalid percent escape, a control byte, or a non-absolute path.
method not allowed405A bare OPTIONS (not a genuine CORS preflight) or a HEAD on a path whose only rules are for other methods. The response carries the route’s Allow set; HEAD otherwise authorizes exactly as GET.

Documented residuals (not envelope emissions): webhook raw bodies (the empty-body platform acks, and the Teams validationToken text/plain echo below) are wire contracts, not error envelopes; the rate-limiter capacity shapes, the maintenance gate (maintenance_mode + reason), and the memory subsystem-off 503 ({"error": "memory_subsystem_disabled", "enabled": false} on every /api/v1/memory/* route while Sol memory is disabled — /, CT-2: retained in its historical flat shape, consumed by Limon’s unwrap fallback) keep their documented flat bodies; error fields inside SSE data: frames and per-item result lists are stream/data payloads, not HTTP error envelopes.

Internal Erlang terms are sanitized and never leaked to clients.

Streaming (SSE)

data: {"choices": [{"delta": {"content": "Hello"}, ...}]}

data: [DONE]

Interrupted streams

When the upstream provider connection dies mid-generation, the terminal is honest — a truncated response is never reported as a complete one. The three terminals:

OpenAI-wire SSE (/v1/chat/completions, "stream": true): the final chunk carries "finish_reason": "interrupted" (a non-stop reason in the normal chunk shape), followed by the regular data: [DONE] framing so spec-compliant clients terminate cleanly. Tokens already delivered remain valid; the delivered-token count is the accounting floor. Anthropic-wire SSE (/v1/messages, "stream": true): the stream ends with an in-band terminal event: error frame carrying {"type":"error","error":{"type":"api_error","message":"..."}} — no fabricated message_delta end_turn / message_stop completion. Buffered non-streaming ("stream": false, both wires): the reply had not started, so the honest shape is HTTP 502 (upstream class) in the route family’s error envelope — OpenAI {"error":{...}} / Anthropic {"type":"error","error":{...}} with the message upstream connection interrupted mid-response (truncated). Never a 200 envelope with a fabricated finish_reason/stop_reason.

Endpoint Directory (generated)

Health

MethodPathHandler actionDescription
GET/api/v1/healthhealthHealth check
GET/api/v1/providers/healthprovider_healthAll provider health checks
GET/api/v1/providers/health/:nameprovider_health_singleSingle provider health check
GET/api/v1/readyreadyReadiness check
GET/api/v1/skillsskillsList skills
GET/api/v1/skills/:nameskill_detailGet skill details
GET/metricsprometheus_metricsPrometheus metrics — : no longer anonymous. Loopback peers scrape tokenless; non-loopback requires a bearer with metrics:read (tokenless external → typed 403). GET only
GET/v1/modelsopenai_modelsOpenAI-compatible models list

Inference

MethodPathHandler actionDescription
POST/api/v1/discoverdiscoverDiscover models from storage
GET/api/v1/inference/laneslanesList the fleet lane inventory (sanitized; includes the use_case facet)
POST/api/v1/inference/lanes/:lane/validatelane_validateProbe or commit a lane validation record (admin)
GET/api/v1/metricsmetricsGet metrics counters
GET/api/v1/modelsmodelsList registered models
GET/api/v1/models/:namemodel_detailGet model details
GET/api/v1/models/metadatamodel_metadataGet registry metadata for all known models
POST/api/v1/prepare/:namepreparePrepare model for serving
GET/api/v1/pspsList running models
POST/api/v1/startstartStart a model
POST/api/v1/stopstopStop a model
POST/api/v1/stop-allstop_allStop all models
GET/api/v1/usageusageGet per-principal inference usage/spend totals (self; admin may pass?user_uuid=;?from/?to=YYYY-MM-DD)

Completions

MethodPathHandler actionDescription
POST/v1/chat/completionscompletionsOpenAI chat completions
POST/v1/completionstext_completionsOpenAI legacy text completions (FIM; non-streaming)
POST/v1/messagesmessagesAnthropic Messages API

Workers

MethodPathHandler actionDescription
GET/api/v1/agentsagentsList running agents (legacy)
GET/api/v1/agents/:idagent_detailGet agent details
POST/api/v1/agents/:id/killagent_killKill an agent
POST/api/v1/agents/:id/taskagent_taskDispatch task to agent
POST/api/v1/agents/spawnagent_spawnSpawn a new agent
POST/api/v1/orchestrateorchestrateOrchestrate a task
GET/api/v1/orchestrate/:idorchestrate_detailGet orchestration details
GET/api/v1/taskstask_listList all tasks
GET/api/v1/tasks/:task_idtask_getGet a stored task result (owner or admin)
DELETE/api/v1/tasks/:task_idtask_statusCancel a task (owner or admin)
GET/api/v1/tasks/outboxtask_outboxList outstanding dispatch receipts
GET/api/v1/workers/bgbg_listList background workers
GET/api/v1/workers/bg/:bg_idbg_statusGet background worker status
POST/api/v1/workers/bg/:bg_id/killbg_killKill a background worker
GET/api/v1/workers/bg/:bg_id/logsbg_logsGet background worker logs
POST/api/v1/workers/bg/startbg_startStart a background worker

Scheduler

MethodPathHandler actionDescription
GET/api/v1/scheduleschedule_listList scheduled jobs
DELETE/api/v1/schedule/:idschedule_deleteDelete a scheduled job (admin; 409 while the job is running)
GET/api/v1/schedule/:idschedule_detailGet job details
POST/api/v1/schedule/:id/pauseschedule_pausePause a job
POST/api/v1/schedule/:id/runschedule_runRun a job immediately
POST/api/v1/schedule/:id/unpauseschedule_unpauseUnpause a job
POST/api/v1/schedule/spawnschedule_createCreate a scheduled job

Channels

MethodPathHandler actionDescription
GET/api/v1/channelschannelsList channels
GET/api/v1/channels/:idchannel_detailGet channel details
DELETE/api/v1/channels/:idchannel_deleteDelete a channel
POST/api/v1/channels/:id/messagechannel_messageSend message to channel
POST/api/v1/channels/:id/pausechannel_pausePause a channel (POST only)
POST/api/v1/channels/:id/resumechannel_resumeResume a channel (POST only)
POST/api/v1/channels/:id/testchannel_testSend test message (POST only; admin)
POST/api/v1/channels/spawnchannel_createCreate a channel

Memory

MethodPathHandler actionDescription
GET/api/v1/memory/:agent_idmemory_listList memories for agent
GET/api/v1/memory/:agent_id/:keymemory_retrieveRetrieve a memory entry
DELETE/api/v1/memory/:agent_id/:keymemory_delete_restDelete a memory entry (REST-correct form; ownership-checked)
POST/api/v1/memory/:agent_id/:key/deletememory_deleteDelete a memory entry (legacy POST action form)
POST/api/v1/memory/:agent_id/:key/pinmemory_pinPin a memory entry
POST/api/v1/memory/:agent_id/clearmemory_clearClear agent memories (owner-scoped wipe; admin clears the full namespace)
POST/api/v1/memory/:agent_id/decaymemory_decayRun memory decay
GET/api/v1/memory/:agent_id/reflectionsmemory_reflectionsGet memory reflections
GET/api/v1/memory/:agent_id/searchmemory_searchSearch agent memories
GET/api/v1/memory/:agent_id/statsmemory_agent_statsGet per-agent memory stats (entry count + total bytes)
POST/api/v1/memory/:agent_id/vector-searchmemory_vector_searchVector similarity search
GET/api/v1/memory/statsmemory_statsGet memory statistics
POST/api/v1/memory/storememory_storeStore a memory entry

Events

MethodPathHandler actionDescription
GET/api/v1/eventsevents_queryQuery events
GET/api/v1/sync-eventssync_events_streamSSE event stream

Workflows

MethodPathHandler actionDescription
GET/api/v1/workflowsworkflows_listList workflows
GET/api/v1/workflows/:idworkflow_detailGet workflow details
POST/api/v1/workflows/:id/branchworkflow_branchBranch a workflow
POST/api/v1/workflows/:id/cancelworkflow_cancelCancel a workflow
POST/api/v1/workflows/:id/compensation/retryworkflow_compensation_retryRetry a pending workflow compensation
GET/api/v1/workflows/:id/lineageworkflow_lineageGet workflow lineage
POST/api/v1/workflows/:id/pauseworkflow_pausePause a workflow
POST/api/v1/workflows/:id/resumeworkflow_resumeResume a workflow
GET/api/v1/workflows/:id/streamworkflow_streamStream workflow events
GET/api/v1/workflows/:id/treeworkflow_treeGet workflow tree
POST/api/v1/workflows/startworkflow_startStart a workflow

Teams

MethodPathHandler actionDescription
GET/api/v1/teamsteams_listList teams
POST/api/v1/teamsteam_createCreate a team
GET/api/v1/teams/:idteam_detailGet team details
POST/api/v1/teams/:idteam_add_memberAdd a team member
DELETE/api/v1/teams/:idteam_destroyDestroy a team
POST/api/v1/teams/:id/mailteam_mailSend team mail
GET/api/v1/teams/:id/mailteam_mail_readRead team mail (non-destructive;?mine=1 scopes to the caller’s membership)
POST/api/v1/teams/:id/mail/:message_id/ackteam_mail_ackAcknowledge one team-mail message
GET/api/v1/teams/:id/membersteam_members_listList team members (membership-gated)
POST/api/v1/teams/:id/membersteam_membersManage team members
DELETE/api/v1/teams/:id/members/:worker_idteam_member_removeRemove team member

Workspace

MethodPathHandler actionDescription
POST/api/v1/workspace/editworkspace_editEdit a workspace file (find and replace)
GET/api/v1/workspace/listworkspace_listList workspace files
POST/api/v1/workspace/readworkspace_readRead a workspace file
POST/api/v1/workspace/searchworkspace_searchSearch workspace files by pattern
POST/api/v1/workspace/writeworkspace_writeWrite a workspace file

Recipes

MethodPathHandler actionDescription
GET/api/v1/recipesrecipes_listList recipes
GET/api/v1/recipes/:namerecipe_detailGet recipe details
POST/api/v1/recipes/:name/runrecipe_runRun a recipe
POST/api/v1/recipes/reloadrecipes_reloadReload recipes

Marketplace

MethodPathHandler actionDescription
GET/api/v1/marketplacemarketplace_browseBrowse marketplace skills
POST/api/v1/marketplacemarketplace_publishPublish a skill
GET/api/v1/marketplace/:namemarketplace_detailGet skill detail
GET/api/v1/marketplace/:name/:authormarketplace_author_detailGet skill detail by exact author (two-segment form)
DELETE/api/v1/marketplace/:name/:authormarketplace_deleteDelete a published skill
POST/api/v1/marketplace/:name/:author/installmarketplace_installInstall a skill (full body + provenance)
POST/api/v1/marketplace/:name/:author/reportmarketplace_reportReport a skill
POST/api/v1/marketplace/featuremarketplace_featureFeature a skill (admin)
POST/api/v1/marketplace/ratemarketplace_rateRate a skill
GET/api/v1/marketplace/ratingsmarketplace_ratingsGet ratings for a skill
GET/api/v1/marketplace/reportsmarketplace_reportsList skill reports
POST/api/v1/marketplace/reports/:id/dismissmarketplace_dismissDismiss a skill report
GET/api/v1/marketplace/searchmarketplace_searchSearch marketplace

Skills

MethodPathHandler actionDescription
POST/api/v1/skillsskills_registerRegister a skill
DELETE/api/v1/skills/:nameskills_deleteDelete a skill

Cluster

MethodPathHandler actionDescription
GET/api/v1/catalogcatalog_listGlobal model catalog
GET/api/v1/circuitscircuitsList circuit breakers
POST/api/v1/circuits/resetcircuit_resetReset circuit breaker
GET/api/v1/clustercluster_statusCluster status
POST/api/v1/cluster/joincluster_joinJoin a cluster node
POST/api/v1/cluster/leavecluster_leaveLeave the cluster

Auth

MethodPathHandler actionDescription
POST/api/v1/admin/tokens/:token_id/revokeadmin_revoke_tokenRevoke one Mango token by its persisted SHA-256 id (admin; strict audit). token_id is the 64-hex token id from the service-token listing; the Sol service principal performs POST /auth/tokens/:id/revoke at Mango. Typed answers: 400 invalid_token_id, 403 non-admin caller, 404 token not found, 503 audit/Mango-admin outage
POST/api/v1/admin/users/:user_uuid/eraseadmin_erase_userErase a deleted principal’s Sol data (admin; strict audit). Tombstones the identity, cancels/refuses live tasks and dispatch receipts, purges chat/memory/share/team rows and returns an erasure receipt; audit + billing rows are explicit retained exceptions. DRY-RUN unless the body carries dry_run: false AND confirm equal to the user uuid. Typed answers: 400 invalid_user_uuid/confirmation_required, 403 non-admin caller, 503 audit/tombstone outage (the receipt is returned when the purge ran but its audit did not land)
POST/api/v1/admin/users/:user_uuid/unlockadmin_unlock_accountClear a Mango account lockout (admin; strict audit). user_uuid must be the 36-char uuid; the Sol service principal performs DELETE /auth/accounts/:uuid/lock at Mango. Typed answers: 400 invalid_user_uuid, 403 non-admin caller, 404 user not found, 503 audit/Mango-admin outage
POST/api/v1/auth/loginauth_loginLogin via Mango auth
POST/api/v1/auth/logoutauth_logoutLogout
GET/api/v1/auth/validateauth_validateValidate auth token
POST/api/v1/oauth/loginoauth_loginBegin an OAuth PKCE login for a declarative provider (admin). Body {provider}; returns the authorize_url to open, the redirect_uri the browser will hit, and the CSRF state the callback must echo. The PKCE verifier stays server-side
POST/api/v1/oauth/login/completeoauth_login_completeComplete an OAuth PKCE login (admin). Body {state, code} from the callback; Sol exchanges the code at the provider token_url (PKCE S256), persists access+refresh tokens 0600, and re-registers the declarative providers so the key is live. Typed answers: 400 unknown_state, 410 login_expired, 502 oauth_exchange_failed
GET/api/v1/oauth/providersoauth_providersList providers with a stored OAuth token (admin; names only, never tokens)
DELETE/api/v1/oauth/providers/:provideroauth_provider_deleteDelete the stored OAuth token for a provider (admin; strict audit). The provider falls back to keyring/env resolution

Persistence

MethodPathHandler actionDescription
GET/api/v1/persistence/audit-statspersistence_audit_statsPersistence audit stats
POST/api/v1/persistence/flushpersistence_flushFlush persistence buffer
GET/api/v1/persistence/statuspersistence_statusPersistence status

Plugins

MethodPathHandler actionDescription
POST/api/v1/lua/evallua_evalEvaluate Lua code
GET/api/v1/lua/workerslua_workersList Lua workers
POST/api/v1/lua/workers/spawnlua_worker_spawnSpawn Lua worker

Webhooks

MethodPathHandler actionDescription
POST/api/v1/webhook/:channel_idwebhook_deliverDeliver a webhook message

Chat

MethodPathHandler actionDescription
GET/api/v1/chatchat_listList chat sessions (caller-scoped)
POST/api/v1/chatchat_createCreate chat session
GET/api/v1/chat/:idchat_getGet chat session
DELETE/api/v1/chat/:idchat_deleteEnd chat session
POST/api/v1/chat/:id/branchbranch_checkoutCheck out a session branch
GET/api/v1/chat/:id/branchesbranchesList the worker’s session branches
GET/api/v1/chat/:id/historychat_historyGet chat history
POST/api/v1/chat/:id/messagechat_messageSend chat message
GET/api/v1/chat/:id/snapshotssnapshotsList the worker’s git snapshots
GET/api/v1/chat/:id/snapshots/:snapshot_id/diffsnapshot_diffBounded snapshot diff summary
POST/api/v1/chat/:id/snapshots/:snapshot_id/restoresnapshot_restoreRestore a git snapshot
GET/api/v1/chat/:id/streamchat_streamSSE chat stream
POST/api/v1/chat/:id/ws-ticketchat_ws_ticketMint a one-time WebSocket auth ticket for the session
GET/api/v1/chat/:session_id/wschat_wsWebSocket chat stream
GET/api/v1/permissionspermissions_listList pending permission asks (self; admin sees all;?session_id= narrows)
POST/api/v1/permissions/:id/replypermission_replyResolve a pending permission ask (allow

Conversations

MethodPathHandler actionDescription
GET/api/v1/conversationsconversations_listList conversations
GET/api/v1/conversations/:conv_idconversation_detailGet conversation
POST/api/v1/conversations/:conv_id/deleteconversation_deleteDelete conversation
GET/api/v1/conversations/:conv_id/streamconversation_streamStream conversation messages
GET/api/v1/conversations/:conv_id/usageconversation_usageGet conversation usage
GET/v1/messages/:message_idmessage_getGet message by ID

Seats

MethodPathHandler actionDescription
GET/api/v1/license/statuslicense_statusLicense enforcement state

Telemetry

MethodPathHandler actionDescription
GET/api/v1/telemetrytelemetry_listList telemetry events (limit/offset pagination)
GET/api/v1/telemetry/:agent_idtelemetry_agentList telemetry events for one agent
POST/api/v1/telemetry/cleartelemetry_clearClear all telemetry buffers (audited)

Providers

MethodPathHandler actionDescription
POST/api/v1/providers/reloadproviders_reloadReload declarative providers

Sessions

MethodPathHandler actionDescription
POST/api/v1/sessionssession_share_createCreate a session share link
GET/api/v1/sessions/:share_idsession_share_getGet shared session data
DELETE/api/v1/sessions/:share_idsession_share_deleteDelete a session share
GET/api/v1/shares/:share_idshare_getGet shared session by share id

Audit

MethodPathHandler actionDescription
GET/api/v1/audit/eventsaudit_eventsQuery audit events - file-only stub: empty page + notice audit_log_file_only (real trail: the JSONL audit log)
GET/api/v1/audit/llm-decisionsaudit_llm_decisionsQuery LLM decisions - file-only stub: empty page + notice audit_log_file_only (real trail: the JSONL audit log)
GET/api/v1/audit/permission-decisionsaudit_permission_decisionsQuery permission decisions - file-only stub: empty page + notice audit_log_file_only (real trail: the JSONL audit log)
GET/api/v1/audit/summaryaudit_summaryAudit summary - file-only stub: empty counts + notice audit_log_file_only (real trail: the JSONL audit log)
GET/api/v1/audit/tool-executionsaudit_tool_executionsQuery tool executions - file-only stub: empty page + notice audit_log_file_only (real trail: the JSONL audit log)
GET/api/v1/audit/verifyaudit_verifyAnchored audit-chain integrity verdict (live: verified against the on-disk JSONL chain)

ZMQ

MethodPathHandler actionDescription
POST/api/v1/zmq/dispatchzmq_dispatchDispatch ZMQ task
GET/api/v1/zmq/statuszmq_statusZMQ gateway status
GET/api/v1/zmq/workerszmq_workersList ZMQ workers

ACP Agents

MethodPathHandler actionDescription
GET/api/v1/acp/agentsagents_listList ACP agents
GET/api/v1/acp/agents/:agent_idagents_detailGet agent details
POST/api/v1/acp/agents/:agent_id/messageagents_messageSend message to agent
GET/api/v1/acp/agents/capabilitiesagents_capabilitiesList all capabilities
GET/api/v1/acp/agents/discoveragents_discoverDiscover agents by capability

Supervisor

MethodPathHandler actionDescription
GET/api/v1/supervisor/children/:namesupervisor_childrenSupervisor children
GET/api/v1/supervisor/treesupervisor_treeSupervisor tree

Infra

MethodPathHandler actionDescription
GET/api/v1/infra/cache-affinitycache_affinity_statsPrefix-affinity cache stats
DELETE/api/v1/infra/cache-affinitycache_affinity_clearClear the prefix-affinity cache (admin)
POST/api/v1/infra/cache-invalidatecache_invalidateInvalidate auth middleware cache
GET/api/v1/infra/maintenancemaintenance_statusGet maintenance mode status
POST/api/v1/infra/maintenance/disablemaintenance_disableDisable maintenance mode
POST/api/v1/infra/maintenance/enablemaintenance_enableEnable maintenance mode
GET/api/v1/infra/statusinfra_statusInfrastructure status overview
GET/api/v1/managed-settingsmanaged_settings_getGet managed settings — returns {ok, data: SettingsMap, schema: SchemaMap} (admin); data._schema_rev is server-injected metadata
PUT/api/v1/managed-settingsmanaged_settings_putUpdate managed settings — body {key, value} merges one key; a bare settings map replaces the whole map. Schema-bound: unknown keys 400 unknown_setting_key (nearest known keys listed), out-of-bounds/type mismatches 400; 503 persist_failed on snapshot write failure

Goals

MethodPathHandler actionDescription
GET/api/v1/goalsgoal_listList all goals
POST/api/v1/goalsgoal_createCreate a new goal
GET/api/v1/goals/:idgoal_detailGet goal details
PUT/api/v1/goals/:idgoal_updateUpdate a goal (owner or admin)
DELETE/api/v1/goals/:idgoal_deleteCancel a goal and remove the record (DELETE cancels via the coordinator, then deletes the row)
POST/api/v1/goals/:id/cancelgoal_cancelCancel a goal

Replay

MethodPathHandler actionDescription
GET/api/v1/replay/:session_id/eventsreplay_eventsStream replayable session events from the event store

Endpoint notes (hand-written — kept OUTSIDE the generated block)

Audit query posture — file-only stubs

GET /api/v1/audit/events, /tool-executions, /permission-decisions, /llm-decisions and /summary are file-only stubs, not live queries. They answer the paginated empty-page shape (or {audit_summary: {}}) plus

{"notice": "audit_log_file_only"}

The authoritative trail is the append-only JSONL audit log written by sol_audit_log (Mango keeps its own audit archive). Consumers must introspect that log — the endpoints exist for authorization-gated compatibility, not as an audit index.

GET /api/v1/audit/verify is the live arm: it runs the anchored verifier against the JSONL chain (sol_audit_log:verify_integrity_anchored/0) and answers the verdict map (200 for every produced verdict, typed 503 when the verifier is unavailable).

ci/audit_surface_lint.py pins this three-way truth against the real route table (sol_http_routes.erl) and the real handler arms (sol_http_audit.erl): a stub route whose spec/doc row claims a live query is red, and so is a live route labelled file-only.

GET/HEAD method semantics

Every authorization rule that admits GET also admits HEAD (HEAD is the bodiless GET; the middleware folds it into the GET membership check — ). Streaming routes are the explicit exception: they are GET-only and answer HEAD with a typed 405 + Allow: GET before any SSE admission.

Auxiliary routes (hand-maintained — no spec rows)

Implemented in sol_http_routes.erl but deliberately outside the generated directory (no sol_api_spec.erl rows — machine/tooling surface or handler-level alias). documents them explicitly:

MethodPathHandler actionDescription
GET/api-docsswagger_uiSelf-contained Swagger UI serving /openapi.json (CDN-loaded, inline spec)
GET/openapi.jsonspecMachine-consumed OpenAPI 3.1 spec generated from the route metadata (sol_openapi)
POST/debug/pprof/profilepprof_profilepprof sampling profile (protobuf; ?seconds=10&interval=10) — admin-scoped, also gated by enable_pprof; POST-only
POST/debug/pprof/heappprof_heappprof heap profile (protobuf) — admin-scoped, also gated by enable_pprof; POST-only
POST/api/v1/debug/flamegrapheflame_svgOn-demand eflame SVG (?seconds=5) — admin-scoped; not enable_pprof-gated; POST-only
GET/api/v1/workers/bg/:bg_id/statusbg_statusCompat alias of GET /api/v1/workers/bg/:bg_id (same bg_status dispatch; route order resolves it before the :bg_id catch-all)

Memory write ownership (store / clear / delete)

Identity is resolved at the HTTP boundary; the memory store authorizes server-side. The rules as-implemented:

OperationNon-admin callerAdmin
store (new key)row owned by the caller’s user_uuidrow owned by the caller
store (existing key)overwrite allowed only on own rowsoverwrite allowed on any row
clearwipes only the caller’s OWN rows inside the agent namespacewipes the whole agent namespace
delete (:key)allowed only on own rowsallowed on any row

Memory read consistency

list/search/retrieve read through the store’s single seam (sol_memory_pg), which consults PostgreSQL on an ETS miss. The enumeration reads GET /api/v1/memory/:agent_id/stats and GET /api/v1/memory/:agent_id/reflections are served by sol_memory_read, the single authority for those two cache reads. They read the NODE-LOCAL sol_memory ETS read model hydrated from PG; a write made on another cluster node is visible only after that node’s hydration/re-read. The durable authority remains PostgreSQL (memory_pg_enabled=true); with memory disabled every route answers the documented 503.

A foreign overwrite or delete answers 404 (never 403 — no existence oracle for foreign keys). The same gates hold on the durable PG leg: the WAL upsert’s DO UPDATE is owner-gated, and scoped wipe/delete ops carry the owning user_uuid, so a replay can never rewrite or drop a foreign row. The legacy POST /:agent_id/:key/delete action row shares the ownership semantics of the REST delete.

Natural-language schedule values

schedule_create accepts a human-readable schedule string and resolves it to at/every/cron. The decided parse semantics:

Input formResolution
every 30m, every 2h, every 1d, every 90srecurring interval (every)
in 2h, bare 30mone-shot at = now + duration
HH:MM (24h), barenext occurrence; rolls to tomorrow if already past today
9am / 9pm (single digit)09:00 / 21:00
HHam / HHpm (two digits)12am = 00:00 (midnight), 12pm = 12:00; hours 1–11 map to their clock value (pm +12)
13pm, 13am, any hour > 12 with an am/pm suffixrejected — invalid schedule (the request answers 400); no silent +12h roll
today HH:MM / today <ampm>today at the time; a time already past rolls forward to tomorrow
tomorrow <time>tomorrow at the time
5-field cron expressionpassed through as cron
YYYY-MM-DDTHH:MM[:SS]one-shot at at the ISO timestamp

A rejected parse leaves the body without at/every/cron, so schedule create answers 400 “must specify at, every, or cron” — a loud rejection, never a silently shifted fire time.

POST /api/v1/chat/:id/ws-ticket

Mints a one-time WebSocket authentication ticket for the chat session a POST-only, admin-or-owner-gated route answering {ticket, expires_in_ms} — the ticket is single-use, short-TTL, and is presented on the /ws upgrade via the zerg_ticket, <ticket> Sec-WebSocket-Protocol subprotocol form so the long-lived bearer never rides the WS handshake. Limon mints a fresh ticket per reconnect.

Chat WebSocket frames. Besides token/done/error/ history/ack/pong, the chat socket carries the operator permission round-trip:

FrameDirectionFieldsMeaning
permission_requestserver → clientrequest_id, task_id, tool_name, input_summary, analysis, expires_in_msA worker is blocked on a tool decision. input_summary is a bounded command/path summary — never the raw input
permission_replyclient → serverrequest_id, decision, reason?decision ∈ allow | deny | always; only the ask owner or an admin may answer (others get error: permission_forbidden; stale ids get permission_request_not_found)
permission_resolvedserver → clientrequest_id, decisionThe registry resolved (or auto-denied) the ask — clears the prompt (also the acknowledgement of a successful permission_reply)

Every decision is audited (permission_decided, strict) with the tool, decision, reason, sha256 input hash, session, worker, owner, and source.

Session tree & snapshot control

The ops console can read and (admin-only) mutate the chat worker’s headless session tree and git snapshot plane. Sol relays each call to the chat session’s stdio worker over a correlated JSONL control line:

{"type":"session_control","request_id":"<uuid>","action":"branches|snapshots|snapshot_diff|branch_checkout|snapshot_restore","session_id":"...","user_uuid":"...","branch?":"...","snapshot_id?":"...","files?":["..."],"count?":20}
{"type":"session_control_reply","request_id":"<uuid>","ok":true,"data":{}}
{"type":"session_control_reply","request_id":"<uuid>","ok":false,"error":"branch_not_found"}

The request id is minted server-side and correlated by sol_worker (pending map + bounded timeout); a late/unknown reply can never resolve a different request, and the worker reply payload is size-bounded. Reads are safe mid-turn; branch_checkout and snapshot_restore are refused 409 with session_busy while a turn runs (they mutate the session view / workspace). Worker death answers the documented 503 worker_unavailable class; a worker whose workspace is not a git repository answers the typed snapshot_unavailable state.

MethodResponse
GET /branches200 {available, active, branches:[{name, root, message_count, active, leaf, title}]}; available:false + reason when no task session exists yet
GET /snapshots200 {available, snapshots:[{id, timestamp, tool, description, files}]}; timestamp is null when the snapshot backend keys by tree id; available:false + reason:"snapshot_unavailable" when the workspace is not a git repo
GET /snapshots/:id/diff200 {snapshot_id, files:[{path,insertions,deletions}], insertions, deletions, diff, truncated} — diff is bounded to 8 KiB; 404 snapshot_not_found
POST /branchBody {"branch":"name"}. 200 {branch, active, leaf}; 404 branch_not_found; 409 session_busy
POST /snapshots/:id/restoreOptional body {"files":["path"]} (omitted = whole snapshot). 200 {snapshot_id, restored}; 409 snapshot_unavailable; 400 invalid_files for absolute/traversal/empty entries

Mutations require is_admin (the parameterized route cannot carry an exact {admin, require} scope; the RBAC floor is chat:create). Each writes a strict audit row before touching the worker — strict_log failure answers 503 audit_unavailable and the mutation never runs:

session_branch_checkout     chat_session:<id>  {branch, worker_id}
session_snapshot_restore    chat_session:<id>  {snapshot_id, worker_id, files_count?}

Audit rows carry the branch/snapshot id and a file COUNT only — never file bodies or paths from the restore payload.

semantics

Member list. GET /api/v1/teams/:id/members lists a team’s members (membership-gated: the caller must belong to the team or be an admin). The same path answers POST for the add-member form below.

Member identifiers. DELETE /api/v1/teams/:id/members/:worker_id accepts EITHER identifier form in the path segment: the canonical member id (tm_*, the registry key) or the member’s worker_id. The path segment is resolved to the canonical member row server-side (worker-id scans are bounded by the team’s max_members); unknown ids return 404 with code not_found, cross-team ids return code wrong_team.

Join-time identity. POST /api/v1/teams/:id (the no-suffix add-member form added in ) and POST /api/v1/teams/:id/members dispatch the same action and require a non-empty worker_id; an empty or missing value returns 400 error code invalid_worker_id`` (no placeholder rows are created). A body-supplied user_uuid is always stripped — the member row’s user_uuid is stamped from the authenticated caller only.

RBAC matrix (handler-enforced; the middleware’s teams:manage still applies to mutating routes on the wire):

OperationAllowed for
Team createadmin (teams:create at the middleware)
Team detail / members / mail READ (incl. ?mine=1)admin OR creator OR a member whose user_uuid matches the caller
Team destroy / member add / member remove / mail sendadmin OR creator (teams:manage at the middleware)

Outsiders receive the standard Zerg envelope: 403 {"ok":false,"error":{"code":"forbidden","message":"not a team member"}} (read) / 403 {"ok":false,"error":{"code":"forbidden","message":"forbidden"}} (mutate).

Mail delivery model (decision recorded). Delivery is push best-effort: mail addressed to a specific worker_id is pushed when that worker is currently registered via ZMQ; broadcast (to: "all") mail is never pushed. Polling is the recovery path: GET /api/v1/teams/:id/mail returns the team’s non-expired mail (non-destructive). This default read is TEAM-WIDE and member-authorized: any caller who passes the membership gate (check_team_member/2 — a member row, the creator, or an admin) may read mail addressed to another member; the row’s to field is the addressee, not an access boundary. GET /api/v1/teams/:id/mail?mine=1 returns only mail addressed to the caller’s membership (user_uuid or one of their member worker_ids), still non-destructive. Mail rows transition pending → delivered → acknowledged (POST /api/v1/teams/:id/mail/:message_id/ack is the explicit transition added in ); the read API marks delivery preserving every field, and expiry (TTL, default 300s) deletes the row and emits a team.mail_expired sync event per row. Errors: unknown team/mail → 404; mailbox unavailable → 503 service_unavailable (the mailbox store is temporarily down — a retryable outage class, not a handler bug; the body is the Zerg envelope with code read_failed and message team mailbox temporarily unavailable).

Scheduler create request contract (POST /api/v1/schedule/spawn)

FieldTypeRequiredNotes
promptstringYesMissing/empty → 400 missing prompt.
atintegerone of at/every/cronEpoch milliseconds. A past timestamp is accepted but logged.
everyintegerone of at/every/cronPositive interval in milliseconds (> 0 required).
cronstringone of at/every/cronParsable 5-field cron expression.
namestringNoJob label.
modelstringNoModel override for the dispatched task.
optsobjectNoArbitrary job opts; identity-bearing keys (user_uuid, permissions, listener, owner, task_id, container_id, plugin) are stripped.
delete_after_runbooleanNoOnly valid for at jobs — true with every/cron answers 400 delete_after_run only supported for 'at' jobs.

Neither at/every/cron present → 400 must specify at, every, or cron (a natural-language schedule string is resolved server-side first — see the NL table above). Response (200): {"status": "ok", "id": <job_id>, "next_run": <epoch-ms>}.

DELETE /api/v1/schedule/:id

Delete a scheduled job. DELETE only (admin-only; the same route row serves GET /api/v1/schedule/:id for the detail read). Used by zerg schedule delete.

Responses:

200 {"status": "deleted"} — the job is removed 403 forbidden — non-admin caller 404 job not found — unknown (or already fired delete_after_run) job 409 job currently running — a running job refuses deletion

Memory store request body (POST /api/v1/memory/store)

FieldTypeRequiredNotes
keystringYesBinary, 1..512 bytes. Empty/too-long/non-binary → 400.
valuestringYesBinary content. Non-binary key/value → 400 invalid body.
agent_idstringNo1..128 bytes; falls back to the route binding (default "default").
ttlintegerNoSeconds, ≥ 0 — a negative or non-integer value answers 400 invalid ttl; larger values are clamped to 31536000 (365 days).
embeddingarrayNoOptional numeric vector; a non-numeric element answers 400 instead of a 500.

Durability of the ack: the default 200 {"status":"ok"} is cache-durable — the entry is in the ETS cache and the write is accepted into the sol_memory_wal queue (RAM-crash-safe; power-loss-durable only to the last WAL flush, bounded by memory_wal_flush_ms, default 100ms). With memory_http_durable_writes=true the write uses the durable ack contract: ok additionally means the WAL drained (the PG upsert committed) before the reply, and an unconfirmed flush answers 503 service_unavailable — never a durability lie.

Goals — create gate, update & delete verbs

GET /api/v1/goals (list) requires the goals:read scope; the bare route is in ?ENDPOINT_PERMISSIONS since then, so a caller with no granted permissions receives 403 insufficient_permissions (admin * passes; assign a role carrying goals:read to grant it). Goal create is admin-only (403 forbidden for other callers); reads and the mutation verbs below are owner-or-admin. The handler serves an additional mutation verb (now also a first-class spec row, goal_update):

Cancel — POST /api/v1/goals/:id/cancel is admin-only (403 insufficient_permissions otherwise; aligned the RBAC scope, handler and this doc on the same authority). Update — the PUT verb on /api/v1/goals/:id: update goal metadata. Admin, or the goal owner for their own goals (403 forbidden on a foreign goal, 404 unknown id). Delete — the DELETE verb on /api/v1/goals/:id: cancels the goal with the same ownership rule, then removes the record. Cancellation stops the associated workflows and in-progress sub-agents; the row and its workflow index entries are deleted through the goal projector (the single ETS writer) and the response is {"cancelled": "<id>", "deleted": "<id>"} ("deleted": false if the projector was unreachable — the cancel still happened and the retention sweep owns the row). A missing goal is 404 goal not found. Terminal goals are additionally swept by a retention GC (goal_retention_ms, default 30 days, same clock as the workflow-state GC) — a goal referenced by a live workflow binding is never removed by the sweep. GET /api/v1/goals is paginated (limit/offset, default 50); the goals key is preserved and pagination metadata (total, limit, offset, has_more, total_pages) rides beside it.

Infra cache-affinity

The GET verb on /api/v1/infra/cache-affinity — returns prefix-affinity stats: {"entries": {...}} (an empty entries map when the collector is unavailable). The DELETE verb on /api/v1/infra/cache-affinity — clears all affinity entries, answering {"ok": true}. Admin-only (403 insufficient_permissions otherwise). Both verbs are first-class spec rows (cache_affinity_stats / cache_affinity_clear) since then.

OpenAI-Compatible Endpoints

These endpoints are compatible with the OpenAI Chat Completions API. /v1/completions (legacy FIM text completions) speaks the same OpenAI auth-error dialect as /v1/chat/completions.

POST /v1/chat/completions

OpenAI-compatible chat completions proxy. Resolves model name, starts inference if needed, and streams tokens.

Request body:

{
  "model": "glm-4.7-flash",
  "messages": [
    {"role": "user", "content": "Explain quicksort"}
  ],
  "stream": true,
  "temperature": 0.7,
  "max_tokens": 4096,
  "top_p": 0.95,
  "timeout": 300000
}
FieldTypeRequiredDefaultDescription
modelstringYes—Model slug name (prefix matching supported)
messagesarrayYes—Chat messages (role + content)
streambooleanNotrueStream SSE tokens
temperaturefloatNotemplate defaultSampling temperature
max_tokensintegerNomodel defaultMaximum tokens to generate
top_pfloatNotemplate defaultTop-p sampling
timeoutintegerNo300000Request timeout in ms (provider_request_timeout_ms default 300 s, clamped to client_timeout_max_ms, default 600 s)

Response (streaming): SSE events with data: {"choices": [...]} lines.

Response (non-streaming): every field the OpenAI SDK’s typed deserializers expect:

{
  "id": "chatcmpl-<node>-<n>",
  "object": "chat.completion",
  "created": 1786796808,
  "model": "glm-4.7-flash",
  "choices": [{"message": {"role": "assistant", "content": "..."}, "finish_reason": "stop"}],
  "usage": {"prompt_tokens": 10, "completion_tokens": 50, "total_tokens": 60}
}
curl -X POST http://127.0.0.1:21434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"glm-4.7-flash","messages":[{"role":"user","content":"hello"}]}'

POST /v1/completions

OpenAI legacy text-completion shape for fill-in-the-middle code completion. Non-streaming only; authenticated with inference:use; the request body is capped at 1 MiB. Sol resolves a lane that declares the fim capability and calls that lane’s internal POST /infill — the lane endpoint is never a client contract.

Request body:

{
  "model": "glm47_fim",
  "prompt": "def add(a, b):",
  "suffix": "\n    return a + b\n",
  "max_tokens": 96,
  "temperature": 0.2,
  "stop": ["\n\n"]
}
FieldTypeRequiredDefaultDescription
modelstringNoautoLane id pin (gated); omitted = auto-route to a fim lane
promptstringYes—Prefix text sent to the lane as input_prefix
suffixstringYes—Suffix text sent as input_suffix
max_tokensintegerNo96Completion budget (1–1024)
temperaturenumberNolane defaultSampling temperature (0–2)
stopstring | string[]No—Up to 4 stop strings
streambooleanNofalseStreaming is not supported (true answers 400 stream_unsupported)

Response (text_completion):

{
  "id": "cmpl-<uuid>",
  "object": "text_completion",
  "created": 1786796808,
  "model": "glm47_fim",
  "choices": [{"text": "    return a + b\n", "index": 0, "finish_reason": "stop"}],
  "usage": {"prompt_tokens": 6, "completion_tokens": 5, "total_tokens": 11}
}

finish_reason is length when the lane reports a truncated/limit stop, otherwise stop. Usage is settled through the standard inference counters/ledger (inference_complete, token counters, spend settlement).

Typed refusals (never a 500):

Statuserror.codeClass
400invalid_request / stream_unsupportedMalformed body, missing prompt/suffix, unsupported streaming
400fim_unsupportedThe pinned lane (or the fleet) declares no fim capability
400not_allowed_on_host / mode_not_allowedLane cannot serve this request on this host
404unknown_lanePinned model is not a lane
409lane_not_grantablePinned lane is staged
429lane_busy / cpu_busy / queue_fullAdmission capacity (Retry-After)
503lane_warmingCold lane; the async start is in flight (Retry-After)
503lane_unvalidated / lane_unavailable / model_unavailableLane cannot serve now
502lane_rejectedThe lane’s /infill answered an error

A cold lane answers immediately with lane_warming; the next request after the Retry-After consumes the warm lane. The endpoint leases attended with a fixed TTL (completion_lease_ttl_ms, default 300 s; values above lane_duration_max_ms are refused, never clamped) so a single ghost-text request never pins the big lane for the 15-minute on_demand idle class. Spend admission runs before lane resolution/cold start, so an over-budget request never starts or holds a lane. At HEAD there is no per-session coalescing queue: each request is one independent non-streaming call, serialized only by lane admission (429 lane_busy/queue_full) and the standard per-principal HTTP rate limiter. The FIM lane’s launch recipe (-b >= 12288) and the measured quality/latency rows are recorded in local-inference-lanes.md and benchmarks/fim-round-2026-10-18.md. glm47_fim is the declared primary (production => false until a zerg validation record exists) and qwen38_atx is the fallback and is a production lane, so the fallback is selected only when its own validation verdict permits serving; a fleet with no grantable, validation-eligible fim lane returns the typed fim_unsupported (or lane_unvalidated on the pinned path).

POST /v1/messages

Anthropic Messages API endpoint. Translates to/from OpenAI format internally.

Request body:

{
  "model": "glm-4.7-flash",
  "messages": [
    {"role": "user", "content": "Explain quicksort"}
  ],
  "max_tokens": 4096,
  "stream": true,
  "system": "You are a helpful assistant.",
  "temperature": 0.7,
  "top_p": 0.95,
  "stop_sequences": ["\n\n"],
  "tool_choice": "auto"
}
FieldTypeRequiredDefaultDescription
modelstringYes—Model slug name
messagesarrayYes—Chat messages
max_tokensintegerYes—Maximum tokens
streambooleanNofalseStream SSE events (the OpenAI leg defaults to true; this endpoint defaults to false)
systemstringNo—System prompt
temperaturefloatNo—Sampling temperature
top_pfloatNo—Top-p sampling
top_kintegerNo—Top-k sampling (carried to the Messages/OpenAI body after translation)
stop_sequencesarrayNo—Custom stop sequences
tool_choicestringNo—Tool selection: auto, any, none
toolsarrayNo—Tool definitions
thinkingobjectNo—Extended thinking: {"type": "enabled", "budget_tokens": N} (translated to the provider wire; the Anthropic wire receives the thinking block, OpenAI-compatible wires receive reasoning_effort)
response_formatobjectNo—Structured output request; forwarded as the wire response_format parameter (plus a structured-output tool for providers that cannot take the parameter — the synthetic tool is stripped from the OpenAI wire when the native parameter is sent)
stream_optionsobjectNo{"include_usage": true}Stream options forwarded on the OpenAI wire (usage defaults to included when streaming)
metadataobjectNo—Metadata with user_id (carried to the provider request)

Response (streaming): Anthropic-format SSE events (message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop).

Response (non-streaming):

{
  "id": "msg-...",
  "type": "message",
  "role": "assistant",
  "content": [{"type": "text", "text": "..."}],
  "model": "glm-4.7-flash",
  "stop_reason": "end_turn",
  "usage": {"input_tokens": 10, "output_tokens": 50}
}

stop_reason values: the full mapping is pinned by the shared fixture docs/fixtures/stop_reason_matrix.json (consumed by both the Luna client translators and sol_anthropic_api:translate_stop_reason/1):

ValueMeaningOrigin
end_turnNatural completion (openai stop / absent reason also map here)mapped
max_tokensOutput truncated by the token budget (openai length)mapped
stop_sequenceA custom stop sequence firednative passthrough
tool_useThe model invoked a tool (openai tool_calls)mapped
content_filterProvider content filter (legacy openai value)passthrough
function_callLegacy openai tools API valuepassthrough

Unknown values are passed through unchanged (Anthropic may add values) and a server warning is logged — never silently rewritten, never dropped.

OpenAI egress usage: the OpenAI usage object is emitted with all three counters — prompt_tokens, completion_tokens, total_tokens. The shared interpreter marks an unreported side null; a null side cannot produce a total, so the whole object is omitted rather than emitting an incomplete/fabricated row. Buffered message.tool_calls[] entries carry type: "function" and never the delta-only index; streaming delta chunks keep index and also carry type.

Usage-absence semantics: usage is reported only when the provider actually emitted it. When the upstream stream carries no usage chunk, the field is omitted (streaming: no usage object on message_delta; non-streaming: no output_tokens key) and the conversation store records null — output tokens are never fabricated (the pre-fix byte_size div 4 estimate and per-chunk token counting are gone).

Non-streaming error statuses: a task that ends in a terminal error status is answered with an Anthropic-format error body and a status code that reflects the failure class. Pre-, the error text was returned as a 200 end_turn message; answered every terminal status with a flat 500; distinguishes the classes:

Task statusHTTP statusAnthropic error type
timeout (did not finish within the waiter window)504 Gateway Timeoutoverloaded_error
cancelled (user/owner cancelled the task)409 Conflictinvalid_request_error
error, crashed (the task itself failed)500 Internal Server Errorapi_error
task row missing404 Not Foundnot_found_error

A pending row is never answered — the waiter re-arms until the task reaches a terminal status or the waiter budget is exhausted.

curl -X POST http://127.0.0.1:21434/v1/messages \
  -H "Content-Type: application/json" \
  -d '{"model":"glm-4.7-flash","messages":[{"role":"user","content":"hello"}],"max_tokens":4096}'

Health & Metrics

GET /api/v1/health

Health check.

Response:

{"status": "ok", "models_running": 3}

GET /api/v1/metrics

ETS-backed metrics counters. Requires the metrics:read permission (: the same metrics loopback gate as /metrics applies to tokenless requests — loopback scrape ok, external tokenless → typed 403).

Response:

{"requests": 142, "tokens": 42800, "errors": 2}

Model Management

POST /api/v1/discover

Trigger model discovery scan. POST only (405 for other methods).

Response:

{"discovered": 12}
curl -X POST http://127.0.0.1:21434/api/v1/discover

GET /api/v1/models

List all registered models (paginated). Two row shapes share the list:

Local rows — {slug, family, quant, size, status, source: "local", model_slug, lane, engine}; lane-qualified instance rows carry model_slug/lane/engine. Provider rows — {id, source: "provider", canonical_model, provider_model, dispatchable, alias?, provider, context_window, capabilities, pricing, modalities?}. An alias row keeps alias; the canonical id is id, and dispatchable=false means the registered row lacks an endpoint/credential (visible instead of a post-fallback 503).

Response:

[
  {"slug": "glm-4.7-flash-q4", "family": "glm", "quant": "Q4_K_M", "size": 4200000000, "status": "available", "source": "local", "model_slug": null, "lane": null, "engine": null},
  {"id": "claude-sonnet-4-20250514", "source": "provider", "canonical_model": "claude-sonnet-4-20250514", "provider_model": "claude-sonnet-4-20250514", "dispatchable": true, "provider": "anthropic", "context_window": 200000, "capabilities": {"vision": true, "tools": true}, "modalities": ["text", "image"]}
]

GET /api/v1/models/metadata

Registry metadata for every known model: {models: [{name, family, quant, size, status, …}]} — the discovery view (not the inference-critical projection). Admin/read-gated like the models list; current_task-style prompt fields are never included.

GET /api/v1/providers/health

Probe every provider transport identity (provider/key/endpoint). Rows are grouped: every registered model or alias sharing the same provider, key and endpoint collapses into one probe, and its models list names them. A row with no endpoint is unconfigured and is never probed. The response is paginated (items plus the backward-compatible providers mirror).

[
  {"name": "anthropic", "models": ["claude-sonnet-4-20250514"], "endpoint": "https://api.anthropic.com", "path": "/v1/messages", "key_id": "anthropic", "wire": "anthropic", "status": "available", "checked_at_ms": 1760000000000}
]

Status values: available (2xx/3xx/404/405/429 — reachable), available_unauthorized (401/403 — reachable, credential problem), degraded (5xx), unavailable (transport/timeout), ssrf_rejected (private/loopback/link-local target refused), unconfigured (no endpoint). GET /api/v1/providers/health/:name returns the single group for that provider name (404 when unknown).

Model catalog and rate truth

GET /api/v1/models and GET /v1/models enumerate the registered serving surface (provider rows + lane/discovered models); they are not a dump of the declarative metadata catalog. The declarative catalog lives in contract/model_catalog.yaml and is rendered into server/priv/model_catalog.json (Sol), client/data/models.json and client/core/_models_data.lua (Luna) by ci/catalog_gen.py — see catalog.md.

Server-side fallback chains are validated against the registered model set at boot. The documented example (also shipped as docs/fixtures/provider_fallback_chains_example.json) is:

{"fallback_chains": {"claude-3-*": ["claude-sonnet-4-20250514"],
                     "*": ["gpt-4o-mini"]}}

Keys/targets must match a registered id or alias; an unknown glob (for example the retired claude-opus-* example) refuses the whole config loudly at boot.

Rate truth:

Billing reads the catalog pricing block (sol_cost:price/1; per-Mtok input_per_mtok / output_per_mtok rates), alias/lane-resolved. Unknown models are {error, unknown_price} and counted — never silently zero. sol_model_metadata is the fallback for operator-only/test rows. The /v1/models list merges the cluster catalog entries (canonical ids, one row per model) and /api/v1/models renders real catalog metadata (provider, context window, capabilities, pricing, modalities). A descriptor that deliberately diverges from the legacy view carries a typed pricing.metadata_override with the exact metadata values and a reason; ci/model_catalog_lint.py fails a bare mismatch or a stale override. A descriptor with no bundled rate is explicitly pricing: {unpriced: true, reason: …} (or free: true for a zero-rate local lane) — unpriced rows cannot masquerade as zero-cost ones.

A request naming a model that is neither registered nor a local lane model is refused with {error, {unknown_model, Model}} by the request builder and answers 404 at the HTTP boundary (’s unknown-wire refusal remains a separate typed parse-time error).

GET /api/v1/usage

Per-principal inference usage and spend totals from the enforced daily ledger (sol_spend_guard). Scope: inference:use. A caller reads itself; an admin may pass ?user_uuid=<uuid>. Optional UTC range ?from=YYYY-MM-DD&to=YYYY-MM-DD (inclusive; to defaults to today, from defaults to unbounded). Only GET is served (405 otherwise).

{
  "user_uuid": "…",
  "days": [
    {"day": "2026-10-17", "input_tokens": 1200, "output_tokens": 800,
     "total_tokens": 2000, "cost_usd": 0.0123,
     "models": [{"model": "gpt-4o", "input_tokens": 1200,
                  "output_tokens": 800, "cost_usd": 0.0123}]}
  ],
  "totals": {"input_tokens": 1200, "output_tokens": 800,
             "total_tokens": 2000, "cost_usd": 0.0123},
  "budget": {"daily_budget_usd": 0, "daily_token_budget": 0,
             "unknown_price_policy": "deny"}
}

The ledger is in-memory and resets on a full restart; durable billing truth remains the inference.complete / task.completed event stream. Admission caps, unpriced-model policy and overshoot semantics are in cost.md.

GET /api/v1/models/:name

Show model details ( explicit projection; the pre-fix verbatim registry record leaked paths/config/port to every models:read holder).

Response (non-admin):

{"id": "glm-4.7-flash", "family": "glm", "quant": "Q4_K_M", "size": 4700000000,
 "status": "ready", "context_window": 200000}

id is the registry slug (model_slug fallback); family, quant, size, status and context_window are present only when known. Paths, config, port and the runtime inference_ref are never returned.

Response (admin): the operator record (sol_registry:show/1 projection with atom values rendered) including slug/model_slug, paths, config, port and inference_ref.

Errors: 404 not found; store-down 503 / remote 502 through classify_error — never a blanket 500.

GET /api/v1/ps

List running inference processes.

Response: paginated envelope (/ — the bare-array example predated the pagination contract; sol_http_inference:ps_body/1 paginates):

{"items": [{"slug": "glm-4.7-flash", "family": "glm", "port": 8001, "ref": "#Ref<0.123>"}], "total": 1, "limit": 50, "offset": 0, "page": 1, "total_pages": 1, "has_more": false}

POST /api/v1/start

Start an inference model. POST only. Status values: "ok" on a fresh start (200), "already_running" when the model is already serving (409), "not_found" for an unknown model.

Request body:

{
  "model": "glm-4.7-flash",
  "template": "coding",
  "overrides": {"temp": 0.3, "batch_size": 4096},
  "lane": "qwen38_atx",
  "engine": "cuda_sm86_main",
  "mode": "on_demand",
  "duration_ms": 3600000
}
FieldTypeRequiredDescription
modelstringYesModel slug name
templatestringNoParameter template name
overridesobjectNoParameter overrides
lanestringNoInference lane id. An unknown lane is a typed 400, never silently ignored. Lane-bound starts also come from Luna’s lane_control plane
enginestringNoEngine id override (must be registered; typed 400 otherwise)
modestringNoLifecycle mode: on_demand (default; 15 min idle release), duration (with duration_ms), attended, cron
duration_msintegerNoBound for duration mode (max lane_duration_max_ms, default 24 h)

A production lane whose validation is missing/stale/breached refuses with {engine_unvalidated, Lane, Reason} (see local-inference-runbook.md §3).

GET /api/v1/inference/lanes

Read-only, sanitized fleet lane inventory. Filters: ?lane=<id> and ?node=<label> (an unknown value degrades to no filter, never a 500); pagination follows the shared query contract. Each lane row projects lane, state, engine, engine_build, model_slug, ctx, caps, slots, port, mode, lease_held, expires_at, weights, validation and stale. : the row also carries use_case — one registry use-case facet string (fim, agentic, fast_bulk, docs_long, vision, strict_json, story, cpu_cron, escalate). The engine interface is one atom per lane. The facet is joined from the lane registry at the read boundary; a lane whose row has no facet (an older peer config) is returned unchanged, so consumers must tolerate absence. The facet is a selection hint — capability truth stays in caps.

Response: a paginated array of the rows above (binary-keyed JSON; no pids, env, model paths or lease ids).

POST /api/v1/inference/lanes/:lane/validate

Admin-only probe/commit for lane certification (; evidence rules ). mode=probe writes nothing and returns the needle row plus its canonical row_ref; mode=commit re-verifies the fingerprint and stores the record. The commit requires origin=zerg on the row, membership of the claimed row_ref in the configured artifact CSV (lane_benchmark_csv; configured-but-unreadable answers 503 artifact_csv_unreadable), an engine install receipt with a real manifest hash, and a parity verdict — pass, or single_host only with allow_single_host: true. Typed refusals: 409 origin_not_zerg, 409 evidence_mismatch (hash mismatch), 409 row_not_in_artifact, 409 no_receipt, 409 parity_required, 409 single_host_unacked, 409 engine_unvalidated (fingerprint moved), 503 artifact_csv_unreadable. See engine-provenance.md.

Response:

{"status": "ok", "port": 8001, "ref": "#Ref<0.123>"}
curl -X POST http://127.0.0.1:21434/api/v1/start \
  -H "Content-Type: application/json" \
  -d '{"model":"glm-4.7-flash","template":"coding"}'

POST /api/v1/stop

Stop a running model. POST only.

Request body: {"model": "glm-4.7-flash"}

curl -X POST http://127.0.0.1:21434/api/v1/stop \
  -d '{"model":"glm-4.7-flash"}'

POST /api/v1/stop-all

Stop all running models. POST only.

Response: {"stopped": 3}

POST /api/v1/prepare/:name

Prepare a model for serving. POST only — the handler answers 405 for every other method (the CLI POSTs). If the model’s file must be synced from its source (e.g. NFS) to local disk, the rsync runs Asynchronously: the endpoint answers 202 Accepted immediately, the model’s status becomes preparing, and completion is observable via the model.prepared / model.prepare_failed events (the row reverts to discovered on failure). A prepare that is already in flight is idempotent — it returns the same 202 response without spawning a second rsync. While preparing, a start request is rejected with 409.

Responses:

200 — the model is already prepared: {"status": "ok", "local_path": "/tmp/sol/models/glm-4.7-flash-q4.gguf"} 202 — prepare accepted, rsync running in the background: {"status": "preparing"} 404 — model not found

Agent Workers

GET /api/v1/agents

List all spawned agent workers. Paginated.

Response (paginated envelope):

{"items": [{"worker_id": "agent-abc123", "status": "idle", "ospid": 12345,
  "current_task": "task-xyz789", "pending_count": 2}],
 "total": 1, "limit": 50, "offset": 0, "page": 1, "total_pages": 1, "has_more": false}

There is no task_count field. current_task is the id of the in-flight task (not its prompt); non-admin callers receive "current_task": null — the field is redacted so one user cannot read another user’s in-flight work. ospid is the worker process id and pending_count the length of its queued-task queue.

POST /api/v1/agents/spawn

Spawn new agent workers. POST only. Admin-only — other callers receive 403 forbidden.

Request body:

{"count": 2, "worker_path": "/opt/sol/etc/luna"}
FieldTypeRequiredDescription
countintegerNoNumber of agents (1-64). An out-of-range or non-integer value silently becomes 1.
worker_pathstringNoPath to worker binary (validated prefix)

Response:

[{"worker_id": "agent-abc123"}]

Each result item carries worker_id only (plus error on per-slot spawn failures).

Cap response (429): when the worker cap is reached mid-spawn the endpoint answers 429 with this legacy flat body:

{"error": "cap_reached", "retry_after": "30", "results": [{"worker_id": "agent-abc123"}]}

Note this one cap body predates the envelope doctrine — it is a bare top-level {"error":...} (string "retry_after", not a header), kept as-is for compatibility.

GET /api/v1/agents/:id

Show agent status.

POST /api/v1/agents/:id/task

Dispatch a task to an agent.

Request body:

{
  "prompt": "Fix the bug in main.rs",
  "stream": true
}
FieldTypeRequiredDescription
promptstringYesTask prompt
streambooleanNoStream SSE tokens (default: true)

Response (streaming): SSE token stream.

Response (non-streaming):

{"status": "queued", "task_id": "task-xyz789"}

POST /api/v1/agents/:id/kill

Kill an agent worker. POST only.

Background Workers

All background-worker routes are admin-only — non-admin callers receive 403 forbidden.

POST /api/v1/workers/bg/start

Start a background (detached) worker session. Returns a bg_id for tracking.

Request body:

{"prompt": "analyze the logs and summarize errors", "model": "glm-4.7-flash", "timeout": 300000}
FieldTypeRequiredDescription
promptstringYesTask prompt. Missing/empty → 400 prompt required.
modelstringNoModel override.
timeoutintegerNoRequest timeout in ms.

The caller’s user_uuid/permissions are captured server-side — do not send them in the body.

Response (200):

{"bg_id": "bg-abc123"}

Errors: 400 prompt required · 503 when the backing store fails to record the worker (classify_error).

GET /api/v1/workers/bg

List all background worker sessions with status: {"tasks": [...]}.

GET /api/v1/workers/bg/:bg_id

Get background worker status and metadata (404 unknown id).

GET /api/v1/workers/bg/:bg_id/logs?n=100

Fetch output logs from a background worker. Returns circular buffer (up to 10K lines). The query parameter is ?n=<lines> — a positive integer, default 100. Any other parameter name (e.g. ?limit=/?offset=) or a non-positive value answers 400 invalid n parameter.

POST /api/v1/workers/bg/:bg_id/kill

Kill a background worker session. POST only. 404 unknown id; 409 when the worker is in a non-killable state (body: worker is <status>).

Task Results

GET /api/v1/tasks

List all stored task results. Scoped to the requesting user’s tasks (non-admin). Admin users see all tasks.

DELETE /api/v1/tasks/:task_id

Cancel a running task. Returns 403 if the task belongs to another user (non-admin); the check is owner-only (/ — teammate visibility was never implemented; sol_http_workers:check_task_owner/1).

Response: {"status": "cancelled"}

GET /api/v1/tasks/:task_id

Fetch ONE stored task result (owner or admin; 403/404 otherwise):

{"task_id": "task-xyz789", "status": "completed",
 "content": "...", "truncated": false}

truncated: true marks a result that lost tokens to a stream gap or a cap breach.

GET /api/v1/tasks/outbox

List outstanding dispatch receipts — acknowledged tasks whose delivery is not yet terminally resolved. Every dispatch writes a durable receipt before the frame is sent; the receipt is cleared when the task reaches a terminal status, and any receipt still outstanding at boot is re-queued (at-least-once) or loudly marked by the boot reconcile. Requeue is system-driven — this endpoint is READ-only.

Scoped like GET /api/v1/tasks: non-admin callers see only their own receipts. Paginated (limit/offset, default 50).

Response:

{
  "items": [
    {"task_id": "zmq-1756000000000-1", "user_uuid": "u-…",
     "queued_at": 123456, "age_ms": 42000}
  ],
  "total": 1, "limit": 50, "offset": 0,
  "page": 1, "total_pages": 1, "has_more": false
}

queued_at is wall-clock system time (epoch ms, the same base the durable outbox row is written with); age_ms = system_time - queued_at clamped at zero ( — the pre-fix shape mixed the persisted system clock with erlang:monotonic_time, whose arbitrary origin made age_ms meaningless). Because the timestamp is wall-clock, a receipt that survived a reboot reports its true wall age (it is re-queued at boot, which refreshes queued_at). A receipt that persists here across boots with zmq_enabled=false is retained and re-alarmed (CRITICAL log + dispatch_outbox_orphaned_total) at every boot until the transport is re-enabled.

Reserved namespace: task ids starting with zmq- are SERVER-RESERVED (generated ids are zmq-<ms>-<counter> — unique per Sol node, not fleet-wide; /, W2). A caller-supplied task_id with that prefix is rejected at dispatch with {"error":"reserved_task_id"} — the workflow-bridge correlation ids use a different prefix (wf-...) and are unaffected.

Cluster

GET /api/v1/cluster

Show cluster membership.

Response:

{
  "node": "sol@gpu-node-1",
  "connected": ["sol@gpu-node-2"],
  "count": 2,
  "self": "sol@gpu-node-1",
  "connectivity": {
    "self": "sol@gpu-node-1",
    "connected_peers": ["sol@gpu-node-2"],
    "connected_peer_count": 1,
    "known_peers": ["sol@gpu-node-2", "sol@gpu-node-3"],
    "expected_nodes": 3
  },
  "health": {
    "healthy_peers": ["sol@gpu-node-2"],
    "unhealthy_peers": [],
    "unknown_peers": [],
    "healthy_count": 1,
    "unhealthy_count": 0,
    "unknown_count": 0
  },
  "left": [],
  "uptime_seconds": 86400,
  "seeds": [
    {
      "node": "sol@gpu-node-2",
      "connected": true,
      "last_ping_age_seconds": 3,
      "last_result": "pong",
      "ping_in_flight": false
    }
  ]
}

count retains its documented self-included meaning (1 + peers). connected is PEERS ONLY — self is self and also appears under connectivity, so a client can no longer mistake the local node for a peer. health is per-connected-peer and only claims what it can prove: healthy = last seed probe answered pong; unhealthy = the last probe answered pang/timeout or the last catalog sync exited abnormally; unknown = connected but never probed (e.g. joined manually, not a configured seed). A manually joined peer is never silently counted healthy. left is the leave set: the peers this node will not automatically rejoin. POST /api/v1/cluster/leave seeds it from the configured cluster_nodes ∪ all known peers ∪ the previously-left set (not just the links that happen to be up at leave time), casts the peer-side leave marker to visible peers (best-effort), and disconnects. A later nodeup/pong for a left peer is ignored; an explicit POST /api/v1/cluster/join is the only re-entry and clears both markers. The set is process-lifetime: a Sol restart starts with an empty leave set (the operator re-issues the leave if isolation must survive a restart). uptime_seconds is the serving node’s uptime (, ). Per-connected-node uptime would require a blocking RPC per peer on every poll — the actionable membership signal is the per-seed probe state instead (last_ping_age_seconds / last_result / ping_in_flight; last_* are null until the first probe completes; boot probes are ASYNCHRONOUS since then, so a silent seed can no longer delay the boot ladder or the listener). Unconnected seeds are re-probed on every 30s resync tick, so a peer that boots after this node self-rejoins without the join API. A degraded sol_cluster returns count: 0 with empty seeds.

POST /api/v1/cluster/join

Join a cluster node. POST only.

Request body: {"node": "sol@gpu-node-2"}

POST /api/v1/cluster/leave

Leave the cluster. POST only.

GET /api/v1/catalog

List global model catalog across cluster nodes.

Lua Workers

POST /api/v1/lua/eval

Evaluate Lua code in a sandboxed Luerl worker. POST only.

Request body: {"code": "return 1 + 1"}

Response: {"status": "ok", "result": 2}

GET /api/v1/lua/workers

List Lua workers.

POST /api/v1/lua/workers/spawn

Spawn a Lua worker. POST only.

Request body: {"script": "hello"} (optional; a non-string or

4 KiB value is 400 invalid_script). The script is loaded into the worker’s sandbox at start — the field is honored.

ZMQ

GET /api/v1/zmq/workers

List registered ZMQ workers. Each row carries the worker’s last READY capability census: mcp_servers, mcp_tools and custom_tools (integer counts of the RUNNING capability — live MCP servers, registered mcp__* tool specs, registered custom tools; a legacy pre-census worker reads 0) plus capability_degradations (array of typed reason strings such as mcp_approval_required:<server>, mcp_start_deferred:<server> or mcp_start_failed:<server>; [] when the worker is fully capable). The census is client-declared telemetry — server authorization gates never trust it.

POST /api/v1/zmq/dispatch

Dispatch task to ZMQ worker. POST only.

Request body:

{"prompt": "Fix the bug", "model": "glm-4.7-flash", "context": "...", "timeout_ms": 600000, "idempotency_key": "my-op-42", "mode": "plan"}

Fields:

timeout_ms (optional) — per-task execution timeout override; an integer 0..3600000 (0 disables the timeout for this task). The effective value is stamped on the wire frame and drives the server-side task-lease timer. A non-integer, negative, or over-bound value answers typed 400. idempotency_key (optional) — opaque caller-scoped key, <=128 bytes; a resubmit inside the claim window returns the ORIGINAL task id. A claim is released on every non-dispatch refusal (worker_overloaded, queue_full), so a resubmit after a refusal dispatches fresh. mode (optional) — advisory agent-mode request: a non-empty string <=64 bytes naming an agent mode. The value is a HINT — Sol stamps it on the task frame only when the assigned worker advertised that exact mode on READY (unadvertised values are stripped, counted in zmq_task_mode_fallback_total, and the worker keeps its default mode; permission_mode is untouched). A non-string or over-bound value answers typed 400.

Response: {"task_id": "task-abc456"}

GET /api/v1/zmq/status

Show ZMQ gateway status.

Response:

{"port": 5555, "connected": 3, "queue_depth": 0}

Circuit Breaker

GET /api/v1/circuits

List circuit breaker states.

Response: paginated envelope (/ — the bare-array example predated the pagination contract; sol_http_cluster:circuits_body/1 paginates):

{"items": [{"key": "glm-4.7-flash", "state": "closed", "failure_count": 0}], "total": 1, "limit": 50, "offset": 0, "page": 1, "total_pages": 1, "has_more": false}

POST /api/v1/circuits/reset

Reset a circuit breaker. POST only.

Request body: {"key": "glm-4.7-flash"}

Orchestration

POST /api/v1/orchestrate

Execute multi-task orchestration. POST only.

Request body:

{
  "tasks": [
    {"prompt": "Fix bug in auth", "model": "glm-4.7-flash"},
    {"prompt": "Fix bug in api", "model": "glm-4.7-flash"}
  ],
  "strategy": "parallel",
  "model": "glm-4.7-flash",
  "timeout_ms": 60000
}

Response: Orchestration results with child task outputs.

GET /api/v1/orchestrate/:id

Show orchestration detail with child task results.

Workflows

POST /api/v1/workflows/start

Start a workflow. POST only. The body requires a name (400 missing workflow name without it); objective, token_budget and any workflow inputs are optional (a steps body field is not read).

Request body:

{
  "name": "fix-auth-bug",
  "objective": "Fix authentication bug",
  "token_budget": 100000
}

Response: {"workflow_id": "wf-abc123", "status": "started"}

Idempotency. An optional Idempotency-Key request header (opaque, ≤128 bytes; an over-long value is a 400) makes the start an insert-once admission scoped to the caller: the key folds into the workflow_id, and a retried request with the same key returns the Original instance with the identical admission body (no second instance, no second audit row) — including after that instance reached a terminal state (the durable row is the record until its normal retention GC). Different keys, or the same key from a different principal, are independent admissions. Without the header every call mints a fresh instance (the documented at-least-once behavior).

POST /api/v1/workflows/:id/cancel

Cancel a workflow and its registered descendant tree.

Immediate ack. The request is acknowledged as soon as the ROOT instance answers a bounded cancel probe (3 s class); the descendant walk always runs asynchronously — it can never block the workflow manager (get_status/start_workflow stay responsive even with a wedged child). The response carries the operation handle and the root’s truthful disposition:

{
  "status": "cancelled",
  "cancel_op_id": 17,
  "root": "ok",
  "descendants_pending": true
}
Root dispositionHTTPMeaning
ok200the root transitioned to failed (reason cancelled)
cancel_pending202the root is compensating — the cancel is pending; the unwind still completes and the workflow then terminates failed with fail_reason cancelled
timeout202the root did not answer the 3 s probe; the ack is honest (status: cancel_pending), the async walk still runs

Roots already terminal answer 409 workflow already completed (or the matching already-terminal error); a missing id is 404. cancel_op_id is a monotonic per-manager handle. Descendant progress is observable through the workflow_child_cancelled events (status cancelled/pending/ skipped/unregistered), the sol_workflow_descendant_cancel_* counters (ops started/completed, children visited, cap hits, in-flight gauge), and the final workflow_descendant_cancel_completed event. The walk is bounded: 3 s per child probe and at most 256 children per operation.

A cancel that arrives while a workflow is compensating is never a lie (the previous shape answered ok while the workflow later reported compensated): the reply is the pending disposition above and the eventual state is deterministic — failed with fail_reason = "cancelled" once the unwind completes (or once the compensation window times out with a pending cancel). Without a pending cancel the same unwind lands compensated.

Marketplace

Skills marketplace for publishing, discovering, and rating agent skills (sol_http_skills.erl + sol_marketplace_store.erl). Every marketplace envelope is FLAT — {"skills": [...]} — never the paginated {items, total, has_more} shape.

GET /api/v1/marketplace

Browse published skills.

Query parameters (honored server-side — the store windows the result before returning; the flat envelope carries no total/has_more, so a truncated page is not detectable from the response alone):

ParameterDefaultDescription
sortcreated_atSort order: created_at or downloads (featured skills pin first in both orders)
tag—Filter by tag (singular query param)
author—Filter by author UUID (?author=<uuid>)
featured—Featured only: 1 or true
limit50Max results, clamped to 1..500 by the shared pagination parser (the pre-fix doc claimed a 20 default the handler never applied)
offset0Skip count (negative/garbage clamps to 0)
page01-based page number — only honored together with per_page
per_page0Items per page (≤500) — overrides limit/offset when both page and per_page are > 0

Response (200):

{
  "skills": [
    {
      "name": "code-review",
      "author_uuid": "user-abc",
      "description": "...",
      "version": "1.0.0",
      "tags": ["code"],
      "downloads": 42,
      "featured": false,
      "avg_rating": 4.5,
      "rating_count": 2
    }
  ]
}

Rating aggregates ride inline on every summary; the full review list lives behind GET /api/v1/marketplace/ratings.

GET /api/v1/marketplace/search?q=QUERY

Search marketplace skills by name or description. Same flat {"skills": [...]} envelope as browse (no pagination params).

GET /api/v1/marketplace/:name

Get skill detail with full body. Supports ?author=<uuid> for disambiguation.

Response is {"skills": [skill]}; 404 not_found when unknown.

GET /api/v1/marketplace/:name/:author

The two-segment detail form — same handler, EXACT author match (no ?author= query needed). Served by the same route row that answers the delete route on DELETE. Response is {"skills": [skill]}; 404 not_found when unknown.

POST /api/v1/marketplace

Publish a skill (or re-publish over the author’s existing one). POST only. Auth required (401 authentication_required).

Request body:

{
  "name": "my-skill",
  "description": "Does something useful",
  "body": "skill content in SKILL.md format",
  "version": "0.1.0",
  "tags": ["code", "utility"],
  "triggers": [],
  "arguments": []
}
FieldTypeRequiredDescription
namestringYesLowercase alphanumeric + hyphens (^[a-z0-9][a-z0-9-]*$). Reserved route names (search, reports, dismiss, feature, rate, ratings) are rejected
descriptionstringYesShort description (non-empty)
bodystringNoFull skill body (default "") — capped at skill_body_max_bytes (default 262144 = 256 KB; the same cap the registry enforces and the worker materializer refuses over)
versionstringNoDefaults 0.1.0
tags / triggers / argumentsarrayNoDefault []

Responses:

201 {"status": "created", "name": "..."} — first publish 200 {"status": "updated", "name": "..."} — same author re-published; existing downloads/created_at/featured are preserved 400 missing_name_or_description · 400 invalid name (reserved or regex mismatch) 413 body_too_large — body over skill_body_max_bytes (default 262144 = 256 KB) 429 rate_limited — only when the operator enables the limiter (below)

Rate limiting (truth): the publish path runs through the shared per-user rate limiter (rpm 60 / burst 10, retry-after header on 429), but the limiter is DISABLED by default (rate_limit_enabled=false) — publishes are never 429’d unless the operator turns it on. The previously documented “10 publishes per hour” limit never existed and has been struck. The RATE endpoint (POST /api/v1/marketplace/rate) has no limiter at all.

GET /api/v1/marketplace/ratings?name=NAME&author=AUTHOR

Aggregate ratings for a skill. Both name and author are REQUIRED — either missing answers 400 missing_name_or_author.

Response (200):

{"ratings": [{"user_uuid": "...", "rating": 5, "review": "...", "created_at": 1745600000000}], "avg_rating": 4.5, "rating_count": 1}

POST /api/v1/marketplace/rate

Rate a skill. POST only. Auth required (401 authentication_required). No rate limiter on this endpoint.

Request body:

{"name": "my-skill", "author": "user-abc", "rating": 5, "review": "great"}
FieldTypeRequiredDescription
namestringYesSkill name
authorstringYesAuthor UUID (disambiguates same-name skills)
ratingintegerYesRating value (out-of-range → 400)
reviewstringNoFree text, default "" (hashed in the audit trail, never stored in logs)

Responses: 201 {"status": "created"} · 409 duplicate_rating (one rating per user per skill — re-rating is a 409, not an update) · 400 missing_fields (any of name/author/rating missing) · 400 invalid_rating.

DELETE /api/v1/marketplace/:name/:author

Requires the marketplace:manage RBAC scope; the handler additionally allows only the skill’s own author (the path :author must equal the caller uuid) or an admin (403 forbidden otherwise). Unknown rows answer the 404 zerg envelope.

Delete a published skill. DELETE. Author or admin only (403 forbidden otherwise; 404 not_found when unknown).

Response: 200 {"status": "deleted"}

POST /api/v1/marketplace/:name/:author/install

The explicit consume act: returns the full skill record — body included — plus a provenance map, and records the receipt server-side (audit row + download counter). POST only. Auth required (401 authentication_required); gated on the marketplace:install scope (seeded for the member role; viewer does not hold it). Rate-limited through the shared limiter like publish (disabled by default).

Response (200):

{
  "skill": {"name": "my-skill", "description": "...", "body": "---\n...", "version": "1.0.0", "author_uuid": "user-abc", "tags": []},
  "provenance": {"source": "marketplace", "version": "1.0.0", "author_uuid": "user-abc", "fetched_at": 1745600000000}
}

Responses: 404 not_found (unknown name/author pairing) · 413 body_too_large (the stored body exceeds the current skill_body_max_bytes — e.g. the cap was lowered after publish) · 429 rate_limited · 503 rate_limiter_unavailable.

The worker / CLI side writes the body to a local SKILL.md and stores the provenance beside the file (provenance.json) under the managed remote skills root; Luna also fences the body as <untrusted-memory source="skills.remote"> when it renders into a prompt.

POST /api/v1/marketplace/:name/:author/report

Report a skill for moderation. POST only. Auth required.

Request body: {"reason": "description of issue"} (defaults to "no_reason" when absent).

Response: 201 {"report_id": "..."} — the reason is hashed (reason_sha256) in the audit trail, never logged verbatim.

GET /api/v1/marketplace/reports

List pending skill reports. GET. Admin only (403 admin_required).

Response: {"reports": [{"id": "...", "skill_name": "...", "author_uuid": "...", "reporter_uuid": "...", "reason": "...", "timestamp": 1745600000000}]}

POST /api/v1/marketplace/reports/:id/dismiss

Dismiss a skill report. POST only. Admin only (403 admin_required).

Response: 200 {"status": "dismissed"}

POST /api/v1/marketplace/feature

Feature or unfeature a skill. POST only. Admin only (403 admin_required).

Request body: {"name": "my-skill", "author": "user-abc", "featured": true} (featured: false unfeatures; defaults true when absent).

Responses: 200 {"status": "ok"} · 400 missing_name_or_author · 404 not_found.

Workspace

Remote file operations within the workspace. Scope: a non-admin caller’s root is <workspace_root>/users/<server-derived-scope>/ paths are relative to that subtree, so a member cannot read/write another member’s task workspace. An admin uses the global workspace root and may cross into any users/<scope>/ subtree. The scope is derived from the authenticated identity, never from a request field; . and .. principals are hashed.

POST /api/v1/workspace/read

Read file contents.

POST /api/v1/workspace/write

Write file contents. POST only. Uses atomic writes (tmp + rename).

Request body: {"path": "src/main.rs", "content": "..."}

POST /api/v1/workspace/edit

Apply an edit to a file. POST only.

Request body: {"path": "src/main.rs", "old": "old text", "new": "new text"}

POST /api/v1/workspace/search

Search workspace files by content.

GET /api/v1/workspace/list?path=DIR

List directory contents.

Managed Settings

GET /api/v1/managed-settings

Get managed (fleet-push) settings. Admin only.

Response ({ok, data, schema} envelope; data is the settings map, schema is the shared key contract — ):

{"ok": true,
 "data": {"execution.policy": "standard", "_schema_rev": 1},
 "schema": {"schema_rev": 1, "keys": {"execution.policy": {"type": "enum", "values": ["strict", "standard", "permissive"], "target": "execution.policy", "consumer": "core.command_policy"}}}}

data._schema_rev is server-injected metadata (never persisted); worker appliers running an older schema rev skip the payload loudly.

PUT /api/v1/managed-settings

Update managed settings. PUT only (reads via GET above). Admin only. The body is SHAPE-AWARE and SCHEMA-BOUND:

{"key": "<name>", "value": <value>} — single-key MERGE into the existing settings map; unrelated keys survive. The audit entry records op: "merge" plus the merged key, and the managed_settings_update event publishes only the changed key(s) (this PUB drives the Luna refetch). any other JSON object — FULL REPLACEMENT of the settings map (audited as op: "replace"; the event carries the full map). Note that an object carrying both key and value is always a merge. Only the keys in docs/fixtures/managed_settings_schema.json are valid: execution.policy (enum), execution.max_iterations (int 1–200), execution.session_budget_usd (number 0–1000000). Legacy free-form keys already stored are ignored by workers (loud skip

  • counter) and rendered read-only by the console.

Request body (merge — the ops-console shape):

{"key": "execution.max_iterations", "value": 40}

Request body (full replacement):

{"execution.policy": "strict", "execution.max_iterations": 40}

Errors: 400 invalid_json (non-object JSON), 400 invalid_shape (malformed {key,value} — half-shapes, non-binary/empty key), 400 unknown_setting_key (key outside the schema; the message lists the nearest known keys), 400 setting_out_of_bounds, 400 setting_type_mismatch, 503 persist_failed when the durable snapshot write fails (settings are left unchanged — the save is not acknowledged). A refused PUT never persists, audits or publishes.

Settings persist to <data_dir>/managed_settings.json at every PUT and reload at boot; a corrupt snapshot refuses boot.

Sessions

POST /api/v1/sessions

Create a session share link. POST only. The body carries the session data to share (arbitrary string — typically a serialized session/JSONL export); session_data is REQUIRED (400 session_data_required without it), format and ttl_days are optional.

Request body:

{
  "session_data": "{\"type\":\"session_meta\",...}",
  "format": "jsonl",
  "ttl_days": 7
}

Response (201):

{"share_id": "shr-xyz789"}

The response carries share_id plus an optional url ({"share_id": "...", "url": "https://<base_url>/api/v1/shares/shr-xyz789"}) only when the operator has configured base_url (sys.config or SOL_BASE_URL). The path is the anonymous capability surface (/api/v1/shares/<id>), never the authenticated /api/v1/sessions/<id> route — the mint and the auth exemption consult sol_session_shares:share_url_prefix/0. There is NO expires_at field — expiry is internal state, never emitted (the previously documented expires_at response field was struck in Clients who need it can derive it from ttl_days at create time).

Capability-token model: the share id IS the capability. GET /api/v1/shares/:share_id is unauthenticated BY DESIGN — the public-read LOW adjudication accepted that anyone holding the opaque id can read the share; the id is the secret (256-bit random, unguessable), and there is no separate ACL. Compensating controls: per-user create quota, per-IP read rate limiting, and a notice-level read audit log (below).

TTL clamp: ttl_days is clamped server-side to min(ttl_days, 365) — a larger request still succeeds but is silently capped to one year, with a loud share ttl_days N clamped to 365 warning in the server log. Omitted ttl_days falls back to the server’s default share retention.

Quota: creates are bounded per user by share_quota_per_user (default 100 live shares). At the quota the endpoint answers 429 share_quota_exceeded with a retry-after: 3600 header (the hourly cleanup cadence frees slots) — never a 500.

Public-read controls: GET /api/v1/shares/:share_id is per-IP rate limited (share_rate_limit_per_min) and every read is logged at notice level (share read id=<share_id> ip=<peer>).

Errors: 400 session_data_required · 429 share_quota_exceeded when the caller is at the per-user share quota (share_quota_per_user, default 100; retry-after header carries the suggested retry horizon, ).

GET /api/v1/sessions/:share_id

Get shared session data. Two surfaces:

Owner (or admin) read — the ownership decision runs through the NON-counting sol_session_shares:peek/1, so loading your own share never consumes a view; the response is the owner projection {data, format, created_at, remaining_views} (200). remaining_views is owner-only — the consumer surface never sees it (live-share oracle). Consumer read — every other caller goes through the counting get/1; a read IS a consumed view. 404 when expired, unknown, or view-exhausted (expired / never-existed / exhausted are indistinguishable on this surface — + ).

DELETE /api/v1/sessions/:share_id

Delete a session share. Owner or admin only (403 otherwise). Unknown ids answer 404 not_found; an expired share answers 404 not_found too — expired and never-existed are indistinguishable on every share leg since ( swept this paragraph, the last 410 expired claim; sol_http_sessions.erl:session_delete/2). A View-exhausted share joins the same typed gone class (, CORE-1 — the pre-fix missing arm crashed the request process into an unguarded 500), and the ownership probe is the non-counting peek/1, so repeated owner DELETE attempts never burn the share’s own view budget.

GET /api/v1/shares/:share_id

Get a share by id — the standalone PUBLIC share endpoint (unauthenticated BY DESIGN — see the capability-token model above): {data, format, created_at} (200), 404 when expired or unknown .

HEAD is non-counting AND non-oracular: after the per-IP limiter it answers 204 for every well-formed id — live, expired, and unknown are indistinguishable and no view is consumed. The pre-fix 200/404 verdict was a free liveness oracle. The per-IP rate limit keys the TRUSTED-PROXY-RESOLVED client address (an untrusted peer’s X-Forwarded-For/X-Real-IP never influence the bucket); a refusal is 429 rate_limited with Retry-After: 60. Read logs carry a sha256 PREFIX of the share id, never the full capability.

Webhook

POST /api/v1/webhook/:channel_id

Webhook receiver for channel integrations (Telegram, Slack, Discord, Teams). Validates per-platform signature.

** contract:**

Channel config is written by JSON (BINARY keys) or bundled plugin configs (atom keys); both are read. Slack signatures are compared in lowercase hex (the real Slack encoding) and an empty/missing secret is the fail-closed “not configured” class (403), never an empty-key accept. A paused channel refuses deliveries with 404 (only status=active channels accept), and pausing one channel stops that platform’s poller only when no sibling channel of the same type is still active. Replay keys are channel-scoped. Telegram uses the durable update_id and Teams the activity id (7-day replay window), so a captured delivery is refused long after the 5-minute nonce TTL; Slack/Discord keep the signature+timestamp window. ** (CTRL-25): the replay seen-set is durable and shared.** Every accepted key is fsynced to <data_dir>/webhook_replay.journal (loaded and compacted at boot by the channel owner), so a restart drill still refuses the capture; accepted keys are also announced to the connected Sol nodes (the sibling records them), so a replay routed to another node is refused once the announcement lands. The residual is the in-flight announcement race; the platform freshness window still bounds signature-bearing deliveries.

Teams subscription validation: a POST carrying ?validationToken=<token> answers 200 with the token echoed as the response body (text/plain) — Microsoft’s provisioning handshake requires the echo. The echo performs NO audit write and NO plugin dispatch, and is now bound and bounded: it requires a configured teams_auth_token, echoes at most 4096 bytes, and is rate-limited per channel (teams_validation_rate_per_minute, default 30/min). An unconfigured channel and an oversized token answer the same generic 404 as an unknown channel (no existence leak); over-budget answers 429 with an empty body and Retry-After: 60 — never the token. All other Teams POSTs require Authorization: Bearer <teams_auth_token> and answer 200 with an empty body (audited + dispatched) as before; all other platforms are byte-identical to previous.

Readiness

GET /api/v1/ready

Deep health check for load balancers. Returns 200 only when all subsystems are ready.

Response: {"status": "ok", "checks": {...}} on 200; {"status": "degraded", "checks": {...}} on 503 (sol_health:readiness/0 — corrected the stale {"status": "ready"} example).

Events & Cursors

GET /api/v1/events supports two cursor styles:

?since=<unix_ms> — timestamp cursor; ties at the same millisecond may be missed at page boundaries. ?since_id=<seq> — tuple cursor (timestamp, seq) with id tiebreak: same-ms events are never skipped or duplicated. Responses carry newest_timestamp + newest_id; pass BOTH back on the next poll.

Aggregate scoping: ?aggregate=<aggregate_id> lists the events of ONE aggregate over the {aggregate_id, seq, event_id} ordered index (never a full-aggregate materialization). Reads are Caller-scoped: a non-admin — or an admin passing ?user_uuid=<uuid> — sees only that caller’s events in the aggregate; an admin with NO ?user_uuid sees all of the aggregate’s events. The ?aggregate=all pseudo-value is removed — the explicit value answers 400 unknown_parameter.

The aggregate envelope is {"items": [...], "limit": N, "offset": O, "page": P, "has_more": bool, "next_cursor": "<seq>:<event_id>" | null}. It deliberately has no total/total_pages: an aggregate count cannot be produced without walking the whole aggregate, which is exactly what the indexed read replaced. offset pagination is honored up to 10001 (deeper offsets are a typed 400); from_seq is an inclusive replay cursor (seq >= from_seq, seq 0 included). next_cursor carries the exact {seq, event_id} pair of the last returned row and resumes strictly after it — duplicate-seq rows past a page boundary are reachable. Pass it back as ?cursor=<seq>:<event_id> with no offset and no from_seq (those combinations answer 400 cursor_with_offset / cursor_with_from_seq; combining them would double-skip).

A caller-scoped walk that must visit more than the server’s index-row scan bound answers 400 aggregate_scan_limit_exceeded instead of walking the whole aggregate (the unscoped admin read stops at offset+limit+1).

A request with no aggregate: an admin with NO ?user_uuid gets the cross-aggregate listing (, — newest-first, same envelope + cursor contract; the pre-fix shape was a structurally-empty page), while a non-admin resolves to their own user_uuid stream.

SSE (/api/v1/sync-events) is scoped to the caller’s user_uuid for non-admins — sessions never see other users’ event frames.

Sync-events stream frames

The text/event-stream carries four frame kinds. Every sync_event frame carries id: <seq>:<event_id> (the same pair the aggregate REST cursor uses) for client-side dedupe/correlation. Resume is explicitly unsupported on this stream: the stream is mixed-aggregate, so Last-Event-ID and ?from_seq are not honored on /api/v1/sync-events; a reconnect is a FRESH stream and the client resyncs affected aggregates via GET /api/v1/events?aggregate=<id> (the event.gap contract below). Do not treat the id: as a resumable cursor.

SSE event:Meaning
sync_eventone stored event (the N:type record fields as JSON; framed with id: <seq>:<event_id>)
event.gapdrop signal — the server’s per-subscriber queue bound (subscriber_queue_limit, default 256) dropped events for the aggregate named in the frame; the stream stays open
stream_errortyped server signal — error is EITHER a string code OR an object carrying a code. Two emitters are TERMINAL (written with fin, no done follows): (1) graceful shutdown — {"error":"server_shutdown","message":"server is shutting down","truncated":true} on the sync-events, workflow AND conversation streams, and on the replay drain (GET /replay/:session/events receives this same payload when the drain fires); (2) replay store failure/writer crash — {"error":"replay_store_unavailable","reason":"<detail>","truncated":true} when a replay page read fails or the replay writer crashes (that endpoint emits done only for a complete history walk). The third emitter is PER-EVENT: (3) encoding failure — {"error":{"code":"event_encoding_failed"},"truncated":true} is written with nofin when one event payload cannot be JSON-encoded (defense-in-depth: payloads are already sanitized with typed placeholders before encode); the stream stays open and one frame replaces each unencodable event. Every payload carries "truncated": true — the delivered prefix is valid but incomplete. Client contract: reconcile every viewed aggregate from its REST cursor immediately on receipt (an encoding failure never reconnects, so waiting for a close would never heal the drop); Limon calls the same targeted reconcile path on every frame and surfaces the reason, while the CLI’s SSE readers carry a defensive stream_error arm (exit 2, reason on stderr) — no Sol route the CLI streams emits the frame today
doneterminal frame; the stream closes.: emitted when the sol_sync_event store dies (its subscriber table dies with it — no further deliveries will ever arrive) with the reason {store_restart, Reason} logged + counted (sync_event_store_restarts_total); the client’s reconnect IS the documented resync path (pre-fix the stream heartbeated forever)

The other SSE planes use their own frame names: the workflow stream (GET /api/v1/workflows/:id/stream) frames event: workflow_event and the conversation stream (GET /api/v1/conversations/:conv_id/stream) frames event: message_append; both terminate with event: done (or the shared terminal event: stream_error shutdown frame).

event.gap data payload:

{"kind": "gap", "aggregate_id": "task-abc", "last_seq": 42}

Client contract: everything up to and including last_seq for that aggregate may have been skipped by this stream. On receipt, resync the aggregate via GET /api/v1/events?aggregate=<id> (with the aggregate-scoped from_seq replay cursor; from_seq without aggregate is a typed 400 unknown_parameter, ) and continue consuming in place — the stream does NOT close on a gap. Delivery is collapsed: a flood past the bound produces one gap frame per aggregate per drop epoch (a later successful delivery closes the epoch; the next drop opens a new one), never one frame per dropped event. The per-event seq fields let consumers detect residual discontinuities.

Sync-events store semantics (sol_sync_event)

The sync-event store streams versioned events to subscribers. Events are stored as N:type (e.g. 1:task.completed); base_type/1 strips the version prefix.

Subscription filters (sol_sync_event:subscribe/1):

Filter formMatches
allevery event
AggregateIdevents whose aggregate id equals the given term
{types, [Type,...]}events whose base type is a member — versioned stored types match their base, so {types, [<<"plugin.loaded">>]} matches a stored 1:plugin.loaded

The plugin manager subscribes with {types, [<<"plugin.loaded">>, <<"plugin.unloaded">>]}. Both event types carry plugin_name (the loaded/unloaded plugin’s name) and are produced by the event forwarder from the manager’s plugin_loaded/plugin_unloaded notifications — plugin lifecycle state is manager state and belongs in the sync stream; plugin-emitted plugin.* activity events remain excluded .

Replay semantics: replay/1 never rewinds the per-aggregate sequence. The event_sequence row is written only when absent or when the replayed event’s seq is strictly higher — replaying an old event (or an out-of-order recovery batch) leaves the stored seq unchanged, so downstream compare-and-write projectors and compaction ordering stay monotonic.

Chat capacity semantics

POST /api/v1/chat (session create):

StatusBody codeMeaning
429seat_cap_reachedSeat cap saturated (Retry-After: 1)
429max_workers_reachedWorker ceiling (Retry-After: 1)
429too_many_sessionsSession cap: 20 active sessions per user, or 500 active sessions globally
503license_unavailableLicense service unreachable under block mode
413body_too_largeBody over 10 MB

POST /api/v1/chat/:id/message takes {"content": "..."} — a missing or empty content answers 400 content_required. Read timeouts on the message body answer 408 request_timeout; a client that disconnects mid-read answers 499 client_disconnect.

Turn idempotency. The send body may carry {"client_turn_id": "<id>"} (non-empty binary, ≤128 bytes; the same field the WS message frame already carries). The id is content-bound in the session owner’s bounded side table (per-session cap chat_turn_dedupe_max_per_session, TTL chat_turn_dedupe_ttl_ms):

CaseAnswer
fresh id (or no id)200 {"ok":true,"data":{"task_id":"…","status":"dispatched"}}
replay, same id + same content within the window200 with "deduped":true and the ORIGINAL task_id (no second worker turn)
same id, different content409 code client_turn_id_conflict
another transport holds the session turn409 code streaming_in_progress + task_id + Retry-After: 1

The WS path speaks the same verdicts as frames: a fresh ack is {"type":"ack","task_id":"…","session_id":"…"}, a replay adds "deduped":true, and the refusals are non-terminal error frames with code streaming_in_progress / client_turn_id_conflict.

Dispatch failures are classified, never a blanket 500: a dead worker family (noproc, os_process_dead, not_found, and the typed worker_not_found pipeline-attach refusal) answers 503 worker_unavailable — the same code the WS path surfaces as its error frame.

Stream semantics:

GET /api/v1/chat/:id/stream holds its max_sse_connections slot for the WHOLE stream (previous the slot was released at handshake and the budget never bounded chat). One live stream per session: a second GET.../stream REPLACE-KILLS the elder — the elder’s stream receives event: replaced + fin, its slot is released, and the newest stream wins (loudly counted server-side). event: done / event: error close the stream; a pipeline that dies without a terminal frame closes the stream with event: error (reason: "pipeline crashed") instead of hanging open.

Streamed turns persist a checkpoint every chat_checkpoint_tokens tokens / chat_checkpoint_ms ms, so a mid-stream crash loses at most one window.

Scheduler quotas

Global cap: max_scheduled_jobs (default 1000) → 429 max_jobs_reached. Per-user cap: max_scheduled_jobs_per_user (default 100) → 429 {per_user_limit_reached, N}. Impossible cron expressions (e.g. 0 0 31 2 * — February never has a 31st; ) are rejected at create/update time via sol_cron:validate_schedule/1 (invalid_cron for parse failures, impossible_schedule for provably-undecidable day-vs-month-length combinations). An impossible expression that still reaches the advance path disables the job (status: disabled) instead of re-firing every minute. Job records have no last_error field.

Scheduler timezones

All cron/at/every scheduling is naive UTC — this is a recorded posture decision: there is no IANA timezone support and no DST adjustment. A schedule written in local wall-clock time is Silently shifted by the UTC offset (and by DST transitions). Schedule in UTC.

Cron expressions evaluate in UTC (all schedule timestamps are UTC epoch-ms). Every schedule/job response carries a tz field ("UTC") so operators are never surprised. sol_cron:explain_next/3 returns the literal UTC fire times for an expression (the next N firings from a given epoch-ms), so a schedule can be verified before it is committed.

Missed-fire contract. An interval job never runs concurrently with itself: grid fires that elapse while its own task is still running are skipped, counted per job in fires_skipped, and emitted as a scheduler.fires_skipped event on advance (the payload carries the skipped count). Boot catch-up fires an overdue job once and re-arms the tail on the next interval-grid boundary — it never replays the backlog (per-job missed_fire_count is the record; cron/at report 0 because a per-fire backfill would need a search). Additionally: a job created via a plugin’s sol.scheduler bridge delivers its event to the plugin’s on_event (it never dispatches a prompt-less task), and scheduler_degraded_total counts store outages on live ticks — ticks degrade to no-dispatch and recover automatically.

License status

GET /api/v1/license/status (admin) — enforcement state, source (file/remote/fallback), caps, packs, refresh clock. When the license service is unreachable the endpoint still returns 200 with {"enabled": false, "reason": "license_unavailable"} (never a 500).

Method Enforcement

These endpoints require POST. All other methods return 405 Method Not Allowed:

POST /api/v1/start POST /api/v1/stop POST /api/v1/stop-all POST /api/v1/discover POST /api/v1/prepare/:name POST /api/v1/agents/spawn POST /api/v1/agents/:id/kill POST /api/v1/cluster/join POST /api/v1/cluster/leave POST /api/v1/lua/eval POST /api/v1/lua/workers/spawn POST /api/v1/zmq/dispatch POST /api/v1/circuits/reset POST /api/v1/schedule/spawn POST /api/v1/schedule/:id/run POST /api/v1/channels/spawn POST /api/v1/channels/:id/message POST /api/v1/orchestrate POST /api/v1/recipes/:name/run POST /api/v1/memory/store POST /api/v1/memory/:agent_id/clear POST /api/v1/memory/:agent_id/:key/delete POST /api/v1/memory/:agent_id/vector-search POST /api/v1/memory/:agent_id/decay POST /api/v1/memory/:agent_id/:key/pin POST /api/v1/conversations/:conv_id/delete POST /api/v1/chat POST /api/v1/chat/:id/message POST /api/v1/persistence/flush POST /api/v1/teams POST /api/v1/teams/:id/members POST /api/v1/teams/:id/mail POST /api/v1/infra/maintenance/enable POST /api/v1/infra/maintenance/disable POST /api/v1/goals POST /api/v1/goals/:id/cancel POST /api/v1/acp/agents/:agent_id/message POST /api/v1/marketplace/rate POST /api/v1/marketplace/:name/:author/report POST /api/v1/marketplace/reports/:id/dismiss POST /api/v1/workspace/write POST /api/v1/workspace/edit PUT /api/v1/managed-settings POST /api/v1/sessions POST /api/v1/schedule/:id/pause POST /api/v1/schedule/:id/unpause POST /api/v1/providers/reload POST /api/v1/skills POST /api/v1/workflows/start POST /api/v1/workflows/:id/cancel POST /api/v1/workflows/:id/branch POST /api/v1/workflows/:id/pause POST /api/v1/workflows/:id/resume POST /api/v1/recipes/reload POST /api/v1/auth/login POST /api/v1/auth/logout POST /api/v1/infra/cache-invalidate POST /api/v1/workspace/read POST /api/v1/workspace/search POST /api/v1/webhook/:channel_id POST /api/v1/marketplace (publish — the same path serves browse on GET) POST /api/v1/marketplace/feature

Every entry above is enforced at a handler/dispatch case cowboy_req:method gate that replies 405 (verified against sol_http.erl’s enforced-POST dispatch guard and the per-module handlers, ). One shape note for precision:

Follow-up: POST /api/v1/workers/bg/start + POST /api/v1/workers/bg/:bg_id/kill were verb-agnostic (kill answered ANY method) — both now join the enforced POST-only guard. Deliberately NOT listed: POST /api/v1/agents/:id/task (a body-parsing endpoint without a 405 verb check). PUT /api/v1/managed-settings above is the list’s one non-POST entry, kept because it is method-enforced to PUT.