{ "title": "HTTP API", "intro.1": "The admin’s API, the same one its web client uses. JSON in and out. A refusal answers {code, error}: a stable code to act on, and what went wrong, in English.", "authentication.title": "Authentication", "authentication.1": "Log in with POST /api/login: it sets the __Host-display cookie and returns a CSRF token.", "authentication.2": "Every request that changes something needs the exact Origin (ADMIN_ORIGIN), and once logged in the X-CSRF-Token header too (setting the password and logging in come before a login).", "authentication.3": "A login ends after 30 minutes idle or 12 hours in all.", "authentication.4": "After 5 wrong passwords in a row, the next attempt waits 2 seconds, and each further wrong one doubles the wait, up to 256 seconds (429 until then). Wrong codes and refused passkeys count the same, and only a completed login resets the count.", "authentication.5": "With the second step on, the password returns a pending step instead of a login: answer it with POST /api/login/code within 2 minutes. A step that is used, expired, or refused five codes answers 401 with code: \"login-again\": log in with the password again.", "authentication.6": "A wrong current password on a /api/security/ route answers 403 with code: \"wrong-password\"; the login stays. Every change there ends every other login.", "authentication.7": "Agents holding a token use their own routes under /api/agent/ and the MCP endpoint at /mcp instead: see Agents.", "routes.title": "Routes", "routes.1": "Route", "routes.2": "What it does", "routes.3": "Needs", "encoding-settings.title": "Encoding settings", "encoding-settings.1": "Field", "encoding-settings.2": "Values", "encoding-settings.3": "codec", "encoding-settings.4": "auto, av1, h264 (only in builds with H.264), tiles_only", "encoding-settings.5": "bitrate_kbps", "encoding-settings.6": "100–50000, default 2500", "encoding-settings.7": "max_fps", "encoding-settings.8": "1 to ADMIN_MAX_FPS; a session starts with its start’s max_fps", "encoding-settings.9": "A session’s start takes idle_fps (5 by default) and max_fps (30 by default, or ADMIN_MAX_FPS if that is lower), each from 5 to ADMIN_MAX_FPS, idle_fps no more than max_fps. Its screen refreshes at idle_fps while nobody watches, and Chrome draws no faster. While someone watches, it refreshes at what they take, which is max_fps until the settings change it, and at no less than 30 while a recording is made, where ADMIN_MAX_FPS allows; never below idle_fps nor above ADMIN_MAX_FPS.", "encoding-settings.10": "An installation may hold idle_fps lower with ADMIN_MAX_IDLE_FPS: a start that asks for more is refused. A session started with cdp takes the installation’s maximums for both where its start names none: what attaches there (Playwright, say) waits on the page’s frames before a click and the like, so it works at the pace it always had.", "route.get-api-status": "Whether a password is set, and whether a passkey is added (the login offers it); the demo’s sites and length in demo mode.", "route.post-api-enroll": "{password}: sets the first password while none is set (403 once one is, and in the demo), and logs in as /api/login does: sets the cookie, returns {csrf}.", "route.post-api-login": "{password}; in the demo {demo?, wait?, locale?}: the demo to start at, and wait (a start the page makes on its own) to wait for this client’s visit open elsewhere rather than close it; and locale, one of the page’s languages such as pt-BR (any other is refused), which the visit’s browser and the demo’s pages then speak, English after it. A login still live gets its visit back when that visit’s browser speaks the same locale; otherwise that visit is closed and one in this locale starts. Sets the cookie, returns {csrf} (and the demo visit). With the second step on, sets no cookie and returns {second_step: {step, app, passkey}}: a pending step for /api/login/code, and what may answer it.", "route.post-api-login-code": "{step, code}: answers the pending step with a code from the authenticator app or a recovery code. Sets the cookie, returns {csrf}.", "route.post-api-login-passkey": "Begins a passkey sign-in: returns {ceremony, options}, the options for navigator.credentials.get.", "route.post-api-login-passkey-finish": "{ceremony, credential}: the credential as JSON, binary fields in base64url. Sets the cookie, returns {csrf}.", "route.post-api-demo-switch": "{demo, viewer}: in the public demo, moves the visitor’s turn to another demo; that viewer must hold control.", "route.post-api-logout": "Ends the login and its streams.", "route.get-api-me": "The login’s CSRF token (and the demo visit), and fps: what a session’s rates may be (min, max, idle_max) and what they are when its start names none (idle and watch; cdp: {idle, watch} for a session with CDP).", "route.get-api-egresses": "The egresses: {max, egresses: [{id, name, scheme, host, port, has_user, has_password, timezone, languages, country, country_name, in_use}]}; never a credential.", "route.get-api-egresses-options": "The time zones and languages offered first: {timezones, languages: [{tag, name}]}.", "route.post-api-egresses": "{name, proxy, timezone?, languages?}: checks the proxy and saves it only if the check passed, with the country it found and, unless given, that country’s time zone and languages; 422 {code, error, detail} otherwise.", "route.patch-api-egresses-id": "{name?, proxy?, timezone?, languages?}: a new proxy is checked first and replaces the old one, credentials included, only if it passed.", "route.delete-api-egresses-id": "Deletes it, unless a session uses it (409, naming the sessions).", "route.post-api-egresses-check": "{proxy}: checks a proxy without saving it: {ok: true, latency_ms, exit: {ip, country, country_name}, suggested: {timezone, languages}} or {ok: false, code, error, detail}.", "route.post-api-egresses-id-check": "Checks a saved egress, the same way.", "route.get-api-sessions": "The running sessions, each with its features, its rates (idle_fps, and max_fps in its settings) and its agent’s open request for a person (help: {reason, message, since}).", "route.post-api-sessions": "{url, devtools?, cdp?, egress?, features?, profile?, width?, height?, agent?, idle_fps?, max_fps?}: starts a session, through an egress by its id (refused with 424 {code, error, detail} when its check fails); with profile, resumes the persistent session of that id, at the pages it had open instead of url (see Custom clients); with width and height (even, 320x240 to 1920x1080, and not a size SVT-AV1 crashes on: one side 2–8 pixels past a multiple of 64, the other 10–16; refused with 400 otherwise), its screen is that size instead of ADMIN_OUTPUT; with agent true, whoever opens it watches until they take control. With cdp true, its Chrome’s DevTools on the server’s loopback, for Playwright, Puppeteer and Selenium (DevTools mode with it): the session’s cdp_port names the port; refused for an agent’s token and in the demo. url is an http(s) address, or about:blank for an empty page.", "route.delete-api-sessions-id": "Stops a session.", "route.post-api-sessions-id-control": "{viewer, if_free?}: takes control for that viewer.", "route.post-api-sessions-id-release": "{viewer}: gives control back to the agent.", "route.put-api-sessions-id-settings": "{codec, bitrate_kbps, max_fps}: the stream’s encoding.", "route.put-api-sessions-id-network": "{latency_ms, loss_percent, bandwidth_kbps}: a simulated network, for testing.", "route.post-api-sessions-id-agent": "{tool, arguments}: one agent tool call.", "route.get-api-sessions-id-stats": "The session, its containers’ usage and its viewers.", "route.get-api-sessions-id-timeline": "What happened in a session, running or stopped and kept: {events, next, first, started, stopped?}; ?after=N gives only the events after number N (see Sessions).", "route.get-api-sessions-id-replay": "A session’s replay, running or stopped and kept: {started, segments: [{n, start, end, size, starts, whole}], stopped, recording}, times in milliseconds from started.", "route.get-api-sessions-id-replay-n": "One segment of it, opened: its records, each a big-endian u32 time, a kind (0 a display message as a viewer gets it, 1 the agent’s pointer, 2 a gap), a u32 length and its bytes.", "route.get-api-runs": "The stopped sessions kept, how many only the password opens, and, of the sessions that ran when the server restarted, how many wait to start again and the starts that failed: {runs: [{id, label, started, stopped}], locked, resumes: {waiting, failed: [{was, label, code, error, again}]}}.", "route.delete-api-runs-id": "Forgets a stopped session’s timeline and replay now.", "route.get-api-sessions-id-files-ticket": "A download, by its single-use ticket.", "route.get-api-agent-files": "What agents may do with files: {downloads, transfers} (see Agents).", "route.put-api-agent-files": "{downloads, transfers}: each ask, allow or deny.", "route.get-api-sessions-id-asks": "What the session’s agent waits for you to allow: {asks: [{id, kind, name, size}]}, kind download or transfer.", "route.post-api-sessions-id-asks-ask": "{allow}: answers one.", "route.delete-api-sessions-id-help": "Closes the agent’s open request for a person (409 when none is open).", "route.get-api-notifications": "The webhook: {url}, null when none is set.", "route.put-api-notifications": "{url}: sets the webhook (an https:// address) with a new signing secret, shown in this answer only: {url, secret}.", "route.delete-api-notifications": "Removes the webhook.", "route.post-api-notifications-test": "Posts a test event to the webhook and says how it answered: {ok, status}, or 502 with webhook-failed.", "route.get-ws-sessions-id-viewer": "The viewer stream (WebSocket, binary protocol).", "route.get-api-chat-accounts": "{accounts: [{id, name, product, sessions}]}: the chat accounts and the sessions each is open in.", "route.post-api-chat-accounts": "{name, product}: adds an account; product is claude or codex.", "route.delete-api-chat-accounts-id": "Removes an account with its home: its program and login (409 while a chat uses it). What it did in sessions stays with them.", "route.post-api-sessions-id-chat": "{account}: opens a chat beside the session (409 when it has one).", "route.delete-api-sessions-id-chat": "Ends the session’s chat; the account’s home stays.", "route.get-api-sessions-id-chat-folder": "{bytes}: what the session’s folder and its chats’ conversations take on disk, counted while its chat runs (404 without one); null when the count took too long.", "route.get-ws-sessions-id-chat": "The chat’s terminal (WebSocket): its bytes both ways, and {cols, rows} as text to size it. It closes with 4000 when its program ended and 4001 when a later terminal replaced it.", "route.get-ws-updates": "Says changed, as text, when a list the page shows may have changed (WebSocket).", "route.get-api-tokens": "The agent tokens: id, name, created, last used; never the token.", "route.post-api-tokens": "{name}: creates an agent token and returns it, this once.", "route.delete-api-tokens-id": "Revokes a token and stops every session it started.", "route.get-api-profiles": "The persistent sessions, each a profile here: {unlocked, max, profiles: [{id, name, allowed, created, used, size, session, unsaved}]}, where allowed holds the token ids (and local) that may resume it, and session its run now, or null. The field leftovers counts files the last start could not remove.", "route.post-api-profiles": "{name}: makes a persistent session that has not run yet; refused (423) while they are locked.", "route.put-api-profiles-id": "{name?, allowed?}: renames it, or sets the tokens (and local) that may resume it.", "route.delete-api-profiles-id": "Deletes it and what it kept, unless it is running. Answers ok only when nothing of it is left: a failure says saved-residue, the entry stays with removing: true, and deleting again goes on.", "route.post-api-profiles-unlock": "{password}: unlocks the persistent sessions after a sign-in that checked no password (a passkey’s).", "route.get-api-security": "The second step: {app, recovery_codes, passkeys: [{id, created}], passkeys_possible}, where recovery_codes is how many are left.", "route.post-api-security-app": "Draws a new secret for an authenticator app: returns {secret, uri}; nothing changes until it is confirmed.", "route.post-api-security-app-confirm": "{code, password?}: turns the app on with a code from it; replacing one that is on needs the password. Returns {recovery_codes}, the codes when the second step was off until now, else null.", "route.post-api-security-app-remove": "{password}: turns the app off.", "route.post-api-security-passkeys": "{password}: begins adding a passkey: returns {options}, for navigator.credentials.create.", "route.post-api-security-passkeys-finish": "{credential}: adds it. Returns {recovery_codes}, as the app’s confirmation does.", "route.post-api-security-passkeys-id-remove": "{password}: removes that passkey.", "route.post-api-security-recovery": "{password}: new recovery codes in place of those left; returns {recovery_codes}.", "needs.none": "none", "needs.origin": "Origin", "needs.origin-login": "Origin + login", "needs.login": "login", "needs.login-csrf": "login + CSRF", "route.get-api-replay-quality": "How sharp a replay recorded from now on is and how much of the disk they may take: {scale, quality, disk_percent, used, disk}, the picture’s size in percent of the screen’s, low, medium or high, the share of the whole disk in percent, and what they take now and the disk’s size in bytes.", "route.put-api-replay-quality": "{scale, quality, disk_percent}: scale 50, 75 or 100, quality low, medium or high, disk_percent 1 to 90. Answers as the GET does; a new size or quality applies at once, a lower share within a minute." }