Skip to main content
Every sandbox exposes a filesystem API under /v1/sandbox/{sandbox_id}/fs. All operations take a sandbox_id and, where they act on a path, a path query parameter.
Read and write bodies are raw bytes (application/octet-stream) — not tar archives, not multipart form data. Each call moves exactly one file’s contents.

Reading a file

string
required
Path to the file.
Returns 200 with the raw file contents as application/octet-stream.
MCP: fs_read returns the file’s contents as a UTF-8 string, since MCP tool calls carry inline text rather than binary bytes.

Writing a file

string
required
Path to write to.
The request body is the raw file contents (application/octet-stream). Returns 204 on success — no response body.
MCP: fs_write takes UTF-8 text content and creates or overwrites the file, returning { ok: true, path, bytes }.

Uploading and downloading a local file

There’s no dedicated REST endpoint for upload/download — the CLI and SDKs implement it as a local file streamed through the same raw-bytes fs/read and fs/write endpoints above.
MCP: there’s no fs upload/download tool — MCP tool calls carry inline UTF-8 text, not binary file transfers, so fs_read/fs_write are the only way to move file contents through MCP.

Listing a directory

string
required
Directory path to list.
Returns FsListResponse: { "files": [ ...FsFileInfo ] }.
MCP: fs_list returns { files: [{ path, name, kind, size, mode, modified_at_unix_nanos }, ...] }.

Getting file metadata

string
required
Path to stat.
Returns FsStatResponse: { "file": { ...FsFileInfo } }.
MCP: fs_stat returns { file: { path, name, kind, size, mode, modified_at_unix_nanos } }.

FsFileInfo fields

string
required
Full path.
string
required
Base name.
string
required
One of UNSPECIFIED, FILE, DIRECTORY, SYMLINK, OTHER.
integer
required
Size in bytes.
integer
required
Permission bits as reported by the guest, 0–4095.
integer
required
Last-modified time.

Creating a directory

Request body (FsMkdirRequest):
string
required
Directory path to create.
Returns 201 on success.
MCP: fs_mkdir creates the directory (and any missing parents), returning { ok: true, path }.

Renaming or moving

Request body (FsRenameRequest):
string
required
Source path.
string
required
Destination path.
Returns 200 on success.
MCP: fs_rename covers this, returning { ok: true, from, to }.

Deleting

string
required
Path to remove.
boolean
default:"false"
Whether to remove a non-empty directory recursively.
Returns 204 on success.
MCP: fs_delete covers this — pass recursive: true to delete a non-empty directory. Returns { ok: true, deleted: path }.

Sandboxes

Errors