> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# ListDeletedFiles

# Package: mediaManager

# Namespace: FilesService

# Method link: https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/list-deleted-files.md

## Permission Scopes:
Read Media Manager: SCOPE.DC-MEDIA.READ-MEDIAMANAGER

## Introduction

Retrieves a list of files in the Media Manager's trash bin. <br/>

>**Note:** The Media Manager's trash bin (`TRASH-ROOT` folder) only contains temporarily deleted files, not permanently deleted files.

---

## REST API

### Schema

```
 Method: listDeletedFiles
 Description: Retrieves a list of files in the Media Manager's trash bin. <br/>  >**Note:** The Media Manager's trash bin (`TRASH-ROOT` folder) only contains temporarily deleted files, not permanently deleted files.
 URL: https://www.wixapis.com/site-media/v1/trash-bin/files
 Method: GET
 Method parameters:
   query param name: mediaTypes | type: array<mediaTypes> | description: File media type.  | validation: maxItems 30
                 - enum:
                 -     UNKNOWN: Unknown media type.
                 -     IMAGE: Image file, such as JPEG or PNG.
                 -     VIDEO: Video file.
                 -     AUDIO: Audio file.
                 -     DOCUMENT: Document file, such as PDF.
                 -     VECTOR: Vector image file, such as SVG.
                 -     ARCHIVE: Archive file, such as ZIP.
                 -     MODEL3D: 3D model file.
                 -     OTHER: Any other file type.
   param name: paging | type: CursorPaging    
        - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
   query param name: parentFolderId | type: parentFolderId | description: GUID of the file's parent folder. <br /> Default: `media-root`.  | validation: maxLength 100
   query param name: private | type: private | description: Whether to return only private or only public files. + `true`: Returns only private files. + `false`: Returns only public files. + `undefined`: Returns public and private files.  Learn more [about private files](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/private-files.md).  
   param name: sort | type: Sorting    
        - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
        - name: order | type: SortOrder | description: Sort order.  
             - enum: ASC, DESC
        - name: origin | type: AddressLocation | description: Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).  
           - name: latitude | type: number | description: Address latitude.  | validation: format double
           - name: longitude | type: number | description: Address longitude.  | validation: format double
 Return type: ListDeletedFilesResponse
  - name: files | type: array<FileDescriptor> | description: List of files in the Media Manager's trash bin.  | validation: maxItems 200
     - name: id | type: string | description: File GUID. Generated when a file is uploaded to the Media Manager.  | read-only: true | validation: maxLength 1000
     - name: displayName | type: string | description: File name as it appears in the Media Manager.  | validation: maxLength 255
     - name: url | type: string | description: Static URL of the file.  | read-only: true | validation: format WEB_URL
     - name: parentFolderId | type: string | description: GUID of the file's parent folder.  | validation: maxLength 100
     - name: hash | type: string | description: File hash.  | read-only: true | validation: maxLength 100
     - name: sizeInBytes | type: string | description: Size of the uploaded file in bytes.  | read-only: true | validation: format DECIMAL_VALUE, decimalValue {"maxScale":0}
     - name: private | type: boolean | description: Whether the file is public or private. Learn more about [private files](https://dev.wix.com/docs/rest/assets/media/media-manager/files/private-files.md).  | read-only: true 
     - name: mediaType | type: MediaType | description: Media file type.  | read-only: true 
         - enum:
         -     UNKNOWN: Unknown media type.
         -     IMAGE: Image file, such as JPEG or PNG.
         -     VIDEO: Video file.
         -     AUDIO: Audio file.
         -     DOCUMENT: Document file, such as PDF.
         -     VECTOR: Vector image file, such as SVG.
         -     ARCHIVE: Archive file, such as ZIP.
         -     MODEL3D: 3D model file.
         -     OTHER: Any other file type.
     - name: media | type: FileMedia | description: Media-type-specific metadata, such as an image's dimensions or a video's available resolutions. The relevant property is populated according to the file's `mediaType`.  | read-only: true 
        - ONE-OF: 
           - name: image | type: ImageMedia | description: Information about the image.  
              - name: image | type: Image | description: Image data.  
                 - name: id | type: string | description: WixMedia image GUID.  
                 - name: url | type: string | description: Image URL.  
                 - name: height | type: integer | description: Original image height.  | read-only: true 
                 - name: width | type: integer | description: Original image width.  | read-only: true 
                 - name: altText | type: string | description: Image alt text.  
                 - name: filename | type: string | description: Image filename.  | read-only: true 
              - name: colors | type: Colors | description: Image colors.  
                 - name: prominent | type: Color | description: Main color of the image.  
                    - name: hex | type: string | description: HEX color.  | validation: format COLOR_HEX
                    - name: rgb | type: ColorRGB | description: RGB color.  
                       - name: r | type: integer | description: Red channel.  | validation: minimum 0, maximum 255, format int32
                       - name: g | type: integer | description: Green channel.  | validation: minimum 0, maximum 255, format int32
                       - name: b | type: integer | description: Blue channel.  | validation: minimum 0, maximum 255, format int32
                 - name: palette | type: array<Color> | description: Color palette of the image.  | validation: maxItems 100
              - name: faces | type: array<FaceRecognition> | description: Information about faces in the image. Use to crop images without cutting out faces.  | validation: maxItems 100
                 - name: confidence | type: number | description: The accuracy percentage of the face recognition. The likelihood that a face is detected.  
                 - name: x | type: integer | description: Top left x pixel coordinate of the face.  
                 - name: y | type: integer | description: Top left y pixel coordinate of the face.  
                 - name: height | type: integer | description: Face pixel height.  
                 - name: width | type: integer | description: Face pixel width.  
              - name: previewImage | type: Image | description: Information about the image preview. You can use this to display a preview for private images.  
              - name: caption | type: string | description: Optional, An AI generated description of the image  | read-only: true | validation: maxLength 300
           - name: video | type: VideoV2 | description: Information about the video.  
              - name: id | type: string | description: WixMedia GUID.  
              - name: resolutions | type: array<VideoResolution> | description: Available resolutions for the video, starting with the optimal resolution.  | read-only: true | validation: maxItems 100
                 - name: url | type: string | description: Video URL.  
                 - name: height | type: integer | description: Video height.  
                 - name: width | type: integer | description: Video width.  
                 - name: format | type: string | description: Video format Possible values: ['144p.mp4' '144p.webm' '240p.mp4' '240p.webm' '360p.mp4' '360p.webm' '480p.mp4' '480p.webm' '720p.mp4' '720p.webm' '1080p.mp4' '1080p.webm', 'hls' ]  
              - name: filename | type: string | description: Video filename.  | read-only: true 
           - name: audio | type: AudioV2 | description: Information about the audio.  
              - name: id | type: string | description: WixMedia GUID.  | validation: maxLength 200
              - name: assets | type: array<Audio> | description: Audio formats available for this file.  | validation: maxItems 100
                 - name: id | type: string | description: WixMedia GUID.  
                 - name: url | type: string | description: Audio URL.  
                 - name: filename | type: string | description: Audio filename.  | read-only: true 
              - name: bitrate | type: integer | description: Audio bitrate.  | read-only: true | validation: minimum 0, format int32
              - name: format | type: string | description: Audio format.  | read-only: true | validation: maxLength 100
              - name: duration | type: integer | description: Audio duration in seconds.  | read-only: true | validation: minimum 0, format int32
              - name: sizeInBytes | type: string | description: Audio size in bytes.  | read-only: true | validation: format DECIMAL_VALUE, decimalValue {"maxScale":0}
           - name: document | type: Document | description: Information about the document.  
              - name: id | type: string | description: WixMedia GUID.  
              - name: url | type: string | description: Document URL.  
              - name: filename | type: string | description: Document filename.  
           - name: vector | type: ImageMedia | description: Information about the vector.  
           - name: archive | type: Archive | description: Information about the archive.  
              - name: id | type: string | description: WixMedia GUID.  
              - name: url | type: string | description: Archive URL.  
              - name: urlExpirationDate | type: string | description: Archive URL expiration date (when relevant).  | read-only: true | validation: format date-time
              - name: sizeInBytes | type: string | description: Archive size in bytes.  | validation: format DECIMAL_VALUE
              - name: filename | type: string | description: Archive filename.  
           - name: model3d | type: Model3D | description: Information about the 3D Model.  
              - name: id | type: string | description: WixMedia 3D GUID.  
              - name: url | type: string | description: 3D URL.  
              - name: thumbnail | type: Image | description: 3D thumbnail Image  
              - name: altText | type: string | description: 3D alt text.  
              - name: urlExpirationDate | type: string | description: 3D URL expiration date (when relevant).  | read-only: true | validation: format date-time
              - name: filename | type: string | description: 3D filename.  | read-only: true 
              - name: sizeInBytes | type: string | description: 3D size in bytes.  | read-only: true | validation: format DECIMAL_VALUE
     - name: operationStatus | type: OperationStatus | description: Status of the file that was uploaded.  | read-only: true 
         - enum:
         -     FAILED: The file failed to upload, for example, during media post processing.
         -     READY: The file uploaded, finished all processing, and is ready for use.
         -     PENDING: The file is processing and the URLs are not yet available. This response is returned when importing a file.
     - name: sourceUrl | type: string | description: URL where the file was uploaded from.  | read-only: true | validation: format WEB_URL
     - name: thumbnailUrl | type: string | description: URL of the file's thumbnail.  | read-only: true | validation: format WEB_URL
     - name: labels | type: array<string> | description: Labels assigned to media files that describe and categorize them. Provided by the Wix user, or generated by [Google Vision API](https://cloud.google.com/vision/docs/drag-and-drop) for images.  | validation: maxItems 100, maxLength 200
     - name: createdDate | type: string | description: Date and time the file was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the file was updated.  | read-only: true | validation: format date-time
     - name: siteId | type: string | description: The Wix site GUID where the media file is stored.  | read-only: true | validation: maxLength 100
     - name: state | type: State | description: State of the file.  | read-only: true 
         - enum:
         -     OK: File is ready for consumption
         -     DELETED: Deleted file
  - name: nextCursor | type: PagingMetadataV2 | description: The next cursor if it exists.  
     - name: total | type: integer | description: Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_SORT_VALUE | Description: Sort value isn't supported.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_MEDIA_TYPE | Description: Media type isn't supported for filtering.


```

### Examples

### List files in the Media Manager's trash bin
This example sorts by `updatedDate` in `DESC` order with a paging limit of 2.

```curl
curl -X GET \
  'https://www.wixapis.com/site-media/v1/trash-bin/files?sort.fieldName=updatedDate&sort.order=DESC&paging.limit=2' \
  -H 'Authorization: <AUTH>'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.media.files.listDeletedFiles(options)
 Description: Retrieves a list of files in the Media Manager's trash bin. <br/>  >**Note:** The Media Manager's trash bin (`TRASH-ROOT` folder) only contains temporarily deleted files, not permanently deleted files.
 Method parameters:
   param name: options | type: ListDeletedFilesOptions  none  
        - name: parentFolderId | type: string | description: GUID of the file's parent folder. <br /> Default: `media-root`.  | validation: maxLength 100
        - name: mediaTypes | type: array<MediaType> | description: File media type.  | validation: maxItems 30
             - enum:
             -     UNKNOWN: Unknown media type.
             -     IMAGE: Image file, such as JPEG or PNG.
             -     VIDEO: Video file.
             -     AUDIO: Audio file.
             -     DOCUMENT: Document file, such as PDF.
             -     VECTOR: Vector image file, such as SVG.
             -     ARCHIVE: Archive file, such as ZIP.
             -     MODEL3D: 3D model file.
             -     OTHER: Any other file type.
        - name: private | type: boolean | description: Whether to return only private or only public files. + `true`: Returns only private files. + `false`: Returns only public files. + `undefined`: Returns public and private files.  Learn more [about private files](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/private-files.md).  
        - name: sort | type: Sorting | description: Field name and order to sort by. One of: <br /> * `displayName` * `updatedDate` * `sizeInBytes` Default: `updatedDate` in `desc` order.  
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
           - name: origin | type: AddressLocation | description: Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).  
              - name: latitude | type: number | description: Address latitude.  
              - name: longitude | type: number | description: Address longitude.  
        - name: paging | type: CursorPaging | description: Cursor and paging information.  
           - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
           - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
 Return type: PROMISE<ListDeletedFilesResponse>
  - name: files | type: array<FileDescriptor> | description: List of files in the Media Manager's trash bin.  | validation: maxItems 200
     - name: _id | type: string | description: File GUID. Generated when a file is uploaded to the Media Manager.  | read-only: true | validation: maxLength 1000
     - name: displayName | type: string | description: File name as it appears in the Media Manager.  | validation: maxLength 255
     - name: url | type: string | description: Static URL of the file.  | read-only: true | validation: format WEB_URL
     - name: parentFolderId | type: string | description: GUID of the file's parent folder.  | validation: maxLength 100
     - name: hash | type: string | description: File hash.  | read-only: true | validation: maxLength 100
     - name: sizeInBytes | type: string | description: Size of the uploaded file in bytes.  | read-only: true | validation: format DECIMAL_VALUE, decimalValue {"maxScale":0}
     - name: private | type: boolean | description: Whether the file is public or private. Learn more about [private files](https://dev.wix.com/docs/rest/assets/media/media-manager/files/private-files.md).  | read-only: true 
     - name: mediaType | type: MediaType | description: Media file type.  | read-only: true 
         - enum:
         -     UNKNOWN: Unknown media type.
         -     IMAGE: Image file, such as JPEG or PNG.
         -     VIDEO: Video file.
         -     AUDIO: Audio file.
         -     DOCUMENT: Document file, such as PDF.
         -     VECTOR: Vector image file, such as SVG.
         -     ARCHIVE: Archive file, such as ZIP.
         -     MODEL3D: 3D model file.
         -     OTHER: Any other file type.
     - name: media | type: FileMedia | description: Media-type-specific metadata, such as an image's dimensions or a video's available resolutions. The relevant property is populated according to the file's `mediaType`.  | read-only: true 
        - ONE-OF: 
           - name: image | type: ImageMedia | description: Information about the image.  
              - name: image | type: string | description: Image data.  
              - name: colors | type: Colors | description: Image colors.  
                 - name: prominent | type: Color | description: Main color of the image.  
                    - name: hex | type: string | description: HEX color.  | validation: format COLOR_HEX
                    - name: rgb | type: ColorRGB | description: RGB color.  
                       - name: r | type: integer | description: Red channel.  | validation: minimum 0, maximum 255, format int32
                       - name: g | type: integer | description: Green channel.  | validation: minimum 0, maximum 255, format int32
                       - name: b | type: integer | description: Blue channel.  | validation: minimum 0, maximum 255, format int32
                 - name: palette | type: array<Color> | description: Color palette of the image.  | validation: maxItems 100
              - name: faces | type: array<FaceRecognition> | description: Information about faces in the image. Use to crop images without cutting out faces.  | validation: maxItems 100
                 - name: confidence | type: number | description: The accuracy percentage of the face recognition. The likelihood that a face is detected.  
                 - name: x | type: integer | description: Top left x pixel coordinate of the face.  
                 - name: y | type: integer | description: Top left y pixel coordinate of the face.  
                 - name: height | type: integer | description: Face pixel height.  
                 - name: width | type: integer | description: Face pixel width.  
              - name: previewImage | type: string | description: Information about the image preview. You can use this to display a preview for private images.  
              - name: caption | type: string | description: Optional, An AI generated description of the image  | read-only: true | validation: maxLength 300
           - name: video | type: string | description: Information about the video.  
           - name: audio | type: AudioV2 | description: Information about the audio.  
              - name: _id | type: string | description: WixMedia GUID.  | validation: maxLength 200
              - name: assets | type: array<string> | description: Audio formats available for this file.  | validation: maxItems 100
              - name: bitrate | type: integer | description: Audio bitrate.  | read-only: true | validation: minimum 0, format int32
              - name: format | type: string | description: Audio format.  | read-only: true | validation: maxLength 100
              - name: duration | type: integer | description: Audio duration in seconds.  | read-only: true | validation: minimum 0, format int32
              - name: sizeInBytes | type: string | description: Audio size in bytes.  | read-only: true | validation: format DECIMAL_VALUE, decimalValue {"maxScale":0}
           - name: document | type: string | description: Information about the document.  
           - name: vector | type: ImageMedia | description: Information about the vector.  
           - name: archive | type: Archive | description: Information about the archive.  
              - name: _id | type: string | description: WixMedia GUID.  
              - name: url | type: string | description: Archive URL.  
              - name: urlExpirationDate | type: Date | description: Archive URL expiration date (when relevant).  | read-only: true 
              - name: sizeInBytes | type: string | description: Archive size in bytes.  | validation: format DECIMAL_VALUE
              - name: filename | type: string | description: Archive filename.  
           - name: model3d | type: Model3D | description: Information about the 3D Model.  
              - name: _id | type: string | description: WixMedia 3D GUID.  
              - name: url | type: string | description: 3D URL.  
              - name: thumbnail | type: string | description: 3D thumbnail Image  
              - name: altText | type: string | description: 3D alt text.  
              - name: urlExpirationDate | type: Date | description: 3D URL expiration date (when relevant).  | read-only: true 
              - name: filename | type: string | description: 3D filename.  | read-only: true 
              - name: sizeInBytes | type: string | description: 3D size in bytes.  | read-only: true | validation: format DECIMAL_VALUE
     - name: operationStatus | type: OperationStatus | description: Status of the file that was uploaded.  | read-only: true 
         - enum:
         -     FAILED: The file failed to upload, for example, during media post processing.
         -     READY: The file uploaded, finished all processing, and is ready for use.
         -     PENDING: The file is processing and the URLs are not yet available. This response is returned when importing a file.
     - name: sourceUrl | type: string | description: URL where the file was uploaded from.  | read-only: true | validation: format WEB_URL
     - name: thumbnailUrl | type: string | description: URL of the file's thumbnail.  | read-only: true | validation: format WEB_URL
     - name: labels | type: array<string> | description: Labels assigned to media files that describe and categorize them. Provided by the Wix user, or generated by [Google Vision API](https://cloud.google.com/vision/docs/drag-and-drop) for images.  | validation: maxItems 100, maxLength 200
     - name: _createdDate | type: Date | description: Date and time the file was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the file was updated.  | read-only: true 
     - name: siteId | type: string | description: The Wix site GUID where the media file is stored.  | read-only: true | validation: maxLength 100
     - name: state | type: State | description: State of the file.  | read-only: true 
         - enum:
         -     OK: File is ready for consumption
         -     DELETED: Deleted file
  - name: nextCursor | type: PagingMetadataV2 | description: The next cursor if it exists.  
     - name: total | type: integer | description: Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_SORT_VALUE | Description: Sort value isn't supported.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_MEDIA_TYPE | Description: Media type isn't supported for filtering.


```

### Examples

### Bulk restores all non-permanently deleted files of chosen types (with $w)
This code is an example of a page on which a visitor chooses a media type (or types). All files of that type/those types in which have been (non-permanently) deleted are restored.

```javascript
/***********************************************
 * Backend code - bulk-restore-files.web.js/ts *
 **********************************************/
import { Permissions, webMethod } from '@wix/web-methods';
import { files } from '@wix/media';
import { auth } from '@wix/essentials';

export const restoreFiles = webMethod(Permissions.Anyone, async (mediaTypes) => {
  let idList = []
  try {
    const options = {
        mediaTypes: mediaTypes
    };
    const elevatedListDeletedFiles = auth.elevate(files.listDeletedFiles)
    const deletedFiles = await elevatedListDeletedFiles(options);

    idList = deletedFiles.files.map((file) => {
     return file._id
    });
  } catch (error) {
    console.error(error);
  }

  try {
    const elevatedBulkRestoreFilesFromTrashBin = auth.elevate(files.bulkRestoreFilesFromTrashBin);
    const restoredFiles = await elevatedBulkRestoreFilesFromTrashBin(idList);

    console.log('Restored Files:', restoredFiles);
    return restoredFiles;
  } catch (error) {
    console.error(error);
  }
});

/*************
 * Page code *
 ************/

import { restoreFiles } from 'backend/bulk-restore-files.web';

$w.onReady(() => {
  $w('#restoreMedia').onClick(async () => {
    const mediaTypes = []
    if ($w('#image').checked) {
        mediaTypes.push("IMAGE")
    }
    if ($w('#video').checked) {
        mediaTypes.push("VIDEO")
    }
    if ($w('#audio').checked) {
        mediaTypes.push("AUDIO")
    }
    if ($w('#document').checked) {
        mediaTypes.push("DOCUMENT")
    }
    if ($w('#vector').checked) {
        mediaTypes.push("VECTOR")
    }
    if ($w('#archive').checked) {
        mediaTypes.push("ARCHIVE")
    }
    if ($w('#model3d').checked) {
        mediaTypes.push("MODEL3D")
    }
    await restoreFiles(mediaTypes);

    $w('#filesRestoredMsg').show();
    setTimeout(() => {
      $w('#filesRestoredMsg').hide();
    }, 5000);
  });
});

```

### List deleted files (with elevated permissions)
```javascript
import { files } from '@wix/media';
import { auth } from '@wix/essentials';

const elevatedListDeletedFiles = auth.elevate(files.listDeletedFiles);

async function myListDeletedFilesFunction() {
  try {
    const deletedFiles = await elevatedListDeletedFiles();

    console.log('Files in trash:', deletedFiles)
    return deletedFiles;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

/* Promise resolves to:
 * {
 *   "files": [
 *     {
 *       "_createdDate": "2023-08-09T08:45:42.000Z",
 *       "_id": "d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png",
 *       "_updatedDate": "2023-08-09T08:45:42.000Z",
 *       "displayName": "image1.png",
 *       "hash": "864d607a1ea270efbac32def181f039f",
 *       "internalTags": [
 *         "_fileOrigin_uploaded"
 *       ],
 *       "labels": [],
 *       "media": {
 *         "image": {
 *           "colors": {
 *             "palette": [
 *               {
 *                 "rgb": {
 *                   "b": 247,
 *                   "g": 247,
 *                   "r": 247
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 142,
 *                   "g": 140,
 *                   "r": 140
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 192,
 *                   "g": 218,
 *                   "r": 141
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 195,
 *                   "g": 137,
 *                   "r": 149
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 228,
 *                   "g": 143,
 *                   "r": 183
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 250,
 *                   "g": 62,
 *                   "r": 152
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 16,
 *                   "g": 16,
 *                   "r": 16
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 140,
 *                   "g": 199,
 *                   "r": 60
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 120,
 *                   "g": 194,
 *                   "r": 242
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 158,
 *                   "g": 203,
 *                   "r": 103
 *                 }
 *               }
 *             ],
 *             "prominent": {
 *               "rgb": {
 *                 "b": 247,
 *                 "g": 247,
 *                 "r": 247
 *               }
 *             }
 *           },
 *           "faces": [],
 *           "image": "wix:image://v1/d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png/image1.png#originWidth=1170&originHeight=2532"
 *         }
 *       },
 *       "mediaType": "IMAGE",
 *       "operationStatus": "READY",
 *       "parentFolderId": "trash-root",
 *       "private": false,
 *       "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
 *       "sizeInBytes": "394945",
 *       "state": "OK",
 *       "thumbnailUrl": "https://static.wixstatic.com/media/d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png",
 *       "url": "https://static.wixstatic.com/media/d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png"
 *     },
 *     {
 *       "_createdDate": "2023-08-09T08:45:37.000Z",
 *       "_id": "d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg",
 *       "_updatedDate": "2023-08-09T08:45:37.000Z",
 *       "displayName": "vectorArt1.svg",
 *       "hash": "e379083c3675d7f7891da00c0708539c",
 *       "internalTags": [
 *         "_fileOrigin_uploaded"
 *       ],
 *       "labels": [],
 *       "media": {
 *         "image": {
 *           "faces": [],
 *           "image": "wix:image://v1/d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg/vectorArt1.svg#originWidth=1177&originHeight=2501"
 *         }
 *       },
 *       "mediaType": "VECTOR",
 *       "operationStatus": "READY",
 *       "parentFolderId": "trash-root",
 *       "private": false,
 *       "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
 *       "sizeInBytes": "119475",
 *       "state": "OK",
 *       "thumbnailUrl": "https://static.wixstatic.com/shapes/d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg",
 *       "url": "https://static.wixstatic.com/shapes/d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg"
 *     }
 *   ],
 *   "nextCursor": {
 *     "cursors": {
 *       "next": ""
 *     },
 *     "hasNext": false
 *   }
 * }
 */
```

### List deleted files
```javascript
import { files } from '@wix/media';

async function myListDeletedFilesFunction() {
  try {
    const deletedFiles = await files.listDeletedFiles();

    console.log('Files in trash:', deletedFiles)
    return deletedFiles;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

/* Promise resolves to:
 * {
 *   "files": [
 *     {
 *       "_createdDate": "2023-08-09T08:45:42.000Z",
 *       "_id": "d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png",
 *       "_updatedDate": "2023-08-09T08:45:42.000Z",
 *       "displayName": "image1.png",
 *       "hash": "864d607a1ea270efbac32def181f039f",
 *       "internalTags": [
 *         "_fileOrigin_uploaded"
 *       ],
 *       "labels": [],
 *       "media": {
 *         "image": {
 *           "colors": {
 *             "palette": [
 *               {
 *                 "rgb": {
 *                   "b": 247,
 *                   "g": 247,
 *                   "r": 247
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 142,
 *                   "g": 140,
 *                   "r": 140
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 192,
 *                   "g": 218,
 *                   "r": 141
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 195,
 *                   "g": 137,
 *                   "r": 149
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 228,
 *                   "g": 143,
 *                   "r": 183
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 250,
 *                   "g": 62,
 *                   "r": 152
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 16,
 *                   "g": 16,
 *                   "r": 16
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 140,
 *                   "g": 199,
 *                   "r": 60
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 120,
 *                   "g": 194,
 *                   "r": 242
 *                 }
 *               },
 *               {
 *                 "rgb": {
 *                   "b": 158,
 *                   "g": 203,
 *                   "r": 103
 *                 }
 *               }
 *             ],
 *             "prominent": {
 *               "rgb": {
 *                 "b": 247,
 *                 "g": 247,
 *                 "r": 247
 *               }
 *             }
 *           },
 *           "faces": [],
 *           "image": "wix:image://v1/d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png/image1.png#originWidth=1170&originHeight=2532"
 *         }
 *       },
 *       "mediaType": "IMAGE",
 *       "operationStatus": "READY",
 *       "parentFolderId": "trash-root",
 *       "private": false,
 *       "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
 *       "sizeInBytes": "394945",
 *       "state": "OK",
 *       "thumbnailUrl": "https://static.wixstatic.com/media/d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png",
 *       "url": "https://static.wixstatic.com/media/d4dde1_32288e20a5aa4213a52b15426fb27c9f~mv2.png"
 *     },
 *     {
 *       "_createdDate": "2023-08-09T08:45:37.000Z",
 *       "_id": "d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg",
 *       "_updatedDate": "2023-08-09T08:45:37.000Z",
 *       "displayName": "vectorArt1.svg",
 *       "hash": "e379083c3675d7f7891da00c0708539c",
 *       "internalTags": [
 *         "_fileOrigin_uploaded"
 *       ],
 *       "labels": [],
 *       "media": {
 *         "image": {
 *           "faces": [],
 *           "image": "wix:image://v1/d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg/vectorArt1.svg#originWidth=1177&originHeight=2501"
 *         }
 *       },
 *       "mediaType": "VECTOR",
 *       "operationStatus": "READY",
 *       "parentFolderId": "trash-root",
 *       "private": false,
 *       "siteId": "3ecba886-4267-11ee-be56-0242ac120002",
 *       "sizeInBytes": "119475",
 *       "state": "OK",
 *       "thumbnailUrl": "https://static.wixstatic.com/shapes/d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg",
 *       "url": "https://static.wixstatic.com/shapes/d4dde1_8dd2bfe6121f43b29ebeaa63988abf54.svg"
 *     }
 *   ],
 *   "nextCursor": {
 *     "cursors": {
 *       "next": ""
 *     },
 *     "hasNext": false
 *   }
 * }
 */
```

### listDeletedFiles (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { files } from '@wix/media';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { files },
  // Include the auth strategy and host as relevant
});


async function listDeletedFiles(options) {
  const response = await myWixClient.files.listDeletedFiles(options);
};
```

---