Files
Upload, download, and list files in sandboxes.
Upload File
POST /v1/sandboxes/:id/files
Upload a file to a sandbox.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The sandbox ID |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | The path in the sandbox where the file should be saved |
content | string | Yes | The file content (base64 encoded for binary files) |
Example
curl -X POST https://api.conway.tech/v1/sandboxes/sbx_abc123/files \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"path": "/home/ubuntu/hello.txt",
"content": "Hello from Conway!"
}'await fetch("https://api.conway.tech/v1/sandboxes/sbx_abc123/files", {
method: "POST",
headers: {
Authorization: "Bearer your-api-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
path: "/home/ubuntu/hello.txt",
content: "Hello from Conway!",
}),
});Response
Returns 201 Created on success.
Download File
GET /v1/sandboxes/:id/files?path=<path>
Download a file from a sandbox.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The sandbox ID |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | The path of the file in the sandbox |
Example
curl "https://api.conway.tech/v1/sandboxes/sbx_abc123/files?path=/home/ubuntu/hello.txt" \
-H "Authorization: Bearer your-api-key"const response = await fetch(
"https://api.conway.tech/v1/sandboxes/sbx_abc123/files?path=/home/ubuntu/hello.txt",
{
headers: { Authorization: "Bearer your-api-key" },
}
);Response
{
"content": "Hello from Conway!"
}List Files
GET /v1/sandboxes/:id/files/list?path=<path>
List files and directories in a sandbox path.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The sandbox ID |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | The directory path to list |
Example
curl "https://api.conway.tech/v1/sandboxes/sbx_abc123/files/list?path=/home/ubuntu" \
-H "Authorization: Bearer your-api-key"const response = await fetch(
"https://api.conway.tech/v1/sandboxes/sbx_abc123/files/list?path=/home/ubuntu",
{
headers: { Authorization: "Bearer your-api-key" },
}
);Response
{
"files": [
{
"name": "hello.txt",
"isDir": false,
"size": 17
},
{
"name": "projects",
"isDir": true,
"size": 4096
}
]
}