Files

Move files in and out of a sandbox with the SDKs, the files API, sbx scp, or an agent's MCP tools, and where each one's reference is.

.md

Every sandbox has its own disk. You can move files in and out these ways:

From Upload Download Reference
TypeScript SDK sandbox.files.write(path, data) files.read, files.readBytes (up to 5 MiB), files.download (up to 50 MiB) TypeScript SDK
Python SDK sandbox.files.write(path, data) files.read, files.read_bytes (up to 5 MiB), files.download (up to 50 MiB) Python SDK
CLI sbx scp ./file sb_k3v9x2mq:/home/user/ sbx scp sb_k3v9x2mq:/home/user/out.zip . SSH: copy files, sbx scp
HTTP API PUT /api/v1/sandboxes/{id}/files GET /api/v1/sandboxes/{id}/files?path=… API reference
MCP (agents) write_file read_file MCP server
  • Paths are relative to /home/user. Absolute paths under /home/user or /tmp work too.
  • sbx scp -r copies whole directories. A recursive copy to a new directory goes as one tar stream when both ends have tar, which is much faster for many small files.
  • A missing file answers 404 file_not_found, and an upload over the size limit answers 413 file_too_large (error codes).
  • Files survive a stop and resume, unless snapshots are off for your account. To start new sandboxes with the same files, save a named snapshot.