Skip to content
Hoody.com

Drive TUI applications programmatically: snapshot the rendered screen, search it with regex, press named keys, paste text with bracketed-paste semantics, inject cell-based mouse events, and block on conditions. These endpoints drive a server-side VT parser (libvterm) that mirrors the in-browser xterm.js state, so the view of the screen returned to your automation is the same view a human would see.

Use these endpoints when you need to script terminal applications end to end: testing CLI tools, capturing benchmark output, or building agent-style workflows that observe and act on interactive prompts. Combine wait with snapshot, find, press, paste, and mouse to compose any automation flow without polling or races.

Return a rendered snapshot of the terminal screen as seen by a user. The snapshot includes the visible text grid, cursor position, window title, fullscreen (alt-screen) state, reverse-video highlight spans, and a monotonic sequence counter. On the first call for a session, the VT parser is lazily initialized by replaying the session’s output buffer.

NameInTypeRequiredDescription
terminal_idquerystringYesTerminal session ID (numeric 1-65535). On calls routed through a terminal-N containers-proxy hostname, the proxy sets this from the hostname label and overwrites any value you send. Supply it directly only when calling the terminal service without the proxy.
include_colorsquerybooleanNoInclude ANSI SGR colored_lines array alongside plain text lines. Default: false
include_highlightsquerybooleanNoInclude reverse-video highlight spans. Default: true
scroll_offsetqueryintegerNoLines into scrollback (0 = live viewport). Default: 0

This endpoint takes no request body.

Terminal window
curl -sS -G \
--url "https://{projectId}-{containerId}-terminal-1.{server}.containers.hoody.com/api/v1/terminal/snapshot" \
--data-urlencode "terminal_id=1" \
--data-urlencode "include_colors=true" \
--header "Authorization: Bearer $HOODY_TOKEN"

Search the rendered terminal screen (or scrollback) for a PCRE2 regular expression pattern. Returns cell-coordinate hits with matched text. Supports case-insensitive matching, result limits, and scope selection. Pattern length is capped at 1024 bytes and match limits are enforced to prevent ReDoS.

NameInTypeRequiredDescription
terminal_idquerystringYesTerminal session ID. On calls routed through a terminal-N containers-proxy hostname, the proxy sets this from the hostname label and overwrites any value you send. Supply it directly only when calling the terminal service without the proxy.
patternquerystringYesPCRE2 regex pattern to search for (max 1024 bytes).
scopequerystringNoSearch scope: screen, scrollback, or all. Default: screen.
limitqueryintegerNoMaximum number of hits to return. Default: 100, max: 1000.
case_insensitivequerybooleanNoCase-insensitive matching. Default: false.
scroll_offsetqueryintegerNoScrollback offset for screen scope (0 = live viewport). Default: 0.

This endpoint takes no request body.

Terminal window
curl -sS -G \
--url "https://{projectId}-{containerId}-terminal-1.{server}.containers.hoody.com/api/v1/terminal/find" \
--data-urlencode "terminal_id=1" \
--data-urlencode 'pattern=\b\d+ passed in [\d.]+s\b' \
--data-urlencode "case_insensitive=false" \
--header "Authorization: Bearer $HOODY_TOKEN"

Return the full list of key names accepted by POST /api/v1/terminal/press, including aliases and canonical forms. Useful for client-side validation and discoverability. Single printable characters (a-z, 0-9, punctuation) are also accepted but not listed individually.

This endpoint takes no parameters.

This endpoint takes no request body.

Terminal window
curl -sS -G \
--url "https://{projectId}-{containerId}-terminal-1.{server}.containers.hoody.com/api/v1/terminal/keys" \
--header "Authorization: Bearer $HOODY_TOKEN"

Return global metrics for the server-side VT parser: active vterm session count, memory used and cap in MB, total active wait-waiters across all sessions, and configured limits. Use this to monitor resource usage, tune --vterm-memory-cap-mb, and detect leaks.

This endpoint takes no parameters.

This endpoint takes no request body.

Terminal window
curl -sS -G \
--url "https://{projectId}-{containerId}-terminal-1.{server}.containers.hoody.com/api/v1/terminal/automation/metrics" \
--header "Authorization: Bearer $HOODY_TOKEN"

GET /api/v1/terminal/{terminal_id}/automation

Section titled “GET /api/v1/terminal/{terminal_id}/automation”

Return the VT parser state for a specific session: whether vterm is active, dimensions, update sequence counter, time since last screen change, alt-screen flag, title, scrollback length, and active waiter count. Useful for debugging automation workflows such as investigating why a wait timed out or whether the screen actually changed.

NameInTypeRequiredDescription
terminal_idpathstringYesTerminal session ID. The containers proxy cannot fill this path segment, so supply it explicitly even on hostname-routed calls.

This endpoint takes no request body.

Terminal window
curl -sS -G \
--url "https://{projectId}-{containerId}-terminal-1.{server}.containers.hoody.com/api/v1/terminal/1/automation" \
--header "Authorization: Bearer $HOODY_TOKEN"

Send one or more named key presses to a terminal session. Keys are encoded through libvterm’s keyboard API which respects the terminal’s current application-cursor mode (DECCKM) and keypad mode (DECKPAM), ensuring correct byte sequences for programs like vim, htop, and tmux. Supports letters, ctrl+letter, arrow keys, function keys, enter, tab, escape, backspace, and more. All keys are validated before any are sent, so a single unknown key rejects the entire request with no partial writes.

NameInTypeRequiredDescription
terminal_idquerystringYesTerminal session ID. On calls routed through a terminal-N containers-proxy hostname, the proxy sets this from the hostname label and overwrites any value you send. Supply it directly only when calling the terminal service without the proxy.

Exactly one of key (a single key name) or keys (an array of up to 256 key names) must be provided.

NameTypeRequiredDescription
keystringNoSingle key name for one-shot press, e.g. enter. Mutually exclusive with keys.
keysarray of stringsNoArray of key names to press in sequence, e.g. ["ctrl+c", "arrow_up", "enter"]. Mutually exclusive with key. Maximum 256 entries per request.
Terminal window
curl -sS -X POST \
--url "https://{projectId}-{containerId}-terminal-1.{server}.containers.hoody.com/api/v1/terminal/press?terminal_id=1" \
--header "Authorization: Bearer $HOODY_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"keys": ["ctrl+c", "arrow_up", "enter"]
}'

Paste text into a terminal session with optional bracketed paste mode. When bracketed=true (default), the text is wrapped in bracketed paste escape sequences if the running program has enabled DECSET 2004 (e.g., vim, zsh). This prevents auto-indent mangling and other paste artifacts. When bracketed=false, the text is sent as raw keystrokes. UTF-8 text including emoji and CJK is fully supported.

NameInTypeRequiredDescription
terminal_idquerystringYesTerminal session ID. On calls routed through a terminal-N containers-proxy hostname, the proxy sets this from the hostname label and overwrites any value you send. Supply it directly only when calling the terminal service without the proxy.
NameTypeRequiredDescription
textstringYesText to paste (UTF-8).
bracketedbooleanNoUse bracketed paste mode if the program supports it. Default: true
Terminal window
curl -sS -X POST \
--url "https://{projectId}-{containerId}-terminal-1.{server}.containers.hoody.com/api/v1/terminal/paste?terminal_id=1" \
--header "Authorization: Bearer $HOODY_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"text": "git status\n",
"bracketed": true
}'

Send deterministic mouse events to a terminal session using libvterm’s mouse API. Coordinates are zero-based terminal cells, not pixels. Mouse protocol output is emitted only when the target program has enabled terminal mouse reporting. Events are validated before any are sent, matching the all-or-nothing contract of /press.

NameInTypeRequiredDescription
terminal_idquerystringYesTerminal session ID. On calls routed through a terminal-N containers-proxy hostname, the proxy sets this from the hostname label and overwrites any value you send. Supply it directly only when calling the terminal service without the proxy.

The body is a oneOf: exactly one of event (a single TerminalMouseEvent) or events (an array of 1 to 256 TerminalMouseEvent objects) must be provided.

NameTypeRequiredDescription
eventobjectNoA single TerminalMouseEvent. Mutually exclusive with events.
eventsarray of objectsNoAn array of 1 to 256 TerminalMouseEvent objects. Mutually exclusive with event.
NameTypeRequiredDescription
event.typestringYesMouse event kind: move, down, up, click, or scroll. click expands to down/up; scroll uses wheel buttons.
event.rowintegerYesZero-based terminal row cell (min 0).
event.colintegerYesZero-based terminal column cell (min 0).
event.buttonintegerNoMouse button (1 to 5). Non-scroll events accept 1 to 3; scroll accepts 4 to 5.
event.amountintegerNoScroll repeat count (1 to 20) for scroll events.
event.directionstringNoScroll direction: up or down. Overrides the scroll button.
event.modifiersarray of stringsNoKeyboard modifiers: shift, alt, meta, ctrl, or control. Maximum 8 entries.
Terminal window
curl -sS -X POST \
--url "https://{projectId}-{containerId}-terminal-1.{server}.containers.hoody.com/api/v1/terminal/mouse?terminal_id=1" \
--header "Authorization: Bearer $HOODY_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"event": {
"type": "click",
"row": 12,
"col": 4,
"button": 1,
"modifiers": ["ctrl"]
}
}'

Block until a terminal condition is met, then return an atomic snapshot of the screen at the moment of resolution. Supports three modes: stable (no screen updates for debounce_ms), regex (PCRE2 pattern matches on screen), or either (first condition wins). The response includes a full snapshot for the matched, stable, timeout, exited, and search_error statuses so clients avoid a TOCTOU race between wait and a follow-up snapshot call. The vterm_reinit status is the lone exception: it fires when the VT parser was torn down mid-wait and no coherent snapshot can be captured (the client should retry). Maximum 16 concurrent waiters per session.

NameInTypeRequiredDescription
terminal_idquerystringYesTerminal session ID. On calls routed through a terminal-N containers-proxy hostname, the proxy sets this from the hostname label and overwrites any value you send. Supply it directly only when calling the terminal service without the proxy.
NameTypeRequiredDescription
modestringNoWait mode: stable, regex, or either. Default: stable.
debounce_msintegerNoStable mode debounce in milliseconds (10 to 60000). Default: 100.
patternstringNoPCRE2 regex pattern (required for regex/either modes, max 1024 bytes).
timeout_msintegerNoHard deadline in milliseconds (10 to 300000). Default: 5000.
search_scopestringNoWhere to search: screen, scrollback, or all. Default: screen.
include_colorsbooleanNoInclude colored_lines in response snapshot. Default: false.
include_highlightsbooleanNoInclude highlights in response snapshot. Default: true.
Terminal window
curl -sS -X POST \
--url "https://{projectId}-{containerId}-terminal-1.{server}.containers.hoody.com/api/v1/terminal/wait?terminal_id=1" \
--header "Authorization: Bearer $HOODY_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"mode": "regex",
"pattern": "\\b\\d+ passed in [\\d.]+s\\b",
"timeout_ms": 30000,
"search_scope": "screen"
}'