WBX Sandbox
Sandboxes

Files

Each sandbox has its own disk. Upload input files, let your code or agent work, download the results – everything else disappears with the sandbox.

Upload and download

sb.files.write("/home/user/data.csv", open("data.csv", "rb").read())   # bytes or text
png = sb.files.read("/home/user/chart.png")                           # bytes
text = sb.files.read_text("/home/user/report.md")
print(sb.files.list("/home/user"))
sb.files.mkdir("/home/user/out")
sb.files.remove("/home/user/tmp", recursive=True)
# upload (raw bytes; parent directories are created)
curl -s -X PUT "https://sandbox.wbx.cz/v1/sandboxes/SB_ID/files?path=/home/user/data.csv" \
  -H "Authorization: Bearer YOUR_API_KEY" --data-binary @data.csv

# download
curl -s "https://sandbox.wbx.cz/v1/sandboxes/SB_ID/files?path=/home/user/chart.png" \
  -H "Authorization: Bearer YOUR_API_KEY" -o chart.png

Missing parent directories are created when you write a file.

All file endpoints

EndpointWhat it does
GET / PUT / DELETE /v1/sandboxes/{id}/files?path=Download, upload or delete a file.
GET /v1/sandboxes/{id}/fs/list?path=&depth=1List a directory (name, type, size, mode, modification time); depth up to 5.
GET /v1/sandboxes/{id}/fs/stat?path=Information about one file or directory.
POST /v1/sandboxes/{id}/fs/mkdir{"path": "/home/user/out", "parents": true}
POST /v1/sandboxes/{id}/fs/move{"from": "…", "to": "…", "overwrite": false}
POST /v1/sandboxes/{id}/fs/remove{"path": "…"} – directories are removed with their contents; "recursive": false removes only an empty one.
GET /v1/sandboxes/{id}/fs/watch?path=&recursive=falseNDJSON stream of changes (create, write, remove, rename).

Keeping files

A destroyed sandbox loses its disk. To keep files between sessions, let the sandbox fall asleep instead – its files are kept for 7 days. For results of longer work use a background job: its result files stay available for 7 days after the sandbox is gone, and other jobs can use them as inputs.