The Terminal Session API provides lifecycle management for in-container shell sessions. Use these endpoints to create persistent or ephemeral terminals, list active sessions, attach a WebSocket client for real-time bidirectional I/O, capture rendered screenshots, fetch raw output buffers, and tear sessions down cleanly.
All endpoints are served from the per-container terminal host https://{projectId}-{containerId}-terminal-1.{server}.containers.hoody.com. Replace {projectId}, {containerId}, and {server} with the values from your deployment.
List all active terminal sessions. Each entry includes session metadata and a best-effort recent command history. Use history_limit to cap the number of history entries returned per session.
Create a new terminal session. Returns success if the session already exists. When a Hoody Display is configured, the request blocks until the display TCP port is accepting connections, so the caller can use the display immediately after the response returns.
Destroy a terminal session. The running process is killed, all resources are released, and connected clients are disconnected. Use this to terminate sessions without waiting for idle timeout.
Upgrade to a WebSocket connection for real-time bidirectional terminal I/O. The protocol uses an efficient binary framing scheme where the first byte indicates message type (bytes 0-4 for commands, specific bytes for data). Multiple clients can share the same terminal_id. Advanced features include session sharing, read-only mode, SSH connections, PID attachment, and X11 display support.
Terminal session ID (numeric 1-65535). Auto-generated if not provided. Multiple clients can share by using the same ID.
readonly
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
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).
cmd
query
string
No
Base64-encoded command to auto-execute on spawn.
env
query
string
No
Environment variable in KEY=VALUE format (repeatable).
Retrieve the raw terminal output buffer. Supports multiple output formats via the format query parameter. Defaults to download if format 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 timestamped filename.
Binary image data (content type image/gif for GIF, or image/png/image/jpeg depending on format). The response also includes an X-Screenshot-Path header indicating where the image was saved on disk, for example /hoody/storage/hoody-terminal/screenshots/5/2026-01-15T12-34-21Z.gif.
{
"statusCode":500,
"error":"Internal Server Error",
"message":"Screenshot tool (textimg) not installed"
}
Error Code
Title
Description
Resolution
TOOL_NOT_AVAILABLE
Screenshot tool (textimg) not installed
Install with: go install github.com/jiro4989/textimg@latest
Install with: go install github.com/jiro4989/textimg@latest