Skip to main content
The Process API provides endpoints for executing commands, managing pseudo-terminal (PTY) sessions, shell sessions, and interpreter contexts within Daytona sandboxes.

Command Execution

Execute Command

Execute a shell command synchronously and return the output.
Request Body:
Parameters: Response:

PTY Sessions

Pseudo-terminal (PTY) sessions provide interactive terminal access with WebSocket support.

Create PTY Session

Create a new PTY session for interactive terminal access.
Request Body:
Response:

List PTY Sessions

Get all active PTY sessions.
Response:

Get PTY Session

Get information about a specific PTY session.

Connect to PTY Session

Establish a WebSocket connection for interactive terminal access.

Resize PTY Session

Change the terminal dimensions.
Request Body:
Parameters:
  • rows: Terminal height (1-1000)
  • cols: Terminal width (1-1000)

Delete PTY Session

Terminate and delete a PTY session.

Shell Sessions

Shell sessions allow executing multiple commands within the same session context.

Create Session

Create a new shell session.
Request Body:

List Sessions

Get all active shell sessions.
Response:

Get Session

Get details of a specific session.

Execute in Session

Execute a command within an existing session.
Request Body:
Response:

Get Session Command

Get details of a specific command in a session.

Get Command Logs

Get logs for a specific command. Supports WebSocket streaming.
Query Parameters:
  • follow: Stream logs in real-time via WebSocket (boolean)

Send Input to Command

Send input to a running interactive command.
Request Body:

Delete Session

Delete a shell session.

Interpreter Contexts

Manage isolated code interpreter contexts for executing code.

Create Interpreter Context

Create a new isolated interpreter context.
Request Body:
Response:

List Interpreter Contexts

Get all user-created interpreter contexts.

Execute Code

Execute code in an interpreter context via WebSocket.

Delete Interpreter Context

Delete an interpreter context.

Best Practices

Use PTY sessions for interactive terminal access and shell sessions for programmatic command execution with session state.
  • Set appropriate timeouts for long-running commands
  • Clean up sessions when no longer needed
  • Use WebSocket connections for real-time output streaming
  • Handle exit codes to detect command failures
  • Specify working directory to ensure commands run in correct context

Example Usage

Prefer using the official Daytona SDKs over direct API calls for better type safety and error handling.