Executing Commands
Run shell commands inside your sandbox
Execute arbitrary shell commands inside a running sandbox.
Usage
curl -X POST https://api.yolocode.ai/api/e2b-sandboxes/<id>/exec \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"command": "npm install && npm run build"}'Response
{
"output": "added 150 packages in 12s\n> build\n> next build\n..."
}Notes
- Commands run in the sandbox's default shell
- The endpoint has a max duration of 300 seconds (5 minutes)
- Long-running processes should be started in the background (e.g.,
nohup ... &) - Works identically for both E2B (
/api/e2b-sandboxes/<id>/exec) and Daytona (/api/daytona-sandboxes/<id>/exec)