Move file

Move file API

POST https://api.imagekit.io/v1/files/move

This will move a file and all its versions from one folder to another. Note: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file.

Headers

NameTypeDescription

Authorization

string

base64 encoding of your_private_api_key:

Note the colon in the end.

Request Body

NameTypeDescription

sourceFilePath

string

The full path of the file you want to move. For example - /path/to/file.jpg

destinationPath

string

Full path to the folder you want to move the above file into. For example - /folder/to/move/into/

Response structure and status code

In case of an error, you will get an error code along with the error message. On success, you will receive a 204 status code with an empty body.

Access control and permissions

Read how access and permissions are affected by this operation here.

Examples

Here is the example request to understand the API usage.

curl -X POST "https://api.imagekit.io/v1/files/move" \
-H 'Content-Type: application/json' \
-u your_private_key: -d '
{
	"sourceFilePath" : "/path/to/file.jpg",
	"destinationPath" : "/folder/to/move/into/"
}
'

Last updated