POST /v1/sandboxes/{sandbox_id}/files/move
Moves `from` to `to` and returns the entry at `to`. An existing `to` is kept and the move refused with `409 file_exists` unless `overwrite` is true; a directory replaces only an empty directory. The directory `to` goes in must exist. Across filesystems inside the sandbox (from `/tmp` to `/workspace`, say) a regular file is copied and its source removed; a directory is refused there. Sandboxes whose template image predates this operation answer `409 guest_outdated`.

Authentication

Bearer Token (b3os_sk_ API key or b3os_pat_ token)

Path Parameters

sandbox_id string required path
The sandbox ID (`sbx_…`).
Example: "sbx_01m5t68q1b590rj801nbzsqzkk"

Request Body required

application/json
from string REQUIRED
Absolute path of the file or directory to move.
to string REQUIRED
Absolute path it moves to.
overwrite boolean
Replace an existing file at `to` (or an empty directory, when `from` is a directory).

Responses

200 The entry at its new path.
application/json
name string REQUIRED
path string REQUIRED
type string REQUIRED
Enum: file, directory, symlink
size integer REQUIRED
mode string REQUIRED
Octal permission bits.
modified_at string (date-time) REQUIRED
target string
Symlink target.
400 The request failed validation (`invalid_request`, `invalid_url`).
401 Missing, malformed, expired or revoked credentials (`unauthorized`).
403 Authenticated but not allowed (`forbidden`, `egress_denied`).
404 Nothing exists at the path (`file_not_found`).
409 Something already exists at the target path (`file_exists`); also a directory that is not empty in the way (`directory_not_empty`), a sandbox that is not running (`sandbox_not_running`), or an agent that predates the operation (`guest_outdated`).
413 The request body exceeds this operation's limit.
415 The Content-Type is not accepted by this operation.
422 The path is not absolute, too long, or a parent is a file (`path_invalid`, `not_a_directory`).
429 A rate, concurrency or quota limit applies (`rate_limited`, `concurrency_limited`, `quota_exceeded`).
500 Something failed inside B3OS (`internal`). Retry with backoff.
502 The agent inside the microVM did not answer (`guest_unreachable`).
503 The node or the product is not available right now (`node_unavailable`, `product_unavailable`, `capacity_unavailable`).
curl -X POST 'https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/files/move' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'Content-Type: application/json' \  -d '{  "from": "/workspace/out.tmp",  "to": "/workspace/out.csv"}'
const response = await fetch('https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/files/move', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json"  },  body: JSON.stringify({    "from": "/workspace/out.tmp",    "to": "/workspace/out.csv"  })});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/files/move', headers=headers, json={  "from": "/workspace/out.tmp",  "to": "/workspace/out.csv"})print(response.json())
200 Response
{  "name": "out.csv",  "path": "/workspace/out.csv",  "type": "file",  "size": 2048,  "mode": "0644",  "modified_at": "2026-10-25T19:01:30.000Z"}
Ask a question... ⌘I