Copy file


Creates a copy of a file.



Path Parameters

stringin pathrequired

The unique identifier that represent a file.

The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL https://* the file_id is 123.

Query Parameters

string arrayin queryoptional

A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response.

Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.

Request Body

stringin bodyoptional

An optional new name for the copied file.

There are some restrictions to the file name. Names containing non-printable ASCII characters, forward and backward slashes (/, \), and protected names like . and .. are automatically sanitized by removing the non-allowed characters.

objectin body

The destination folder to copy the file to.


The ID of folder to copy the file to.

stringin bodyoptional

An optional ID of the specific file version to copy.



Returns a new file object representing the copied file.

Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.


Returns an empty response when the If-None-Match header matches the current etag value of the file. This indicates that the file has not changed since it was last requested.

application/jsonClient error

Returns an error if some of the parameters are missing or not valid.

  • bad_request when a parameter is missing.
application/jsonClient error

Returns an error if either the source file or the destination folder could not be found, or the authenticated user does not have access to either.

  • not_found when the authenticated user does not have access to the source file or the destination folder
application/jsonClient error
  • operation_blocked_temporary: Returned if either of the destination or source folders is locked due to another move, copy, delete or restore operation in process.

    The operation can be retried at a later point.

  • item_name_in_use when a folder with the same name already exists.
application/jsonClient error

An unexpected client error.

Copy file
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

curl -X POST \
     -H 'Authorization: Bearer <ACCESS_TOKEN>" '
     -H 'Content-Type: application/json" '
     -d '{
       "parent": {
         "id": "123"
string fileId = "11111";
string destinationFolderId = "22222";
var requestParams = new BoxFileRequest()
    Id = fileId,
    Parent = new BoxRequestEntity()
        Id = destinationFolderId

BoxFile fileCopy = await client.FilesManager.CopyAsync(requestParams);
// Copy a file into the user's root folder
BoxFolder rootFolder = BoxFolder.getRootFolder(api);
BoxFile file = new BoxFile(api, "id");
BoxFile.Info copiedFileInfo = file.copy(rootFolder, "New Name");
file_id = '11111'
destination_folder_id = '44444'

file_to_copy = client.file(file_id)
destination_folder = client.folder(destination_folder_id)

file_copy = file_to_copy.copy(destination_folder)
print('File "{0}" has been copied into folder "{1}"'.format(,
var fileID = '11111';
var destinationFolderID = '22222';
client.files.copy(fileID, destinationFolderID)
	.then(fileCopy => {
		/* fileCopy -> {
			type: 'file',
			id: '11112',
				{ type: 'file_version',
				id: '99999',
				sha1: '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' },
			sequence_id: '0',
			etag: '0',
			sha1: '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33',
			name: 'My File.pdf',
			description: '',
			size: 68431,
				{ total_count: 1,
				[ { type: 'folder',
					id: '0',
					sequence_id: null,
					etag: null,
					name: 'All Files' },
					{ type: 'folder',
					id: '22222',
					sequence_id: null,
					etag: null,
					name: 'Personal Files' } ] },
			created_at: '2017-05-16T15:18:02-07:00',
			modified_at: '2017-05-16T15:18:02-07:00',
			trashed_at: null,
			purged_at: null,
			content_created_at: '2017-05-16T15:18:02-07:00',
			content_modified_at: '2017-05-16T15:18:02-07:00',
				{ type: 'user',
				id: '33333',
				name: 'Test User',
				login: '' },
				{ type: 'user',
				id: '33333',
				name: 'Test User',
				login: '' },
				{ type: 'user',
				id: '33333',
				name: 'Test User',
				login: '' },
			shared_link: null,
				{ type: 'folder',
				id: '22222',
				sequence_id: null,
				etag: null,
				name: 'Personal Files' }
			item_status: 'active' }
client.files.copy(fileId: "11111", parentId: "0") { (result: Result<File, BoxSDKError>) in
    guard case let .success(copiedFile) = result else {
        print("Error copying file")

    print("Copied file \( into folder \(; copy has file ID \(")