# Sandboxes

Create sandboxes and upload files for agent runs

## POST /v1/sandboxes

> Create a new sandbox for file uploads. The sandbox can then be used when starting a run.

```json
{"openapi":"3.0.3","info":{"title":"Duvo Public API","version":"1.0.0"},"tags":[{"name":"Sandboxes","description":"Create sandboxes and upload files for agent runs"}],"servers":[{"url":"https://api.duvo.ai","description":"Production server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key authentication. Get your API key from the Duvo dashboard."}}},"paths":{"/v1/sandboxes":{"post":{"tags":["Sandboxes"],"description":"Create a new sandbox for file uploads. The sandbox can then be used when starting a run.","responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sandbox_id":{"type":"string"},"expires_at":{"type":"string"}},"required":["sandbox_id","expires_at"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}}}}
```

## POST /v1/sandboxes/{sandbox\_id}/upload-urls

> Get a presigned URL for uploading a file to the sandbox. Use this for files larger than 10MB.

```json
{"openapi":"3.0.3","info":{"title":"Duvo Public API","version":"1.0.0"},"tags":[{"name":"Sandboxes","description":"Create sandboxes and upload files for agent runs"}],"servers":[{"url":"https://api.duvo.ai","description":"Production server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key authentication. Get your API key from the Duvo dashboard."}}},"paths":{"/v1/sandboxes/{sandbox_id}/upload-urls":{"post":{"tags":["Sandboxes"],"description":"Get a presigned URL for uploading a file to the sandbox. Use this for files larger than 10MB.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"path":{"type":"string","minLength":1,"description":"Path where the file will be uploaded (e.g., /workspace/data.csv)"}},"required":["path"],"additionalProperties":false}}},"required":true},"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"sandbox_id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"upload_url":{"type":"string","format":"uri"},"path":{"type":"string"},"expires_in_seconds":{"type":"number"}},"required":["upload_url","path","expires_in_seconds"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}}}}
```

## GET /v1/sandboxes/{sandbox\_id}/files

> List files in a sandbox directory.

```json
{"openapi":"3.0.3","info":{"title":"Duvo Public API","version":"1.0.0"},"tags":[{"name":"Sandboxes","description":"Create sandboxes and upload files for agent runs"}],"servers":[{"url":"https://api.duvo.ai","description":"Production server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key authentication. Get your API key from the Duvo dashboard."}}},"paths":{"/v1/sandboxes/{sandbox_id}/files":{"get":{"tags":["Sandboxes"],"description":"List files in a sandbox directory.","parameters":[{"schema":{"type":"string","default":"/workspace"},"in":"query","name":"path","required":false},{"schema":{"type":"string","minLength":1},"in":"path","name":"sandbox_id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"files":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"path":{"type":"string"},"type":{"type":"string","enum":["file","dir"]},"size_bytes":{"type":"number"}},"required":["name","path","type","size_bytes"],"additionalProperties":false}}},"required":["files"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}}}}
```

## POST /v1/sandboxes/{sandbox\_id}/files

> Upload a file directly to the sandbox. Maximum file size is 10MB. For larger files, use the upload-urls endpoint.

```json
{"openapi":"3.0.3","info":{"title":"Duvo Public API","version":"1.0.0"},"tags":[{"name":"Sandboxes","description":"Create sandboxes and upload files for agent runs"}],"servers":[{"url":"https://api.duvo.ai","description":"Production server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key authentication. Get your API key from the Duvo dashboard."}}},"paths":{"/v1/sandboxes/{sandbox_id}/files":{"post":{"tags":["Sandboxes"],"description":"Upload a file directly to the sandbox. Maximum file size is 10MB. For larger files, use the upload-urls endpoint.","parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"sandbox_id","required":true}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"path":{"type":"string"},"size_bytes":{"type":"number"}},"required":["path","size_bytes"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"413":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}}}}
```
