Skip to content
Hoody.com

the Terminal Command Execution API to run shell commands inside a container’s terminal session, retrieve their output, stream interactive input, and cancel in-flight commands. The execute endpoint is fire-and-forget by default: it returns a command_id that you poll with the result endpoint. Use ephemeral sessions for short-lived programmatic invocations, or persistent terminal sessions when you need an interactive shell.

The terminal:Terminal Execution service runs commands and reports their output.

Retrieve the current or final results of a command execution. Can be called while the command is running or after completion.

NameInTypeRequiredDescription
command_idpathstringYesCommand ID returned from /api/v1/terminal/execute (numeric 1-65535)
{
"command_id": 1,
"status": "completed",
"output": "total 12\ndrwxr-xr-x 3 user user 4096 Jan 15 10:30 .\ndrwxr-xr-x 5 user user 4096 Jan 15 09:15 ..\n-rw-r--r-- 1 user user 220 Jan 15 09:15 .bash_logout\n-rw-r--r-- 1 user user 3771 Jan 15 09:15 .bashrc\ndrwxr-xr-x 3 user user 4096 Jan 15 09:15 .local",
"exit_code": 0
}
Terminal window
curl -X GET "https://proj-myproj-cnt-mycontainer-terminal-1.eu-west-1.containers.hoody.icu/api/v1/terminal/result/1"

Execute a command in the specified terminal session. Supports both local bash and remote SSH sessions. The terminal type is determined by URL parameters on first use. By default, if a DISPLAY is configured on the session, the endpoint waits for the Hoody Display to be ready before executing the command. This can be disabled with skip_display_wait=true. Use ephemeral=true for a guaranteed-unique isolated PTY session with no display/dbus and automatic cleanup, which is ideal for programmatic command execution (like child_process.exec). Returns immediately with a command_id that can be used to poll for results.

NameInTypeRequiredDescription
terminal_idquerystringNoTerminal 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
ephemeralquerybooleanNoWhen 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)
defer_pidqueryintegerNoDefer command injection until this PID exits (TUI-safe). If set, the API returns immediately regardless of wait=true
defer_start_time_ticksquerystringNoOptional /proc/<pid>/stat field 22 (starttime in clock ticks since boot) to avoid PID reuse bugs. If it mismatches, command executes immediately
defer_timeout_msqueryintegerNoMax time to wait for defer_pid exit before failing (default: 60000)
defer_poll_msqueryintegerNoPoll interval while waiting for defer_pid exit (default: 50, minimum: 10)
resetquerybooleanNoReset 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
cwdquerystringNoWorking directory for local bash sessions (ignored for SSH)
cwd_auto_createquerybooleanNoAuto-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)
shellquerystringNoShell to use for local sessions: bash (case-insensitive), zsh, fish, sh, etc. (default: server startup command, only applies to new sessions or after reset)
userquerystringNoSystem user to spawn shell as (requires su permissions, only applies to new sessions or after reset)
cmdquerystringNoBase64-encoded command to execute automatically (works with both new and active shells, executes every time URL is visited)
envquerystringNoEnvironment variable in KEY=VALUE format (can be repeated for multiple variables, e.g., ?env=DEBUG=1&env=API_KEY=abc)
skip_display_waitquerybooleanNoSkip 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_timeoutqueryintegerNoTimeout 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
displayquerystringNoDISPLAY environment variable for X11 applications (auto-formats :display if number provided, e.g., ?display=1 becomes DISPLAY=:1)
ssh_hostquerystringNoSSH server hostname or IP address (creates SSH session if provided with ssh_user)
ssh_userquerystringNoSSH username (required if ssh_host is provided)
ssh_portquerystringNoSSH port number (default: 22)
ssh_passwordquerystringNoSSH password for authentication (use with caution, prefer key-based auth)
socks5_hostquerystringNoSOCKS5 proxy hostname for SSH connection
socks5_portquerystringNoSOCKS5 proxy port (default: 1080)
socks5_userquerystringNoSOCKS5 proxy username for authentication
ssh_keyquerystringNoBase64-encoded SSH private key for key-based authentication (prefer over password-based auth)
socks5_passquerystringNoSOCKS5 proxy password for authentication
NameTypeRequiredDescription
commandstringYesThe command to execute
idstringNoCustom command ID (numeric 1-65535, auto-generated if not provided)
timeoutintegerNoTimeout in seconds (0 = no timeout, default: 0)
waitbooleanNoWhether to wait for completion (default: true; forced false when defer_pid is set)
cwdstringNoWorking directory for command execution (for local bash only)
envobjectNoEnvironment variables as key-value pairs
{
"command": "ls -la",
"timeout": 30,
"wait": true
}
{
"command_id": 1,
"status": "started"
}
Terminal window
curl -X POST "https://proj-myproj-cnt-mycontainer-terminal-1.eu-west-1.containers.hoody.icu/api/v1/terminal/execute?terminal_id=1&shell=bash" \
-H "Content-Type: application/json" \
-d '{
"command": "ls -la",
"timeout": 30,
"wait": true
}'

The terminal:Terminal service aborts running commands and streams interactive input to the PTY.

POST /api/v1/terminal/execute/{command_id}/abort

Section titled “POST /api/v1/terminal/execute/{command_id}/abort”

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. Idempotent: aborting an already-completed command returns 409 with the existing result.

NameInTypeRequiredDescription
command_idpathstringYesThe command ID returned by the execute endpoint
NameTypeRequiredDescription
forcebooleanNoSend SIGKILL to process group instead of SIGINT (default: false)
{
"force": false
}
{
"command_id": 1,
"status": "aborted",
"partial_output": "Listing files...\n"
}
Terminal window
curl -X POST "https://proj-myproj-cnt-mycontainer-terminal-1.eu-west-1.containers.hoody.icu/api/v1/terminal/execute/1/abort" \
-H "Content-Type: application/json" \
-d '{
"force": false
}'

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.

NameInTypeRequiredDescription
terminal_idquerystringYesTerminal session ID to write to
NameTypeRequiredDescription
inputstringYesThe text to type into the terminal
enterbooleanNoAuto-append Enter (newline) after input. Default: true. Set to false for raw keystroke input
{
"input": "y",
"enter": true
}
{
"status": "ok",
"bytes_written": 2
}
Terminal window
curl -X POST "https://proj-myproj-cnt-mycontainer-terminal-1.eu-west-1.containers.hoody.icu/api/v1/terminal/write?terminal_id=1" \
-H "Content-Type: application/json" \
-d '{
"input": "y",
"enter": true
}'