The Terminal: Command Execution API lets you run shell commands inside an existing terminal session, poll for their results, abort in-flight executions, and send raw keystroke input to a session’s PTY. Use these endpoints to automate CLI workflows, drive interactive prompts, or orchestrate remote SSH commands from a backend or agent.
Terminal session ID (numeric 1-65535). Use terminal_id=0 as an explicit sentinel meaning “no terminal ID” (treated as absent, useful when a reverse proxy always injects a terminal_id). Required unless ephemeral=true, in which case it is auto-generated if not provided.
ephemeral
query
boolean
No
When true, auto-generates a unique terminal_id (if not provided), skips display/dbus initialization, and applies aggressive cleanup. Designed for programmatic CLI command execution like child_process.exec. Default: false. WARNING: Do NOT use ephemeral=true for GUI applications that require a display. Ephemeral sessions strip the DISPLAY environment variable, which means X11/GUI applications will not work. Use a regular terminal session with an explicit terminal_id and display parameter instead for GUI workloads.
defer_pid
query
integer
No
Defer command injection until this PID exits (TUI-safe). If set, the API returns immediately regardless of wait=true.
defer_start_time_ticks
query
string
No
Optional /proc/<pid>/stat field 22 (starttime in clock ticks since boot) to avoid PID reuse bugs. If it mismatches, command executes immediately.
defer_timeout_ms
query
integer
No
Max time to wait for defer_pid exit before failing. Default: 60000.
defer_poll_ms
query
integer
No
Poll interval while waiting for defer_pid exit. Default: 50, minimum: 10.
reset
query
boolean
No
Reset existing session and reconfigure (kills current process, clears state, allows switching from bash to SSH or changing any parameter). Use 'true', '1', or no value.
cwd
query
string
No
Working directory for local bash sessions (ignored for SSH).
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 or reset local session. Enable with 'true', '1', or no value. Default: false.
shell
query
string
No
Shell to use for local sessions: bash (case-insensitive), zsh, fish, sh, etc. Default: server startup command, only applies to new sessions or after reset.
user
query
string
No
System user to spawn shell as (requires su permissions, only applies to new sessions or after reset).
cmd
query
string
No
Base64-encoded command to execute automatically (works with both new and active shells, executes every time URL is visited).
env
query
string
No
Environment variable in KEY=VALUE format (can be repeated for multiple variables, e.g., ?env=DEBUG=1&env=API_KEY=abc).
skip_display_wait
query
boolean
No
Skip waiting for Hoody Display readiness before executing command. By default, if a DISPLAY is configured, the endpoint blocks until the display server on port 4000+display_num is ready. Default: false.
display_wait_timeout
query
integer
No
Timeout in seconds for display readiness wait. Default: 10, capped at 10 seconds to prevent event-loop pin; values ≤0 or malformed also map to the 10-second cap. Ignored if skip_display_wait=true.
display
query
string
No
DISPLAY environment variable for X11 applications (auto-formats :display if number provided, e.g., ?display=1 becomes DISPLAY=:1).
ssh_host
query
string
No
SSH server hostname or IP address (creates SSH session if provided with ssh_user).
ssh_user
query
string
No
SSH username (required if ssh_host is provided).
ssh_port
query
string
No
SSH port number. Default: 22.
ssh_password
query
string
No
SSH password for authentication (use with caution, prefer key-based auth).
socks5_host
query
string
No
SOCKS5 proxy hostname for SSH connection.
socks5_port
query
string
No
SOCKS5 proxy port. Default: 1080.
socks5_user
query
string
No
SOCKS5 proxy username for authentication.
ssh_key
query
string
No
Base64-encoded SSH private key for key-based authentication (prefer over password-based auth).
Cancel a command that was started via the execute endpoint. Graceful mode (default) sends SIGINT via the PTY (equivalent to Ctrl+C). Force mode sends SIGKILL to the process group. Partial output captured before abort is preserved in the response.
Send keyboard input to a terminal session’s PTY. The input is written directly to the PTY master fd, exactly as if typed on a physical keyboard. By default, Enter (newline) is automatically appended after the input. Set enter=false for raw input without Enter. Supports interactive prompts (y/n), sudo passwords, and any other stdin input. Use empty input "" to just press Enter.