Request Body
command
field accepts any valid shell command that can be executed within the VM environment.
Use Cases
- Code Execution: Run Python scripts, Node.js applications, shell scripts
- Package Installation: Install dependencies with npm, pip, apt, etc.
- File Manipulation: Create, edit, and organize files and directories
- Data Processing: Execute data analysis, transformations, and exports
- Development Tasks: Build projects, run tests, compile code
Response Structure
The response includes detailed information about command execution and any files that were changed:Successful Command Execution
Command with Output
Command Failure
File Change Tracking
The API automatically tracks file changes during command execution:File Change Types
created
- New files that were createdmodified
- Existing files that were changeddeleted
- Files that were removed
File Metadata
- path: Full path to the changed file
- size: File size in bytes
- mime_type: Detected MIME type (e.g.,
image/png
,text/plain
) - public_url: Direct URL to access the file without authentication
Long-running Commands
Commands have reasonable timeout limits, but for very long-running processes:- Use background processes with
nohup
orscreen
- Break large tasks into smaller steps
- Consider using interim file outputs to track progress
Example Commands
Python Data Analysis
Node.js Package Installation
Git Operations
File Processing
Error Handling
Always check theexit_code
and status
fields:
exit_code: 0
andstatus: "success"
- Command executed successfullyexit_code: non-zero
andstatus: "error"
- Command failed- Check the
output
field for error messages and debugging information
Best Practices
- Command Composition: Chain multiple commands with
&&
for conditional execution - Output Redirection: Use
>
and>>
to capture output to files - Error Handling: Check exit codes before proceeding with dependent operations
- Resource Management: Be mindful of CPU and memory usage for intensive operations
- File Organization: Use descriptive paths and organize outputs in logical directories
Authorizations
API key authentication using Bearer token format: 'Bearer rk_live_<key>'
Path Parameters
UUID of the profile
Room identifier
Body
application/json
Shell command to execute
Example:
"python -c 'print(\"Hello World\")'"