> 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 # UpdatePermissions # Package: collectionManagement # Namespace: DataPermissionsService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-permissions/update-permissions.md ## Permission Scopes: Manage Data Collections: SCOPE.DC-DATA.DATA-COLLECTIONS-MANAGE ## Introduction Updates permissions for the specified data collection. > **Note:** To update special permissions, call [Update Special Permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/update-special-permissions.md). --- ## REST API ### Schema ``` Method: updatePermissions Description: Updates permissions for the specified data collection. > **Note:** To update special permissions, call [Update Special Permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/update-special-permissions.md). URL: https://www.wixapis.com/wix-data/v1/permissions Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: dataPermissions, dataPermissions.id, dataPermissions.itemRead, dataPermissions.itemInsert, dataPermissions.itemUpdate, dataPermissions.itemRemove Method parameters: param name: dataPermissions | type: DataPermissions | description: Permissions that determine who can access or perform actions on items in a data collection. Learn more about [collection permissions](https://support.wix.com/en/article/cms-collection-permissions-overview). | required: true - name: id | type: string | description: GUID of the collection for these permissions. | required: true - name: itemRead | type: AccessLevel | description: Which users can read items from the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). | required: true - enum: - ANYONE: Anyone, including [site visitors](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-visitor). - SITE_MEMBER: Logged-in [site members](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-member) and [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site). - SITE_MEMBER_AUTHOR: Logged-in [site members](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-member) and [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site) who can only access items they created. - CMS_EDITOR: Site [collaborators with a CMS editor role](https://support.wix.com/en/article/roles-permissions-overview#roles-for-integrated-wix-apps). - PRIVILEGED: Site administrators, [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site), or roles with special permissions. Learn more about [roles for site management](https://support.wix.com/en/article/roles-permissions-overview#general-roles-for-site-management). - name: itemInsert | type: AccessLevel | description: Which users can create new items in the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). | required: true - name: itemUpdate | type: AccessLevel | description: Which users can update existing items in the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). | required: true - name: itemRemove | type: AccessLevel | description: Which users can remove items from the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). | required: true Return type: UpdatePermissionsResponse - name: dataPermissions | type: DataPermissions | description: Updated permissions of the specified collection. - name: id | type: string | description: GUID of the collection for these permissions. - name: itemRead | type: AccessLevel | description: Which users can read items from the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - enum: - ANYONE: Anyone, including [site visitors](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-visitor). - SITE_MEMBER: Logged-in [site members](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-member) and [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site). - SITE_MEMBER_AUTHOR: Logged-in [site members](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-member) and [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site) who can only access items they created. - CMS_EDITOR: Site [collaborators with a CMS editor role](https://support.wix.com/en/article/roles-permissions-overview#roles-for-integrated-wix-apps). - PRIVILEGED: Site administrators, [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site), or roles with special permissions. Learn more about [roles for site management](https://support.wix.com/en/article/roles-permissions-overview#general-roles-for-site-management). - name: itemInsert | type: AccessLevel | description: Which users can create new items in the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - name: itemUpdate | type: AccessLevel | description: Which users can update existing items in the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - name: itemRemove | type: AccessLevel | description: Which users can remove items from the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - name: specialPermissions | type: array | description: Special permissions granted to specified users or roles. > **Note:** Special permissions override [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions). - ONE-OF: - name: userId | type: string | description: GUID of the user for these special permissions. - name: policyId | type: string | description: GUID of the [role](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#user-roles) for these special permissions. To find the GUID of a role, call [Get Roles Info](https://dev.wix.com/docs/rest/account-level/user-management/accounts/users/get-roles-info.md). Roles and their GUIDs are found in the `predefinedRoles` or the `customRoles` arrays in the method response. Learn more about [roles and permissions for site management](https://support.wix.com/en/article/roles-permissions-overview#roles-and-permissions). - name: id | type: string | description: GUID of the special permissions set. - name: itemRead | type: Access | description: Whether the specified users or roles can read items from the collection. When set to `ALLOWED`, users can read items from the collection. When set to `UNSPECIFIED`, [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions) apply. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - enum: - UNSPECIFIED: No special permissions. [Collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions) apply to this action. - ALLOWED: User or role has special permissions to perform this action, overriding [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions). - name: itemInsert | type: Access | description: Whether the specified users or roles can create new items in the collection. When set to `ALLOWED`, users can create new items in the collection. When set to `UNSPECIFIED`, [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions) apply. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - name: itemUpdate | type: Access | description: Whether the specified users or roles can update existing items in the collection. When set to `ALLOWED`, users can update existing items in the collection. When set to `UNSPECIFIED`, [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions) apply. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - name: itemRemove | type: Access | description: Whether the specified users or roles can remove items from the collection. When set to `ALLOWED`, users can remove items from the collection. When set to `UNSPECIFIED`, [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions) apply. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: WDE0025 | Description: Returned when the specified data collection isn't found. Learn more about [Wix Data error codes](https://dev.wix.com/docs/rest/business-solutions/cms/wix-data-error-codes.md). ``` ### Examples ### Update data collection permissions ```curl curl -X POST 'https://www.wixapis.com/wix-data/v1/permissions' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "dataPermissions": { "id": "my-first-collection", "itemRead": "ANYONE", "itemInsert": "SITE_MEMBER", "itemUpdate": "CMS_EDITOR", "itemRemove": "PRIVILEGED" } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.collectionManagement.DataPermissionsService.updatePermissions(dataPermissions) Description: Updates permissions for the specified data collection. > **Note:** To update special permissions, call [Update Special Permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/update-special-permissions.md). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: dataPermissions, dataPermissions._id, dataPermissions.itemRead, dataPermissions.itemInsert, dataPermissions.itemUpdate, dataPermissions.itemRemove Method parameters: param name: dataPermissions | type: DataPermissions | description: Permissions that determine who can access or perform actions on items in a data collection. Learn more about [collection permissions](https://support.wix.com/en/article/cms-collection-permissions-overview). | required: true - name: _id | type: string | description: GUID of the collection for these permissions. | required: true - name: itemRead | type: AccessLevel | description: Which users can read items from the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). | required: true - enum: - ANYONE: Anyone, including [site visitors](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-visitor). - SITE_MEMBER: Logged-in [site members](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-member) and [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site). - SITE_MEMBER_AUTHOR: Logged-in [site members](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-member) and [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site) who can only access items they created. - CMS_EDITOR: Site [collaborators with a CMS editor role](https://support.wix.com/en/article/roles-permissions-overview#roles-for-integrated-wix-apps). - PRIVILEGED: Site administrators, [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site), or roles with special permissions. Learn more about [roles for site management](https://support.wix.com/en/article/roles-permissions-overview#general-roles-for-site-management). - name: itemInsert | type: AccessLevel | description: Which users can create new items in the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). | required: true - name: itemUpdate | type: AccessLevel | description: Which users can update existing items in the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). | required: true - name: itemRemove | type: AccessLevel | description: Which users can remove items from the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). | required: true Return type: PROMISE - name: dataPermissions | type: DataPermissions | description: Updated permissions of the specified collection. - name: _id | type: string | description: GUID of the collection for these permissions. - name: itemRead | type: AccessLevel | description: Which users can read items from the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - enum: - ANYONE: Anyone, including [site visitors](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-visitor). - SITE_MEMBER: Logged-in [site members](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-member) and [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site). - SITE_MEMBER_AUTHOR: Logged-in [site members](https://dev.wix.com/docs/rest/articles/get-started/about-identities.md#site-member) and [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site) who can only access items they created. - CMS_EDITOR: Site [collaborators with a CMS editor role](https://support.wix.com/en/article/roles-permissions-overview#roles-for-integrated-wix-apps). - PRIVILEGED: Site administrators, [collaborators](https://support.wix.com/en/article/inviting-people-to-contribute-to-your-site), or roles with special permissions. Learn more about [roles for site management](https://support.wix.com/en/article/roles-permissions-overview#general-roles-for-site-management). - name: itemInsert | type: AccessLevel | description: Which users can create new items in the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - name: itemUpdate | type: AccessLevel | description: Which users can update existing items in the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - name: itemRemove | type: AccessLevel | description: Which users can remove items from the collection. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - name: specialPermissions | type: array | description: Special permissions granted to specified users or roles. > **Note:** Special permissions override [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions). - ONE-OF: - name: userId | type: string | description: GUID of the user for these special permissions. - name: policyId | type: string | description: GUID of the [role](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#user-roles) for these special permissions. To find the GUID of a role, call [Get Roles Info](https://dev.wix.com/docs/rest/account-level/user-management/accounts/users/get-roles-info.md). Roles and their GUIDs are found in the `predefinedRoles` or the `customRoles` arrays in the method response. Learn more about [roles and permissions for site management](https://support.wix.com/en/article/roles-permissions-overview#roles-and-permissions). - name: _id | type: string | description: GUID of the special permissions set. - name: itemRead | type: Access | description: Whether the specified users or roles can read items from the collection. When set to `ALLOWED`, users can read items from the collection. When set to `UNSPECIFIED`, [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions) apply. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - enum: - UNSPECIFIED: No special permissions. [Collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions) apply to this action. - ALLOWED: User or role has special permissions to perform this action, overriding [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions). - name: itemInsert | type: Access | description: Whether the specified users or roles can create new items in the collection. When set to `ALLOWED`, users can create new items in the collection. When set to `UNSPECIFIED`, [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions) apply. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - name: itemUpdate | type: Access | description: Whether the specified users or roles can update existing items in the collection. When set to `ALLOWED`, users can update existing items in the collection. When set to `UNSPECIFIED`, [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions) apply. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). - name: itemRemove | type: Access | description: Whether the specified users or roles can remove items from the collection. When set to `ALLOWED`, users can remove items from the collection. When set to `UNSPECIFIED`, [collection-level permissions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#collection-level-permissions) apply. Learn more about [item actions](https://dev.wix.com/docs/rest/business-solutions/cms/data-permissions/introduction.md#item-actions). Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: WDE0025 | Description: Returned when the specified data collection isn't found. Learn more about [Wix Data error codes](https://dev.wix.com/docs/rest/business-solutions/cms/wix-data-error-codes.md). ``` ### Examples ### updatePermissions ```javascript import { permissions } from '@wix/data'; async function updatePermissions(dataPermissions) { const response = await permissions.updatePermissions(dataPermissions); }; ``` ### updatePermissions (with elevated permissions) ```javascript import { permissions } from '@wix/data'; import { auth } from '@wix/essentials'; async function myUpdatePermissionsMethod(dataPermissions) { const elevatedUpdatePermissions = auth.elevate(permissions.updatePermissions); const response = await elevatedUpdatePermissions(dataPermissions); } ``` ### updatePermissions (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 { permissions } from '@wix/data'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { permissions }, // Include the auth strategy and host as relevant }); async function updatePermissions(dataPermissions) { const response = await myWixClient.permissions.updatePermissions(dataPermissions); }; ``` ---