> 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

# BulkRestoreFoldersFromTrashBin

# Package: mediaManager

# Namespace: FoldersService

# Method link: https://dev.wix.com/docs/api-reference/assets/media/media-manager/folders/bulk-restore-folders-from-trash-bin?apiView=SDK.md

## Permission Scopes:
Manage Media Manager: SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER

## Introduction

Restores the specified folders from the Media Manager's trash bin, and moves them to their original locations in the Media Manager.

---

## REST API

### Schema

```
 Method: bulkRestoreFoldersFromTrashBin
 Description: Restores the specified folders from the Media Manager's trash bin, and moves them to their original locations in the Media Manager.
 URL: https://www.wixapis.com/site-media/v1/bulk/trash-bin/folders/restore
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  folderIds
 Method parameters: 
   param name: folderIds | type: array<folderIds> | description: IDs of the folders to restore from the Media Manager's trash bin. | required: true | validation: maxItems 100, maxLength 100
 Return type: BulkRestoreFoldersFromTrashBinResponse
  EMPTY-OBJECT {}


```

### Examples

### Bulk restore deleted folders and their content
```curl
curl -X POST \
  'https://www.wixapis.com/site-media/v1/bulk/trash-bin/folders/restore' \
  -H 'Authorization: <AUTH>' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "folderIds": ["25284aa06584441ea94338fdcfbaba12", "9v38fdcfbaba12eeb55bcf5c41eca01c0"]
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.media.folders.bulkRestoreFoldersFromTrashBin(folderIds)
 Description: Restores the specified folders from the Media Manager's trash bin, and moves them to their original locations in the Media Manager.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  folderIds
 Method parameters: 
   param name: folderIds | type: array<string> | description: IDs of the folders to restore from the Media Manager's trash bin. | required: true | validation: maxItems 100, maxLength 100
 Return type: PROMISE<BulkRestoreFoldersFromTrashBinResponse>
  EMPTY-OBJECT {}


```

### Examples

### Bulk restore all folders from the trash bin (with $w)
```javascript
/********************************************
 * Backend code - restore-folders.web.js/ts *
 *******************************************/

import { Permissions, webMethod } from '@wix/web-methods';
import { folders } from '@wix/media';
import { auth } from '@wix/essentials';

export const restoreAllFolders = webMethod(Permissions.Anyone, async () => {
  try {
    const elevatedListDeletedFolders = auth.elevate(folders.listDeletedFolders);
    const deletedFolders = await elevatedListDeletedFolders();

    const deletedFolderIds = deletedFolders.folders.map((folder) => {
        return folder._id;
    });
      
    const elevatedBulkRestoreFoldersFromTrashBin = auth.elevate(folders.bulkRestoreFoldersFromTrashBin);
    const restoredFolders = await elevatedBulkRestoreFoldersFromTrashBin(deletedFolderIds);

    return restoredFolders;
  } catch (error) {
    console.error(error);
  }
});

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

import { restoreAllFolders } from 'backend/restore-folders.web';

$w.onReady(async () => {
  $w('#restoreAll').onClick(async () => {
    const restoredFolders = await restoreAllFolders();

    console.log('Restored all folders:', restoredFolders);
    $w('#bulkRestoreSuccessMsg').show();
  });
});

```

### Bulk restore (non-permanently deleted) folders (with elevated permissions)
```javascript
import { folders } from '@wix/media';
import { auth } from '@wix/essentials';

const elevatedBulkRestoreFoldersFromTrashBin = auth.elevate(folders.bulkRestoreFoldersFromTrashBin);

/* Sample folderIds value:
 * [
 *   'd4051a6890724365a78678a6208ac37e',
 *   '302fc049d70c41dea33fa4a27ab481ba'
 * ]
 */

async function myBulkRestoreFoldersFromTrashBinFunc(folderIds) {
  try {
    const restoredFolders = await elevatedBulkRestoreFoldersFromTrashBin(folderIds);

    console.log('Restored deleted folders:', restoredFolders);
    return restoredFolders;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

 /* Promise resolves to void */
```

### Bulk restore (non-permanently deleted) folders
```javascript
import { folders } from '@wix/media';

/* Sample folderIds value:
 * [
 *   'd4051a6890724365a78678a6208ac37e',
 *   '302fc049d70c41dea33fa4a27ab481ba'
 * ]
 */

async function myBulkRestoreFoldersFromTrashBinFunc(folderIds) {
  try {
    const restoredFolders = await folders.bulkRestoreFoldersFromTrashBin(folderIds);

    console.log('Restored deleted folders:', restoredFolders);
    return restoredFolders;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

 /* Promise resolves to void */
```

### bulkRestoreFoldersFromTrashBin (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 { folders } from '@wix/media';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function bulkRestoreFoldersFromTrashBin(folderIds) {
  const response = await myWixClient.folders.bulkRestoreFoldersFromTrashBin(folderIds);
};
```

---