The Terminal Session Management API exposes endpoints for inspecting, connecting to, and managing terminal sessions running inside a Hoody container. Use these endpoints to list active sessions, retrieve command history, capture screenshots of the ANSI buffer, establish WebSocket connections for real-time I/O, create new sessions (including SSH-backed and X11 display sessions), and tear sessions down explicitly when you are done with them.
All endpoints below are scoped to a specific container and are served from the container-scoped terminal subdomain.
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 the 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 a timestamp as filename.
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. This ensures 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). Example: "5"
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. Example: "5"
shell
string
No
Shell to use (bash/zsh/fish/sh). Ignored for SSH sessions. Example: "bash"
user
string
No
System user to spawn the shell as. Ignored for SSH sessions. Example: "user"
cwd
string
No
Working directory for the terminal. Ignored for SSH sessions. Example: "/home/user"
startup_script
string
No
Path to startup script to run. Example: "/path/to/init.sh"
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)
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)