> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yolocode.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Executing Commands

> Run shell commands inside your sandbox

Execute arbitrary shell commands inside a running sandbox.

## Usage

```bash theme={null}
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

```json theme={null}
{
  "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`)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.