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
| Route | Needs | Does |
|---|---|---|
POST /api/v1/login {token} | Console's Origin, local mode | Exchange a one-time sign-in token for a session: { session, user } |
POST /api/v1/logout | End this session | |
POST /api/v1/login/links | admin | A 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/me | Who you are: role, scopes, tenants, Console's fingerprint | |
GET /api/v1/session | none | Never 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/ticket | A single-use ticket, valid 30 s: { ticket } | |
GET /api/v1/live?ticket= (WebSocket) | the ticket | Topics 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
| Route | Needs | Does |
|---|---|---|
GET /api/v1/daemons | Paired daemons with connection state, runners, clock skew | |
POST /api/v1/daemons/preview {link} | admin | Confirmation data: both fingerprints in groups of 4, targets. No network |
POST /api/v1/daemons {link, replace?} | {local: true, unprotected_home?} | admin | Pair: { 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_id | One daemon | |
PATCH /api/v1/daemons/:daemon_id {name?, send_actor?} | admin | Rename; send the answering person as actor |
DELETE /api/v1/daemons/:daemon_id | admin | Unpair: { left, command? } |
GET /api/v1/sessions?daemon_id&status&tenant&before&limit | Sessions across daemons, newest first | |
GET /api/v1/daemons/:daemon_id/sessions/:session_id | { session, cursor } | |
GET .../sessions/:session_id/events?after_seq&limit | Events from the cache, or from the daemon for ranges the cache lacks | |
GET .../sessions/:session_id/trajectory | The session as trajectory/v1 | |
POST /api/v1/daemons/:daemon_id/sessions | control | Start: {runner, cwd, idempotency_key, prompt?, command?, args?, name?, model?, terminal?, tenant?, resume?}. env is refused |
POST .../sessions/:session_id/{input,resize,interrupt,stop} | control | input {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
| Route | Needs | Does |
|---|---|---|
GET /api/v1/inbox?status&source_id&tenant&limit&after | A page of items you may see (next continues it), with pending counts per source and each daemon's clock skew | |
GET /api/v1/inbox/:key | One 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
| Route | Needs | Does |
|---|---|---|
GET /api/v1/sources?kind | Sources (configs only for admins); console is Console's own chain | |
POST /api/v1/sources | admin | {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_id | admin | Remove |
POST /api/v1/sources/:source_id/rotate-secret | admin | New 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&tenant | A 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/anchor | admin | The chain head (also appended to receipts.anchor_to) |
GET /api/v1/sources/:source_id/approvals?status&tenant&before&limit | A HITL store's approvals, read-only | |
GET /api/v1/runs?source_id&status&tenant&before&limit | Runs from trajectory stores | |
GET /api/v1/runs/:source_id/:trajectory_id?tenant | One 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
| Route | Needs | Does |
|---|---|---|
GET /api/v1/tokens, POST /api/v1/tokens {name, scopes, tenants?}, DELETE /api/v1/tokens/:name | admin | Named 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/:id | admin | Users 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?} | admin | End 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/identity | Console's peer id, fingerprint and key storage | |
GET /api/v1/doctor | admin | Protections 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
| Route | Auth | Does |
|---|---|---|
POST /hooks/hitl/:source_id | Standard Webhooks signature | A gate's approval.requested and approval.decided |
GET /hooks/hitl/:source_id/approvals/:approval_id | signature | The gate's status pull; Console answers Ed25519-signed on the console channel |
GET /health | none | { ok: true } |