Skip to main content
Use this endpoint to move or rename a file in your application’s filesystem. Supply the current path of the file and the destination path you want it relocated to. This is equivalent to a filesystem mv operation — the file is removed from its original location and placed at the new path. If the destination directory does not exist, the operation will fail.

Endpoint

PATCH https://api.virtuscloud.app/v2/apps/{app_id}/files

Authorization

Include your API key in the request header:
Authorization: <api_key>

Path Parameters

app_id
string
required
The unique identifier of your application. You can find this in the URL of your application’s dashboard.

Body Parameters

path
string
required
The current path of the file you want to move, relative to the root of your application. Example: /old/location/file.txt.
to
string
required
The destination path to move the file to, relative to the root of your application. Example: /new/location/file.txt. To rename a file without moving it, keep the directory the same and change the filename only.

Response

status
string
Indicates the outcome of the request. Returns "success" when the file has been moved successfully.

Examples

curl --request PATCH \
  --url "https://api.virtuscloud.app/v2/apps/{app_id}/files" \
  --header "Authorization: <api_key>" \
  --header "Content-Type: application/json" \
  --data '{
    "path": "/old/location/file.txt",
    "to": "/new/location/file.txt"
  }'

Response Example

{
  "status": "success"
}
To rename a file without moving it to a different directory, set both path and to to the same directory but with a different filename. For example: "path": "/src/old-name.js" and "to": "/src/new-name.js".