Get files
Lists the files in an execution session.
GET /v1/exec/files/{sid}
| Address | https://api.hanzo.ai/v1/exec/files/{sid} |
| Method | GET |
| Operation | get_exec_files_by_sid |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Lists the files in an execution session.
Everything the session's sandbox holds — the uploads a run can read and the artifacts it produced — each then fetched from GET /v1/exec/download.
The answer is a BARE JSON ARRAY of {name, lastModified}, where name is the
same {session_id}/{fileId} identifier download takes, because that is what the
client matches on. The obvious typed shape, {files: […]}, would have been a
silent wire change: the request still succeeds and response.data.find(...)
finds nothing, which reads as a session holding no files.
It lists with one recursive find, the same traversal the artifact sweep
makes, so a nested artifact a run reports in its reply is listed here too: one
traversal of the directory, one answer about what a session holds.
Request
1 field.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
sid | path | string | yes | SID is the session identifier — the sandbox this listing is of. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | exec.listing[] | ok |
default | problem-details | refused |
200 body — 2 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
[].lastModified | body | string | — | LastModified is when the BYTES last changed, as RFC 3339 in UTC to the second — 2026-01-02T03:04:05Z, the sandbox's own date -u -r on the file. |
[].name | body | string | — | Name is the file's IDENTIFIER, {session_id}/{fileId} whole — never the bare filename, and never URL-escaped. |
Failure carries the platform error shape — see Errors.
Examples
hanzo exec files get <sid>import { Configuration, ExecApi } from 'hanzoai';
const api = new ExecApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getExecFilesBySid({ sid: 'sid' });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ExecApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ExecApi(client).get_exec_files_by_sid(sid='sid')cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.ExecAPI.GetExecFilesBySid(context.Background()).Execute()
if err != nil {
return err
}use hanzo_client::apis::{configuration::Configuration, exec_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = exec_api::get_exec_files_by_sid(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ExecApi;
ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));
var result = new ExecApi(client).getExecFilesBySid();curl https://api.hanzo.ai/v1/exec/files/<sid> \
-H "Authorization: Bearer $HANZO_API_KEY"MCP reaches exec through the exec tool, which names its 2 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "get_exec_file"
}
}
}'