Deleting a file or folder

To delete files and folders on a user's Disk, specify the path to the resource to delete. Keep in mind that moving resources to the Trash does not change the space available on Yandex.Disk. To free up space, you should also delete resources from the Trash.

Request format

Use the DELETE method to send the delete request.
 ? path=<path to the resource to delete>
 & [permanently=<whether to permanently delete the resource>]
 & [fields=<properties to include in the response>]
Query parameters
path *

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

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


The flag for permanent deletion. Supported values:

  • false — The deleted file or folder is moved to the Trash (used by default).
  • true — The file or folder is deleted without being put in the Trash.

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 code 204 No content (the resource was successfully deleted) without a response body.

Non-empty folder

Deleting a non-empty folder can take an unknown amount of time, so the API responds with the code 202 Accepted (the deletion process has 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 located 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.