Everstack
API ReferenceSandboxMove / Rename File

Move / Rename File

POST/v1/sandbox/{sandbox_id}/files/mv
POST/v1/sandbox/{'{sandbox_id}'}/files/mv

Your 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

ParameterTypeRequiredDescription
sandbox_idstringYesSandbox ID or name

Request Body

PropertyTypeRequiredDescription
sourcestringYesAbsolute path of the file to move or rename
destinationstringYesAbsolute path of the desired new location or name

Responses

200 Success

PropertyTypeDescription
statusstringAlways "moved" on success

default An unexpected error response.

PropertyTypeDescription
codeinteger
messagestring
detailsobject[]

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"}]}