Files: copy

Requires authorization

Creates a copy of a file and applies any requested updates with patch semantics. Try it now.

Request

HTTP request

POST https://www.googleapis.com/drive/v3/files/fileId/copy

Parameters

Parameter name Value Description
Path parameters
fileId string The ID of the file.
Optional query parameters
ignoreDefaultVisibility boolean Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders. (Default: false)
keepRevisionForever boolean Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive. (Default: false)
ocrLanguage string A language hint for OCR processing during image import (ISO 639-1 code).
supportsTeamDrives boolean Whether the requesting application supports Team Drives. (Default: false)

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.photos.readonly

Request body

In the request body, supply a Files resource with the following properties:

Property name Value Description Notes
Optional Properties
appProperties object A collection of arbitrary key-value pairs which are private to the requesting app.

Entries with null values are cleared in update and copy requests.

writable
contentHints.thumbnail.image bytes The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5). writable
contentHints.thumbnail.mimeType string The MIME type of the thumbnail. writable
description string A short description of the file. writable
mimeType string The MIME type of the file.

Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.

If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource.

writable
modifiedTime datetime The last time the file was modified by anyone (RFC 3339 date-time).

Note that setting modifiedTime will also update modifiedByMeTime for the user.

writable
name string The name of the file. This is not necessarily unique within a folder. Note that for immutable items such as the top level folders of Team Drives, My Drive root folder, and Application Data folder the name is constant. writable
parents[] list The IDs of the parent folders which contain the file.

If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values.

writable
properties object A collection of arbitrary key-value pairs which are visible to all apps.

Entries with null values are cleared in update and copy requests.

writable
starred boolean Whether the user has starred the file. writable
viewedByMeTime datetime The last time the file was viewed by the user (RFC 3339 date-time). writable
viewersCanCopyContent boolean Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations. writable
writersCanShare boolean Whether users with only writer permission can modify the file's permissions. Not populated for Team Drive files. writable

Response

If successful, this method returns a Files resource in the response body.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Send feedback about...

Drive REST API
Drive REST API