> 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 # UpdateFolder # Package: sites # Namespace: SiteFoldersServiceV2 # Method link: https://dev.wix.com/docs/api-reference/account-level/sites/site-folders/update-folder.md ## Introduction Updates a folder. > **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: updateFolder Description: Updates a folder. > **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/{folder.id} Method: PATCH # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: folder.id Method parameters: param name: fieldMask | type: fieldMask | description: Set of fields to update. Example: `"fieldMask": "name"`. param name: folder | type: Folder - name: id | type: string | description: Folder GUID. | required: true - name: name | type: string | description: Folder name. - name: parentId | type: string | description: Parent folder GUID. When empty, the site is at root level. Return type: UpdateFolderResponse - name: folder | type: Folder | description: Folder data. - 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. Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: invalid_update_field | Description: The field you're trying to update can't be modified. HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: duplicate_folder_name | Description: There's already a folder with this name. ``` ### Examples ### UpdateFolder ```curl curl -X PATCH 'https://www.wixapis.com/site-folders/v2/folders/59c80b6f-9cae-49c5-ab0e-83b9a479c573' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json, text/plain, */*' \ -H 'Authorization: ' \ -H 'wix-account-id: ' -d '{"folder":{"id":"59c80b6f-9cae-49c5-ab0e-83b9a479c573","name":"My Folder 2"}, "fieldMask": "name"}' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.sites.SiteFoldersServiceV2.updateFolder(_id, options) Description: Updates a folder. > **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 param name: options | type: UpdateFolderOptions none - name: folder | type: Folder | description: Folder data. - name: name | type: string | description: Folder name. - name: parentId | type: string | description: Parent folder GUID. When empty, the site is at root level. - name: fieldMask | type: array | description: Set of fields to update. Example: `"fieldMask": "name"`. Return type: PROMISE - 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. Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: invalid_update_field | Description: The field you're trying to update can't be modified. HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: duplicate_folder_name | Description: There's already a folder with this name. ``` ### Examples ### updateFolder ```javascript import { siteFolders } from '@wix/sites'; async function updateFolder(_id,options) { const response = await siteFolders.updateFolder(_id,options); }; ``` ### updateFolder (with elevated permissions) ```javascript import { siteFolders } from '@wix/sites'; import { auth } from '@wix/essentials'; async function myUpdateFolderMethod(_id,options) { const elevatedUpdateFolder = auth.elevate(siteFolders.updateFolder); const response = await elevatedUpdateFolder(_id,options); } ``` ### updateFolder (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 updateFolder(_id,options) { const response = await myWixClient.siteFolders.updateFolder(_id,options); }; ``` ---