> 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 # MoveSitesToFolder # Package: sites # Namespace: SiteFoldersServiceV2 # Method link: https://dev.wix.com/docs/api-reference/account-level/sites/site-folders/move-sites-to-folder.md ## Introduction Moves sites into a specific folder/root. Limited to 500 sites per request. > **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: moveSitesToFolder Description: Moves sites into a specific folder/root. Limited to 500 sites per request. > **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/bulk/sites/move Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: sites Method parameters: param name: sites | type: sites | description: Sites to move. Currently supports only site GUIDs and is limited to 500 sites. For example: `{ "id": { "$in": ["", "", ...] } }`. | required: true param name: targetFolderId | type: targetFolderId | description: Folder GUID. Empty when moving sites to root level. Return type: Empty EMPTY-OBJECT {} Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: malformed_filter | Description: The filter is malformed. Check the filter syntax and try again. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: invalid_move_spec | Description: The move specification is invalid. Ensure you're providing valid site GUIDs and a valid target folder GUID. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: metasite_ids_count_exceeded | Description: The number of site GUIDs exceeds the server's limit of 500 sites. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: folder_not_found | Description: Couldn't find the specified folder. ``` ### Examples ### MoveSitesToFolder ```curl curl -X POST 'https://www.wixapis.com/site-folders/v2/folders/bulk/sites/move' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json, text/plain, */*' \ -H 'Authorization: ' \ -H 'wix-account-id: 4eef80de-db78-465c-8f30-96004676c394' \ -d '{ "targetFolderId": "5a8a82cc-0246-4ed9-ba15-cd4653e8267a", "sites":{"id":{"$in":["f8bdbb86-a472-4de2-8300-0d5386525639"]}}} ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.sites.SiteFoldersServiceV2.moveSitesToFolder(options) Description: Moves sites into a specific folder/root. Limited to 500 sites per request. > **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: options.sites, options Method parameters: param name: options | type: MoveSitesToFolderOptions none | required: true - name: targetFolderId | type: string | description: Folder GUID. Empty when moving sites to root level. - name: sites | type: object | description: Sites to move. Currently supports only site GUIDs and is limited to 500 sites. For example: `{ "id": { "$in": ["", "", ...] } }`. | required: true Return type: PROMISE EMPTY-OBJECT {} Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: malformed_filter | Description: The filter is malformed. Check the filter syntax and try again. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: invalid_move_spec | Description: The move specification is invalid. Ensure you're providing valid site GUIDs and a valid target folder GUID. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: metasite_ids_count_exceeded | Description: The number of site GUIDs exceeds the server's limit of 500 sites. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: folder_not_found | Description: Couldn't find the specified folder. ``` ### Examples ### moveSitesToFolder ```javascript import { siteFolders } from '@wix/sites'; async function moveSitesToFolder(options) { const response = await siteFolders.moveSitesToFolder(options); }; ``` ### moveSitesToFolder (with elevated permissions) ```javascript import { siteFolders } from '@wix/sites'; import { auth } from '@wix/essentials'; async function myMoveSitesToFolderMethod(options) { const elevatedMoveSitesToFolder = auth.elevate(siteFolders.moveSitesToFolder); const response = await elevatedMoveSitesToFolder(options); } ``` ### moveSitesToFolder (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 moveSitesToFolder(options) { const response = await myWixClient.siteFolders.moveSitesToFolder(options); }; ``` ---