> 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`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # DeleteFolder # Package: sites # Namespace: SiteFoldersServiceV2 # Method link: https://dev.wix.com/docs/api-reference/account-level/sites/site-folders/delete-folder.md ## Introduction Deletes a folder and moves its content to the parent folder (or to root level if no parent folder exists). > **Important**: You can only call this method when authenticated as a Wix user or by using an account level API key. --- ## REST API ### Schema ``` Method: deleteFolder Description: Deletes a folder and moves its content to the parent folder (or to root level if no parent folder exists). > **Important**: You can only call this method when authenticated as a Wix user or by using an account level API key. URL: https://www.wixapis.com/site-folders/v2/folders/{id} Method: DELETE # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: id Method parameters: param name: id | type: none | required: true Return type: Empty EMPTY-OBJECT {} Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: folder_not_found | Description: Couldn't find the specified folder. ``` ### Examples ### DeleteFolder ```curl curl -X DELETE 'https://www.wixapis.com/site-folders/v2/folders/6af5d704-e949-4ca0-a646-08f5c25bfb64' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json, text/plain, */*' \ -H 'Authorization: ' \ -H 'wix-account-id: c07eba20-d970-49af-8a6b-c60e0741d876' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.sites.SiteFoldersServiceV2.deleteFolder(_id) Description: Deletes a folder and moves its content to the parent folder (or to root level if no parent folder exists). > **Important**: You can only call this method when authenticated as a Wix user or by using an account level API key. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: _id Method parameters: param name: _id | type: string | description: Folder GUID. | required: true Return type: PROMISE EMPTY-OBJECT {} Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: folder_not_found | Description: Couldn't find the specified folder. ``` ### Examples ### deleteFolder ```javascript import { siteFolders } from '@wix/sites'; async function deleteFolder(_id) { const response = await siteFolders.deleteFolder(_id); }; ``` ### deleteFolder (with elevated permissions) ```javascript import { siteFolders } from '@wix/sites'; import { auth } from '@wix/essentials'; async function myDeleteFolderMethod(_id) { const elevatedDeleteFolder = auth.elevate(siteFolders.deleteFolder); const response = await elevatedDeleteFolder(_id); } ``` ### deleteFolder (self-hosted) Self-hosted 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 { siteFolders } from '@wix/sites'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { siteFolders }, // Include the auth strategy and host as relevant }); async function deleteFolder(_id) { const response = await myWixClient.siteFolders.deleteFolder(_id); }; ``` ---