Copying a file or folder

To copy files and folders on a user's Disk, specify the path to the resource, and the desired path for its copy.

Request format

Use the POST method to send the copy request.
 ? from=<path to the resource to copy>
 & path=<path to the resource to copy>
 & [overwrite=<overwriting flag>]
 & [fields=<properties to include in the response>]
Query parameters
from *

The path to the resource to copy. For example, %2Ffoo%2Fphoto.png.

The path in the parameter value should be URL-encoded.

path *

The path to the copy of the resource that is being created. For example, %2Fbar%2Fphoto.png (the new resource path can be up to 32760 characters long).

The path in the parameter value should be URL-encoded.


Whether to overwrite. It is used if the resource is copied to a folder that already contains a resource with the same name.

Acceptable values:

  • false — Cancel the copying and don't overwrite the files. Used by default.
  • true — Copy files and delete the existing files with the same name.

List of JSON keys to include in the response. Keys that are not included in this list will be discarded when forming the response. If the parameter is omitted, the response is returned in full, without discarding anything.

Key names should be comma-separated, and embedded keys should be separated by dots. For example: name, _embedded. items. path.

*  Required

Response format

If the request was processed without errors, the API composes the response body depending on the type of the specified resource. The response for an empty folder or file is different from the response for a non-empty folder. (If the request caused an error, a relevant response code is returned, with the response body featuring the error description.)

File or empty folder

The API responds with the 201 Created code (the resource is successfully copied) and returns a link to the metainformation about the created resource in the response body, in the Link object.

Sample response:

  "href": "",
  "method": "GET",
  "templated": false

Non-empty folder

Copying a non-empty folder can take some time, so the API responds with the 202 Accepted code (copying started).

Applications must track the status of requested operations. The Yandex.Disk API returns the link to the status of the operation started by the request. The link is included in the Link object in the response body.

Sample response:

{  "href": "",  "method": "GET",  "templated": false}
Response elements
Element Description

URL. It may be a URL template; see the templated key.


The HTTP method for requesting the URL from the href key.


Indicates a URL template according to RFC 6570. Possible values:

  • “true” — URL template. Before sending a request to this address, put the desired parameter values in place of the values in curly brackets.
  • “false” — The URL can be requested without changes.