SNA

HTTP routes

Every server endpoint, grouped by surface.

The HTTP API is grouped by surface. Each path below links to a dedicated endpoint specification page.

Authentication

GET /health is public. Every other route on the SNA runtime requires Authorization: Bearer <authToken>, including /api/sna-port, SSE routes, and chat image reads. Missing or invalid tokens return 401; browser requests from disallowed origins return 403.

SDK-managed hosts should pass handle.connection to SnaClient or SnaProvider. A separate app-owned discovery endpoint may return { baseUrl, authToken } to a trusted renderer, but the SNA runtime's own /api/sna-port route is still protected.

System

MethodPathPurpose
GET/healthHealth check
GET/api/sna-portRead the current SNA API port

Sessions

MethodPathPurpose
POST/agent/sessionsCreate a session record
GET/agent/sessionsList sessions
PATCH/agent/sessions/{id}Update label, meta, cwd
DELETE/agent/sessions/{id}Delete a session, history, runtime chain, and pending permission

Agent lifecycle

MethodPathPurpose
POST/agent/startSpawn an agent into a session
POST/agent/sendSend a message
POST/agent/restartKill and re-spawn
POST/agent/resumeResume with normalized history
POST/agent/interruptCancel the current turn
POST/agent/set-modelChange model at runtime
POST/agent/set-permission-modeChange permission mode at runtime
PATCH/agent/sessionUnified config mutator
POST/agent/killKill the agent process
GET/agent/statusStatus snapshot

One-shot calls

MethodPathPurpose
POST/agent/run-onceRun once and return result
POST/agent/run-once/streamRun once with SSE events
POST/agent/completionOne-shot completion

Permissions

MethodPathPurpose
POST/agent/permission-requestSubmit and wait for approval
POST/agent/permission-respondApprove or deny
GET/agent/permission-pendingList pending requests

Models and events

MethodPathPurpose
POST/agent/list-modelsRuntime model introspection
GET/agent/eventsSession event SSE stream

Chat (canonical history surface)

MethodPathPurpose
GET/chat/sessionsList chat sessions from DB
POST/chat/sessionsCreate chat session
DELETE/chat/sessions/{id}Delete chat session
GET/chat/sessions/{id}/messagesList messages
POST/chat/sessions/{id}/messagesAppend message
DELETE/chat/sessions/{id}/messagesClear messages
GET/chat/images/{sessionId}/{filename}Serve an image embed

Response shape

Most SDK-facing responses are wrapped by server/api-types.ts, while streaming and binary endpoints use their wire-native response bodies. The live OpenAPI document remains the source of truth for exact schemas.

type ApiResponse<T> =
  | { status: "ok"; data: T }
  | { status: "error"; message: string; code?: string };

On this page