v48

latestOpenAPI 3.0.0raw.githubusercontent.com2025-12-0297180624.8 KB
File System

Rename box/dir

Renames a file or a directory. If the target newPath already exists, the rename will fail.

post/boxes/{boxId}/fs/rename

Path parameters

boxIdstring required
Example:c9bdc193-b54b-4ddb-a035-5ac0c598d32d

Box ID

Request body

workingDirstring

Working directory. If not provided, the file will be read from the box.config.workingDir directory.

oldPathstring required

Old path in the box. If the path does not start with '/', the file/directory will be renamed relative to the working directory. If the oldPath does not exist, the rename will fail.

newPathstring required

New path in the box. If the path does not start with '/', the file/directory will be renamed relative to the working directory. If the newPath already exists, the rename will fail.

Example request

{
  "workingDir": "/home/user/documents",
  "oldPath": "/home/user/documents/output.txt",
  "newPath": "/home/user/documents/new-name.txt"
}

Response

Rename file

OR

Example response

{
  "name": "example.txt",
  "path": "/path/to/example.txt",
  "size": "10MB",
  "mode": "755",
  "lastModified": "2021-01-01T00:00:00Z"
}