REST API
Base URL: https://api.ai2in.dev. Authenticate with a bearer API key:
Authorization: Bearer ai2in_live_…The SDKs and CLI wrap this API — reach for it directly for languages without an SDK, or for server-to-server calls.
Sandboxes
| Method | Path | Description |
|---|---|---|
POST | /v1/sandboxes | Create a sandbox. Body: { image?, desktop?, env? }. |
GET | /v1/sandboxes | List sandboxes on this node. |
POST | /v1/sandboxes/:id/run | Run code. Body: { code }. Returns an Execution. |
POST | /v1/sandboxes/:id/run/stream | Same, as an SSE stream of events. |
GET | /v1/sandboxes/:id | Sandbox info: status, end_at, node_id. |
POST | /v1/sandboxes/:id/timeout | Set hard lifetime. Body: { timeout_ms } (max 24h). |
POST | /v1/sandboxes/:id/pause | Pause. |
POST | /v1/sandboxes/:id/resume | Resume. |
GET | /v1/sandboxes/:id/metrics | Live resource metrics. |
POST | /v1/sandboxes/:id/expose | Public URL for a port. Body: { port }. |
DELETE | /v1/sandboxes/:id | Destroy the sandbox. |
Shell & filesystem
| Method | Path | Body |
|---|---|---|
POST | /v1/sandboxes/:id/shell | { cmd } |
POST | /v1/sandboxes/:id/fs/list | { path } |
POST | /v1/sandboxes/:id/fs/read | { path } |
POST | /v1/sandboxes/:id/fs/write | { path, content } |
POST | /v1/sandboxes/:id/fs/read_bytes | { path } → { content_b64, size } (≤32MB) |
POST | /v1/sandboxes/:id/fs/write_bytes | { path, content_b64 } (≤32MB) |
POST | /v1/sandboxes/:id/fs/watch | { path, recursive } → { watch_id } |
POST | /v1/sandboxes/:id/fs/watch/:wid/poll | → { events } |
POST | /v1/sandboxes/:id/fs/watch/:wid/stop | — |
Commands (background)
| Method | Path | Body |
|---|---|---|
POST | /v1/sandboxes/:id/commands | { cmd } → { command_id, pid } |
GET | /v1/sandboxes/:id/commands | → { commands: [...] } |
POST | /v1/sandboxes/:id/commands/:cid/logs | → { stdout, stderr, status, exit_code } |
POST | /v1/sandboxes/:id/commands/:cid/kill | — |
PTY (interactive terminal)
| Method | Path | Body |
|---|---|---|
POST | /v1/sandboxes/:id/pty | { cmd?, cols?, rows?, cwd?, env? } → { pty_id, pid } |
POST | /v1/sandboxes/:id/pty/:pid/input | { data_b64 } |
POST | /v1/sandboxes/:id/pty/:pid/output | → { data_b64, alive, exit_code } (drains buffer) |
POST | /v1/sandboxes/:id/pty/:pid/resize | { cols, rows } |
POST | /v1/sandboxes/:id/pty/:pid/kill | — |
Databases
| Method | Path | Body |
|---|---|---|
POST | /v1/databases | { engine, version?, name? } → { …, url } |
DELETE | /v1/databases/:id | — |
Hosting
| Method | Path | Body |
|---|---|---|
POST | /v1/hosting/services | { name, image, internal_port?, env?, start_cmd? } |
POST | /v1/hosting/services/:id/logs | — |
POST | /v1/hosting/services/:id/redeploy | — |
POST | /v1/hosting/services/:id/stop | — |
DELETE | /v1/hosting/services/:id | — |
Errors
Standard HTTP status codes. 401 unauthenticated, 403 missing scope, 404 not found, 409 sandbox paused, 429 quota exceeded, 503 node at capacity. Bodies are { "error": "…" }.