Move / Rename File
POST
/v1/sandbox/{sandbox_id}/files/mvPOST
/v1/sandbox/{'{sandbox_id}'}/files/mvYour instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.
Description
Moves or renames a file within the sandbox filesystem. Provide the current absolute path as source and the desired absolute path as destination. If source and destination share the same parent directory, the operation is equivalent to a rename. Moving a file across directories is also supported.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sandbox_id | string | Yes | Sandbox ID or name |
Request Body
| Property | Type | Required | Description |
|---|---|---|---|
source | string | Yes | Absolute path of the file to move or rename |
destination | string | Yes | Absolute path of the desired new location or name |
Responses
200 Success
| Property | Type | Description |
|---|---|---|
status | string | Always "moved" on success |
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/mv" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"source": "/repo/old.txt",
"destination": "/repo/new.txt"
}'const response = await fetch(
"https://your-instance.example.com/v1/sandbox/sb_abc123/files/mv",
{
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify({
source: "/repo/old.txt",
destination: "/repo/new.txt",
}),
}
);
const data = await response.json();
console.log(data); // { status: "moved" }import requests
response = requests.post(
"https://your-instance.example.com/v1/sandbox/sb_abc123/files/mv",
headers={"Authorization": "Bearer <token>"},
json={
"source": "/repo/old.txt",
"destination": "/repo/new.txt",
},
)
print(response.json()) # {"status": "moved"}Response
{"status": "moved"}{"code": 0, "message": "string", "details": [{"@type": "string"}]}
