Skip to main content
The Computer Use API provides comprehensive desktop automation capabilities, enabling programmatic control of mouse, keyboard, screenshots, and screen recording within sandbox environments.

Overview

Daytona’s Computer Use functionality enables:
  • Mouse control - Move, click, drag, and scroll
  • Keyboard control - Type text and press keys
  • Screenshots - Capture full screen or regions
  • Display management - Query display information and windows
  • Screen recording - Record and download desktop sessions

Getting Started

Start Computer Use

Initialize the desktop environment:
This starts all required processes (Xvfb, xfce4, x11vnc, novnc).

Check Status

Stop Computer Use

Mouse Operations

Get Mouse Position

Move Mouse

number
required
X coordinate to move to
number
required
Y coordinate to move to

Click Mouse

number
required
X coordinate to click at
number
required
Y coordinate to click at
string
Mouse button: ‘left’ (default), ‘right’, or ‘middle’
boolean
Whether to perform a double-click. Default is false.

Drag Mouse

number
required
Starting X coordinate
number
required
Starting Y coordinate
number
required
Ending X coordinate
number
required
Ending Y coordinate
string
Mouse button to use for dragging. Default is ‘left’.

Scroll Mouse

number
required
X coordinate to scroll at
number
required
Y coordinate to scroll at
'up' | 'down'
required
Scroll direction
number
Amount to scroll. Default is 1.

Keyboard Operations

Type Text

string
required
Text to type
number
Delay between characters in milliseconds. Default is 0.

Press Keys

string
required
Key to press (e.g., ‘Return’, ‘Escape’, ‘Tab’, ‘a’, ‘A’)
string[]
Modifier keys: ‘ctrl’, ‘alt’, ‘meta’, ‘shift’. Default is empty array.

Press Hotkeys

string
required
Hotkey combination (e.g., ‘ctrl+c’, ‘alt+tab’, ‘cmd+shift+t’)

Screenshots

Full Screen Screenshot

boolean
Whether to show cursor in screenshot. Default is false.

Region Screenshot

Capture a specific screen region:
ScreenshotRegion
required
Region to capture

Compressed Screenshots

Take compressed screenshots for smaller file sizes:
ScreenshotOptions
Compression and display options

Display Information

Get Display Info

List Open Windows

Screen Recording

Start Recording

string
Optional custom label for the recording

Stop Recording

List Recordings

Get Recording Details

Download Recording

string
required
ID of the recording to download
string
required
Local path to save the recording file

Delete Recording

Process Management

Get Process Status

Restart Process

Get Process Logs

Complete Example

Best Practices

After starting computer use, wait a few seconds for the desktop to fully initialize:
Add small delays between UI interactions to allow applications to respond:
For screenshots that will be transmitted or stored, use compression:
Delete recordings when no longer needed to save storage:

Process Execution

Execute commands in the desktop environment

PTY Sessions

Interactive terminal sessions