API Reference

AIO Sandbox provides comprehensive REST APIs and WebSocket interfaces for all core functionalities. All APIs are documented with OpenAPI 3.1 specification.

Interactive API Documentation

For interactive API exploration, visit the built-in Swagger UI when your AIO Sandbox is running:

📚 Live API Docs: http://localhost:8080/v1/docs

API Overview

AIO Sandbox exposes the following API categories:

Category Base Path Description
Sandbox /v1/sandbox Environment information and package management
File Operations /v1/file File system operations (read, write, search, find)
Code Execution /v1/code Secure code execution with Sandbox Fusion
Shell Terminal /v1/shell WebSocket terminal interface
Browser/CDP /cdp Chrome DevTools Protocol for browser automation
MCP Services /v1/mcp Model Context Protocol hub

Quick API Examples

Environment Information

Get sandbox environment details:

curl http://localhost:8080/v1/sandbox

File Operations

Create a file:

curl -X POST http://localhost:8080/v1/file/write \
  -H "Content-Type: application/json" \
  -d '{
    "file": "/tmp/example.txt",
    "content": "Hello AIO Sandbox!"
  }'

Read a file:

curl -X POST http://localhost:8080/v1/file/read \
  -H "Content-Type: application/json" \
  -d '{"file": "/tmp/example.txt"}'

Jupyter Code Execution

Execute Python code in Jupyter kernel:

curl -X POST http://localhost:8080/v1/jupyter/execute \
  -H "Content-Type: application/json" \
  -d '{
    "code": "print(\"Hello from Jupyter!\")",
    "timeout": 30,
    "session_id": "my-session"
  }'

Node.js Code Execution

Execute JavaScript code:

curl -X POST http://localhost:8080/v1/nodejs/execute \
  -H "Content-Type: application/json" \
  -d '{
    "code": "console.log(\"Hello from Node.js!\")",
    "timeout": 30
  }'

Terminal WebSocket

Connect to terminal via WebSocket:

const ws = new WebSocket('ws://localhost:8080/v1/shell/ws');
ws.onopen = () => {
  // Send command
  ws.send(JSON.stringify({
    type: 'input', 
    data: 'ls -la\n'
  }));
};

Download OpenAPI Specification

Get the complete OpenAPI specification:

# Download the OpenAPI JSON
curl http://localhost:8080/openapi.json > aio-sandbox-api.json

# View specific endpoints
curl http://localhost:8080/openapi.json | jq '.paths'

Authentication

Currently, AIO Sandbox runs in development mode without authentication. For production deployments, consider:

  • Implementing reverse proxy authentication
  • Using network policies to restrict access
  • Running in isolated container networks

Rate Limiting

API endpoints have built-in rate limiting:

  • File operations: 100 requests/minute
  • Code execution: 10 requests/minute
  • Terminal sessions: 5 concurrent connections

Error Handling

All APIs return consistent error responses:

{
  "success": false,
  "message": "Error description",
  "error_code": "SPECIFIC_ERROR_CODE",
  "data": null
}

Common HTTP status codes:

  • 200: Success
  • 400: Bad Request (invalid parameters)
  • 404: Not Found (file/resource not found)
  • 429: Too Many Requests (rate limited)
  • 500: Internal Server Error

Next Steps

  • Detailed API Reference: Explore specific endpoints in the following sections
  • Shell WebSocket: Learn about terminal integration → Shell API
  • File Operations: Master file system APIs → File API
  • Browser Automation: Use CDP for browser control → Browser API
  • Working Examples: See practical implementations → Examples