---
metadata:
  - name: generator
    content: Diplodoc Platform v5.44.0
alternate:
  - https://yandex.ru/dev/disk-api/doc/en/reference/trash-delete.md
  - https://yandex.ru/dev/disk-api/doc/ru/reference/trash-delete.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.ru/dev/disk-api/doc/en/llms.txt

# Emptying Trash

Files that were moved to Trash can be permanently deleted. Trash is considered a folder on Yandex Disk, so doing this will increase the space available on Yandex Disk.

To delete a specific file from Trash, you can specify its path in a delete request.


## Request format {#format}

Use the DELETE method to send the delete request. If the request doesn't indicate a specific resource, Trash is cleared completely.
```
https://cloud-api.yandex.net/v1/disk/trash/resources
 ? [[path](*popup-path)=<path to the resource being deleted>]
```

path
: The path to the resource being deleted relative to the Trash root directory. For example, `%2Fbar%2Fphoto.png`. If this parameter isn't specified, Trash is emptied. <br>
  
  <!-- source: en/_includes/reference/parameters-warehouse/id-format/path-encoding.md -->
  The path in the parameter value should be encoded in URL format.
  <!-- endsource: en/_includes/reference/parameters-warehouse/id-format/path-encoding.md -->


## Response format {#response}

Emptying Trash may take some time. Depending on the operation status, the Yandex Disk server returns one of the two responses:

- If the request is processed without errors, the API returns the `204 No Content` code.

- If the operation has started but not yet finished, Yandex Disk returns the `202 Accepted` code.

   <!-- source: en/_includes/reference/public/id-save/asynch-explain.md -->
   Apps must track the [status of requested operations](https://yandex.ru/dev/disk-api/doc/en/reference/operations.md). Yandex Disk returns a link to the status of the requested operation within the [Link](https://yandex.ru/dev/disk-api/doc/en/reference/response-objects.md#link) object in the response body.
   <!-- endsource: en/_includes/reference/public/id-save/asynch-explain.md -->

   Sample response:

   ```json
   {
   "href": "https://cloud-api.yandex.net/v1/disk/operations?id=33ca7d03ab21ct41b4a40182e78d828a3f8b72cdb5f4c0e94cc4b1449a63a2fe",
   "method": "GET",
   "templated": false
   }
   ```

   {% include [link-table](../_includes/reference/response-objects/id-link/link-table.md) %}


<!-- source: en/_includes/reference/response-error.md -->
If the request caused an error, the relevant response code is returned, and the response body contains an [error description](https://yandex.ru/dev/disk-api/doc/en/reference/response-objects.md#error).
<!-- endsource: en/_includes/reference/response-error.md -->

[*popup-path]: The path to the resource being deleted relative to the Trash root directory. For example, `%2Fbar%2Fphoto.png`. If this parameter isn't specified, Trash is emptied. <br>
  
  
The path in the parameter value should be encoded in URL format.
{% included (../_includes/reference/response-objects/id-link/link-table.md) %}



#|
|| **Element** | **Description**||
|| `href` | URL. It may be a URL template. See the `templated` key. ||
|| `method` | The HTTP method for requesting the URL from the `href` key. ||
|| `templated` | Indicates a URL template according to [RFC 6570](http://tools.ietf.org/html/rfc6570). Possible values:

- "true" — URL template. To send a request to this address, replace the placeholder values in the curly brackets with the parameter values.
- "false" — The URL can be requested without changes.||
   |#


{% endincluded %}