Download File
GET
/v1/sandbox/{sandbox_id}/files/downloadGET
/v1/sandbox/{'{sandbox_id}'}/files/downloadYour instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.
Description
Downloads a file from the sandbox filesystem. The response body is the raw binary content of the file. The server sets a Content-Disposition: attachment header containing the filename so that HTTP clients can save it with the correct name.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sandbox_id | string | Yes | Sandbox ID or name |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Absolute path to the file inside the sandbox (e.g. /repo/main.go) |
Responses
200 Success
The response body is the raw binary content of the requested file.
| Header | Description |
|---|---|
Content-Type | application/octet-stream |
Content-Disposition | attachment; filename="<filename>" |
default An unexpected error response.
| Property | Type | Description |
|---|---|---|
code | integer | |
message | string | |
details | object[] |
Request
curl -X GET "https://your-instance.example.com/v1/sandbox/sb_abc123/files/download?path=/repo/main.go" \
-H "Authorization: Bearer <token>" \
-O -Jconst response = await fetch(
"https://your-instance.example.com/v1/sandbox/sb_abc123/files/download?path=/repo/main.go",
{
method: "GET",
headers: {
Authorization: "Bearer <token>",
},
}
);
// Stream binary content to a local file (Node.js)
const { createWriteStream } = require("fs");
const dest = createWriteStream("./main.go");
response.body.pipe(dest);import requests
response = requests.get(
"https://your-instance.example.com/v1/sandbox/sb_abc123/files/download",
params={"path": "/repo/main.go"},
headers={"Authorization": "Bearer <token>"},
stream=True,
)
with open("./main.go", "wb") as f:
for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)Response
Binary file content streamed in the response body.
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="main.go"{"code": 0, "message": "string", "details": [{"@type": "string"}]}
