This will copy a file 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 (if includeFileVersions is set to true) will be appended to the destination file version history.
Headers
Name
Type
Description
Authorization
string
base64 encoding of your_private_api_key:
Note the colon in the end.
Request Body
Name
Type
Description
sourceFilePath
string
The full path of the file you want to copy. For example - /path/to/file.jpg
destinationPath
string
Full path to the folder you want to copy the above file into. For example - /folder/to/copy/into/
includeFileVersions
boolean
Option to copy all versions of a file. By default, only the current version of the file is copied. When set to true, all versions of the file will be copied.
Default value - false
{"message" : "No file found with filePath /path/to/file.jpg","help" : "For support kindly contact us at support@imagekit.io .","reason" : "SOURCE_FILE_MISSING"}
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.