Upload File
POST
/v1/sandbox/{sandbox_id}/files/uploadPOST
/v1/sandbox/{'{sandbox_id}'}/files/uploadYour instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.
Description
Uploads a file into the sandbox filesystem at the destination path specified by the path query parameter. The request body may be a multipart/form-data upload or a raw binary body. If the parent directories do not exist they will be created automatically.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sandbox_id | string | Yes | Sandbox ID or name |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Absolute destination path inside the sandbox (e.g. /repo/data.csv) |
Request Body
Send the file as a multipart/form-data field named file, or as a raw binary body with an appropriate Content-Type header.
Responses
201 Success
| Property | Type | Description |
|---|---|---|
status | string | Always "uploaded" on success |
path | string | The absolute path where the file was written inside the sandbox |
default An unexpected error response.
| Property | Type | Description |
|---|---|---|
code | integer | |
message | string | |
details | object[] |
Request
curl -X POST "https://your-instance.example.com/v1/sandbox/sb_abc123/files/upload?path=/repo/data.csv" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: multipart/form-data" \
-F "file=@/local/path/data.csv"const fs = require("fs");
const formData = new FormData();
formData.append("file", new Blob([fs.readFileSync("/local/path/data.csv")]), "data.csv");
const response = await fetch(
"https://your-instance.example.com/v1/sandbox/sb_abc123/files/upload?path=/repo/data.csv",
{
method: "POST",
headers: {
Authorization: "Bearer <token>",
},
body: formData,
}
);
const data = await response.json();
console.log(data); // { status: "uploaded", path: "/repo/data.csv" }import requests
with open("/local/path/data.csv", "rb") as f:
response = requests.post(
"https://your-instance.example.com/v1/sandbox/sb_abc123/files/upload",
params={"path": "/repo/data.csv"},
headers={"Authorization": "Bearer <token>"},
files={"file": ("data.csv", f, "text/csv")},
)
print(response.json()) # {"status": "uploaded", "path": "/repo/data.csv"}Response
{"status": "uploaded", "path": "/repo/data.csv"}{"code": 0, "message": "string", "details": [{"@type": "string"}]}
