Skip to main content
The Files API reads and writes the durable workspace for one agent and one stable subjectId. That workspace is the same sandbox volume the agent mounts during sessions and automations. You do not need an active session. All endpoints require an x-api-key header. Paths are workspace-relative, use / separators, and must not contain ... A leading slash is optional and is stripped. See Files and workspaces for volume layout, reserved paths, and when to use attachments or memory instead.

List files

A subject with no volume yet returns an empty list, not 404.

Get file metadata

The response is a single file object. Missing paths return 404 not_found.

Read file content

JSON is the default response. Text files use encoding: "utf-8". Binary files use encoding: "base64".
To download bytes instead of JSON, send Accept: application/octet-stream. Directories cannot be downloaded and return 400 validation_error. Each file is capped at 40 MiB. Larger objects return 400 validation_error.

Write file content

The first write for a subject creates the volume if needed. Writing a path that already exists with overwrite: false returns 409 conflict. Writing a directory path, a reserved memories/ or skills/ path, or a body over 40 MiB returns 400 validation_error. The response is the updated file metadata object.

Upload binary files

For images, PDFs, and other binaries, send encoding: "base64" or use multipart:
Query path and overwrite apply to octet-stream uploads. createParents defaults to true.

Create a directory

Creating a directory that already exists is idempotent and returns the existing directory metadata. Creating a directory over a file path returns 409 conflict.

Move or rename

Move works for files and directories. Parent directories of to are created when missing. overwrite: false (the default) returns 409 conflict when the destination exists. Reserved memories/ and skills/ paths cannot be moved.

Copy

Copying a directory copies its contents recursively. The source is left in place. Destination limits match write: 40 MiB per file and the subject’s volume ceiling.

Delete

Deleting a missing path returns 404 not_found. Deleting a non-empty directory without recursive=true returns 409 conflict. Reserved memory and skill paths cannot be deleted through this endpoint. Response:

Search files

Search skips binary files. Each match includes the path, a short excerpt, and whether the query hit the name, the contents, or both.

Get volume usage

Volumes start at 512 MiB and expand automatically toward 4 GiB as usage approaches capacity. See Volume capacity.

Visibility during sessions

Writes from this API land on the same volume the agent mounts. A running turn may not observe a write until the next turn. Prefer writing before POST /v1/sessions, after the session is idle, or while using POST /v1/sandboxes/warm so the sandbox is already attached. File operations count against the organization API key request ceiling, not the per-subject conversation or message allowances.

Endpoint summary

Errors

Last modified on August 13, 2026