> 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 # GetFolderBySite # Package: sites # Namespace: SiteFoldersServiceV2 # Method link: https://dev.wix.com/docs/api-reference/account-level/sites/site-folders/get-folder-by-site.md ## Introduction Returns data about the folder that contains the specified site. > **Note**: If the specified site is root level, the returned folder object will be empty. > **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: getFolderBySite Description: Returns data about the folder that contains the specified site. > **Note**: If the specified site is root level, the returned folder object will be empty. > **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/sites/{siteId} Method: GET # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: siteId Method parameters: param name: siteId | type: none | required: true Return type: GetFolderBySiteResponse - name: folder | type: Folder | description: Folder containing the specified site. Empty if site is at root level. - name: id | type: string | description: Folder GUID. - name: name | type: string | description: Folder name. - name: createdDate | type: string | description: Date the folder was created. - name: updatedDate | type: string | description: Date the folder was last updated. - name: siteCount | type: integer | description: Number of sites in the folder. - name: parentId | type: string | description: Parent folder GUID. When empty, the site is at root level. - name: path | type: array | description: Path including all parent folders from root to the current folder, in order. When empty, the site or folder is at root level. - name: id | type: string | description: Folder GUID. - name: name | type: string | description: Folder name. ``` ### Examples ### GetFolderBySite ```curl curl 'https://www.wixapis.com/site-folders/v2/folders/sites/a1c0588c-82dd-4f33-b0a4-a94ff2f9117a' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json, text/plain, */*' \ -H 'Authorization: ' \ -H 'wix-account-id: 151fa8fd-7011-4361-8e88-3f0a3adde032' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.sites.SiteFoldersServiceV2.getFolderBySite(siteId) Description: Returns data about the folder that contains the specified site. > **Note**: If the specified site is root level, the returned folder object will be empty. > **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: siteId Method parameters: param name: siteId | type: string | description: Site GUID. | required: true Return type: PROMISE - name: folder | type: Folder | description: Folder containing the specified site. Empty if site is at root level. - name: _id | type: string | description: Folder GUID. - name: name | type: string | description: Folder name. - name: _createdDate | type: Date | description: Date the folder was created. - name: _updatedDate | type: Date | description: Date the folder was last updated. - name: siteCount | type: integer | description: Number of sites in the folder. - name: parentId | type: string | description: Parent folder GUID. When empty, the site is at root level. - name: path | type: array | description: Path including all parent folders from root to the current folder, in order. When empty, the site or folder is at root level. - name: _id | type: string | description: Folder GUID. - name: name | type: string | description: Folder name. ``` ### Examples ### getFolderBySite ```javascript import { siteFolders } from '@wix/sites'; async function getFolderBySite(siteId) { const response = await siteFolders.getFolderBySite(siteId); }; ``` ### getFolderBySite (with elevated permissions) ```javascript import { siteFolders } from '@wix/sites'; import { auth } from '@wix/essentials'; async function myGetFolderBySiteMethod(siteId) { const elevatedGetFolderBySite = auth.elevate(siteFolders.getFolderBySite); const response = await elevatedGetFolderBySite(siteId); } ``` ### getFolderBySite (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 getFolderBySite(siteId) { const response = await myWixClient.siteFolders.getFolderBySite(siteId); }; ``` ---