GET /v1/sandboxes/{sandbox_id}/files
Returns the file at `path` as bytes. With `list=1` returns the directory's entries (or the single entry when `path` is a file) as JSON instead. Transfers are capped at 64 MiB.

Authentication

Bearer Token (b3os_sk_ API key or b3os_pat_ token) API Key (cookie: __Host-b3os_session)

Path Parameters

sandbox_id string required path
The sandbox ID (`sbx_…`).
Example: "sbx_01m5t68q1b590rj801nbzsqzkk"

Query Parameters

path string required query
Absolute path inside the sandbox.
Example: "/workspace/main.py"
list integer optional query
`1` lists the directory instead of reading a file.

Responses

200 The file's bytes, or the listing with `list=1`.
application/json
object string REQUIRED
Enum: list
data object[] REQUIRED
Array of:
name string REQUIRED
path string REQUIRED
type string REQUIRED
Enum: file, directory, symlink
size integer REQUIRED
mode string REQUIRED
Octal permission bits.
modified_at string (date-time) REQUIRED
target string
Symlink target.
next_cursor string | null REQUIRED
400 The request failed validation (`invalid_request`, `invalid_url`).
401 Missing, malformed, expired or revoked credentials (`unauthorized`).
403 Authenticated but not allowed (`forbidden`, `egress_denied`).
404 Nothing exists at the path (`file_not_found`).
413 The file exceeds the per-request transfer limit (`file_too_large`).
422 The path is not absolute, too long, or a parent is a file (`path_invalid`, `not_a_directory`).
429 A rate, concurrency or quota limit applies (`rate_limited`, `concurrency_limited`, `quota_exceeded`).
500 Something failed inside B3OS (`internal`). Retry with backoff.
502 The agent inside the microVM did not answer (`guest_unreachable`).
503 The node or the product is not available right now (`node_unavailable`, `product_unavailable`, `capacity_unavailable`).
curl -X GET 'https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/files?path=%2Fworkspace%2Fmain.py' \  -H 'Authorization: Bearer YOUR_API_TOKEN'
const response = await fetch('https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/files?path=%2Fworkspace%2Fmain.py', {  method: 'GET',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN"  }});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.get('https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/files?path=%2Fworkspace%2Fmain.py', headers=headers)print(response.json())
200 Response
{  "object": "list",  "data": [    {      "name": "main.py",      "path": "/workspace/main.py",      "type": "file",      "size": 812,      "mode": "0644",      "modified_at": "2026-10-25T19:01:30.000Z"    },    {      "name": "data",      "path": "/workspace/data",      "type": "directory",      "size": 4096,      "mode": "0755",      "modified_at": "2026-10-25T19:00:10.000Z"    }  ],  "next_cursor": null}
Ask a question... ⌘I