Console

HTTP API

Every route of Console's HTTP API and live WebSocket, with the role or scope each one needs.

JSON bodies (Content-Type: application/json), snake_case keys, versioned under /api/v1. Errors are { code, message, details? } with console.* codes, and each code has one HTTP status. Authenticate with Authorization: Bearer <token>: a named token (vct_...) or a sign-in session (vcs_...). In a proxy mode the proxy's proof can authenticate instead. Reads need read; the column says what else a route needs. Every list takes tenant, and tenant-scoped principals only ever see their tenants.

@viewportai/console/client wraps every route; the examples use it.

Sign-in and live

RouteNeedsDoes
POST /api/v1/login {token}Console's Origin, local modeExchange a one-time sign-in token for a session: { session, user }
POST /api/v1/logoutEnd this session
POST /api/v1/login/linksadminA new sign-in link: { url }. Needs approve, or the CLI's own token. In every home but the default (~/.viewport/console, the only one every daemon on the machine hides), the CLI token itself can only read (every other route answers console.forbidden with details.reason: "cli_token_capped"), and its links sign in read only: { url, scopes: ["read"], warning }
GET /api/v1/meWho you are: role, scopes, tenants, Console's fingerprint
GET /api/v1/sessionnoneNever 401: { signed_in, auth_mode, me? }, where me is exactly what /api/v1/me returns. A missing or bad credential (or a proxy header without proof) is signed_in: false. Host and Origin are checked; signed-out probes are limited per peer address
POST /api/v1/live/ticketA single-use ticket, valid 30 s: { ticket }
GET /api/v1/live?ticket= (WebSocket)the ticketTopics session, inbox, daemons

Live messages: { type: "subscribe", id, topic, daemon_id?, session_id?, after_seq?, tenant? }, answered by { type: "result", id, ok, data | error }. After that come event, session.updated, session.lagged, inbox.updated and daemon.updated. Above 4 MiB queued, terminal output to that socket stops; below 1 MiB it resumes with a session.lagged for the gap. Above 16 MiB the socket closes with code 4013.

Daemons and sessions

RouteNeedsDoes
GET /api/v1/daemonsPaired daemons with connection state, runners, clock skew
POST /api/v1/daemons/preview {link}adminConfirmation data: both fingerprints in groups of 4, targets. No network
POST /api/v1/daemons {link, replace?} | {local: true, unprotected_home?}adminPair: { daemon, daemon_fingerprint, console_fingerprint, warnings }. An already paired daemon is re-paired only with replace: true (else 409 console.conflict, details.reason: "already_paired"), because a link's role is known only after pairing; a lower role adds a warning. The preview reports already_paired: { role }. Failures: console.pair_link_used (410), console.pair_not_confirmed (409, try again), console.pair_refused (403), console.pair_unreachable (504), console.pair_failed (502, a broken handshake), console.pair_target_forbidden (400), and for local: true console.home_unprotected (409: the daemon does not hide Console's home from its agents; details.fix is the export line, unprotected_home: true pairs anyway). A daemon's stated reason is unverified (details.unverified)
GET /api/v1/daemons/:daemon_idOne daemon
PATCH /api/v1/daemons/:daemon_id {name?, send_actor?}adminRename; send the answering person as actor
DELETE /api/v1/daemons/:daemon_idadminUnpair: { left, command? }
GET /api/v1/sessions?daemon_id&status&tenant&before&limitSessions across daemons, newest first
GET /api/v1/daemons/:daemon_id/sessions/:session_id{ session, cursor }
GET .../sessions/:session_id/events?after_seq&limitEvents from the cache, or from the daemon for ranges the cache lacks
GET .../sessions/:session_id/trajectoryThe session as trajectory/v1
POST /api/v1/daemons/:daemon_id/sessionscontrolStart: {runner, cwd, idempotency_key, prompt?, command?, args?, name?, model?, terminal?, tenant?, resume?}. env is refused
POST .../sessions/:session_id/{input,resize,interrupt,stop}controlinput {text | data_b64}, resize {cols, rows}, stop {grace_ms?}; request_id dedupes for 10 minutes

Controlling or answering on a daemon also needs Console's pairing on that daemon to be controller.

Inbox

RouteNeedsDoes
GET /api/v1/inbox?status&source_id&tenant&limit&afterA page of items you may see (next continues it), with pending counts per source and each daemon's clock skew
GET /api/v1/inbox/:keyOne item, as seen by you (answered_by_you is per person)
POST /api/v1/inbox/:key/answer {answer, digest, reason?, message?, edited_args?, acknowledge_hidden?}approve{ outcome, item, error? }: decided, accepted, sending, conflict, rejected, failed. Approving an item with hidden.count > 0 needs acknowledge_hidden: true, else 409 console.not_answerable with details: { blocked: "hidden_unacknowledged", hidden, hidden_by }

Sources, receipts and runs

RouteNeedsDoes
GET /api/v1/sources?kindSources (configs only for admins); console is Console's own chain
POST /api/v1/sourcesadmin{kind: evals, dir}, {kind: receipts, path | store, anchor?}, {kind: hitl, name, reply_url?, protocol?, allow_private?} (reply_url is never link-local or metadata, and private ranges need allow_private: else 400 details.reason reply_url_forbidden or reply_url_private), {kind: hitl_store, path | dsn}, {kind: trajectories, dir}. HITL returns console_url (or webhook with protocol: webhook) once
DELETE /api/v1/sources/:source_idadminRemove
POST /api/v1/sources/:source_id/rotate-secretadminNew HITL credentials
GET /api/v1/sources/:source_id/files/<path>Evals results files, read-only, Range supported
GET /api/v1/sources/:source_id/receipts?kind&approval_id&by&after&limit&tenantA page of receipts across every chain you may see; next is the cursor for after. With tenant (one chain), after_seq also works
GET /api/v1/sources/:source_id/verify?tenant{ ok, count, head, error?, chains[], anchor_checked, command }
POST /api/v1/receipts/anchoradminThe chain head (also appended to receipts.anchor_to)
GET /api/v1/sources/:source_id/approvals?status&tenant&before&limitA HITL store's approvals, read-only
GET /api/v1/runs?source_id&status&tenant&before&limitRuns from trajectory stores
GET /api/v1/runs/:source_id/:trajectory_id?tenantOne run, stitched across episodes

When a daemon refuses a request, the response carries the daemon's own code and message (daemon.invalid_request 400, daemon.forbidden 403, daemon.session_not_found 404, daemon.idempotency_conflict 409, daemon.runner_unavailable 422, daemon.capacity 429, daemon.shutting_down 503), with its details plus daemon_id. console.daemon_error (502) and console.daemon_offline (503) are only for a daemon that did not answer, or answered with something that is not a valid reply.

console.not_supported (501) names what is unsupported and what to use instead. In v1 that is a Postgres trajectory store (use a JSONL trajectory directory), or a HITL Postgres store without the optional pg package.

Admin

RouteNeedsDoes
GET /api/v1/tokens, POST /api/v1/tokens {name, scopes, tenants?}, DELETE /api/v1/tokens/:nameadminNamed tokens, shown once. A token never gets a scope its creator lacks
GET /api/v1/users, PUT /api/v1/users/:id {role, tenants?}, DELETE /api/v1/users/:idadminUsers and roles. You can grant only a role whose scopes you hold. Removing a user ends their sessions; users removed from console.yaml are removed on start
POST /api/v1/auth/revoke-sessions {user_id?}adminEnd every session, or one user's. Sessions also end 7 days idle or 30 days after sign-in. Live sockets re-check within 30 seconds and close on revoke
GET /api/v1/identityConsole's peer id, fingerprint and key storage
GET /api/v1/doctoradminProtections and warnings, including home_coverage (memory, default, env, daemon, unprotected), home_coverage_verified, and cli_token (full or read). The CLI token may read it in every home

Hooks and health

RouteAuthDoes
POST /hooks/hitl/:source_idStandard Webhooks signatureA gate's approval.requested and approval.decided
GET /hooks/hitl/:source_id/approvals/:approval_idsignatureThe gate's status pull; Console answers Ed25519-signed on the console channel
GET /healthnone{ ok: true }

On this page