The Terminal Session Management API provides endpoints for listing, creating, inspecting, and destroying terminal sessions, connecting to them via WebSocket, retrieving command history and raw output, and capturing screenshots of the terminal buffer.
Create a new terminal session or return success if it already exists. By default, when a Hoody Display is configured, the endpoint blocks until the display TCP port (4000 + display_number) is accepting connections, ensuring the caller can immediately use the display after the response.
Terminal session ID (numeric 1-65535). Required unless ephemeral is true, in which case it is auto-generated (range 40000-65535).
ephemeral
boolean
No
Auto-generate terminal ID and enable ephemeral session mode. Ephemeral sessions auto-clean after idle timeout and strip DISPLAY environment. (default: false)
display
string
No
X11 display number (e.g., "1" or ":1"). Sets the DISPLAY env var and enables Hoody Display readiness waiting.
shell
string
No
Shell to use (bash/zsh/fish/sh). Ignored for SSH sessions.
user
string
No
System user to spawn the shell as. Ignored for SSH sessions.
cwd
string
No
Working directory for the terminal. Ignored for SSH sessions.
startup_script
string
No
Path to startup script to run
welcome
boolean
No
Show welcome message on startup (default: false)
debug
boolean
No
Enable debug output in wrapper script (default: false)
desktop
boolean
No
Enable Hoody Display desktop mode. Provides a full desktop environment instead of seamless individual windows (default: false)
desktop_env
string
No
Desktop environment to launch (implies desktop=true). Valid values: xfce, mate
cols
integer
No
Terminal columns (default: 80)
rows
integer
No
Terminal rows (default: 24)
wait_until_display
boolean
No
Whether to wait for Hoody Display readiness (default: true when display is configured)
wait_timeout
integer
No
Timeout in seconds for waiting (default: 300)
ssh_host
string
No
SSH hostname/IP. Required together with ssh_user for SSH sessions.
ssh_user
string
No
SSH username. Required together with ssh_host for SSH sessions.
Completely destroy and remove a terminal session. This kills any running process, frees all resources, and removes the session from memory. Clients will be disconnected. Use this to cleanly terminate sessions without waiting for idle timeout.
Establishes a WebSocket connection for real-time bidirectional terminal I/O. Multiple clients can share the same terminal session using the same terminal_id. The protocol uses efficient binary framing where the first byte indicates message type (0-4 for commands, specific bytes for data). Supports session sharing, read-only mode, SSH connections, PID attachment, and comprehensive terminal features.
Terminal session ID (numeric 1-65535, auto-generated if not provided) - Multiple clients can share by using same ID
readonly
query
boolean
No
Enable read-only mode for this client (blocks keyboard input) - Use 'true', '1', or no value
cwd
query
string
No
Working directory for new sessions
cwd_auto_create
query
boolean
No
Auto-create cwd when the requested working directory does not exist yet. Only applies when cwd is explicitly provided for a new local session. Enable with 'true', '1', or no value (default: false)
shell
query
string
No
Shell to use (bash, zsh, fish, tmux, ssh, etc.)
user
query
string
No
System user to spawn shell as (requires permissions)
Retrieve the raw terminal output buffer for a terminal session. Supports multiple output formats via the format query parameter. Defaults to text/download format if format parameter is not provided.
Convert the terminal’s ANSI output buffer to an image with customizable styling. Screenshots are automatically saved to /hoody/storage/hoody-terminal/screenshots/{terminal_id}/ with timestamp as filename.