> 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 # ChangeRole # Package: userManagement # Namespace: SiteRolesManagementService # Method link: https://dev.wix.com/docs/api-reference/account-level/user-management/contributors/change-role.md ## Permission Scopes: Manage Contributors: SCOPE.DC-IDENTITY.MANAGE-CONTRIBUTORS ## Introduction Updates all of a contributor's roles for the specified site, overriding any existing roles. Replaces all existing role assignments for the contributor with the roles specified in `newRoles`. To retrieve available roles, call [Get Roles Info](https://dev.wix.com/docs/api-reference/account-level/user-management/accounts/users/get-roles-info.md). --- ## REST API ### Schema ``` Method: changeRole Description: Updates all of a contributor's roles for the specified site, overriding any existing roles. Replaces all existing role assignments for the contributor with the roles specified in `newRoles`. To retrieve available roles, call [Get Roles Info](https://dev.wix.com/docs/api-reference/account-level/user-management/accounts/users/get-roles-info.md). URL: https://www.wixapis.com/roles-management/contributor/change/role Method: PUT # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: accountId, newRoles Method parameters: param name: accountId | type: accountId | description: Contributor's account GUID. | required: true param name: newRoles | type: array | description: New roles to assign to the contributor on the site. Replaces all existing role assignments. | required: true - name: roleId | type: string | description: Role GUID. Sometimes referred to as policy GUID. See [Roles and Permissions](https://support.wix.com/en/article/roles-permissions-overview) for a list of available roles. Return type: ChangeContributorRoleResponse - name: newAssignedRoles | type: array | description: Roles assigned to the contributor on the site. - name: roleId | type: string | description: Role GUID. Sometimes referred to as policy GUID. See [Roles and Permissions](https://support.wix.com/en/article/roles-permissions-overview) for a list of available roles. - name: assignmentId | type: string | description: Assignment GUID mapping the role to the contributor on the site. ``` ### Examples ### Change contributor role ```curl curl -X PATCH \ 'https://www.wixapis.com/roles-management/contributor/change/role' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "accountId": "fed9597b-00a1-4bd6-0000-aff2ec248e7a", "newRoles": [ { "roleId": "6600344420111308827", } ] }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.userManagement.SiteRolesManagementService.changeRole(accountId, options) Description: Updates all of a contributor's roles for the specified site, overriding any existing roles. Replaces all existing role assignments for the contributor with the roles specified in `newRoles`. To retrieve available roles, call [Get Roles Info](https://dev.wix.com/docs/api-reference/account-level/user-management/accounts/users/get-roles-info.md). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: accountId, options.newRoles, options Method parameters: param name: accountId | type: string | description: Contributor's account GUID. | required: true param name: options | type: ChangeRoleOptions none | required: true - name: newRoles | type: array | description: New roles to assign to the contributor on the site. Replaces all existing role assignments. | required: true - name: roleId | type: string | description: Role GUID. Sometimes referred to as policy GUID. See [Roles and Permissions](https://support.wix.com/en/article/roles-permissions-overview) for a list of available roles. Return type: PROMISE - name: newAssignedRoles | type: array | description: Roles assigned to the contributor on the site. - name: roleId | type: string | description: Role GUID. Sometimes referred to as policy GUID. See [Roles and Permissions](https://support.wix.com/en/article/roles-permissions-overview) for a list of available roles. - name: assignmentId | type: string | description: Assignment GUID mapping the role to the contributor on the site. ``` ### Examples ### Change a contributor's role on a site with an API key ```javascript import { createClient, ApiKeyStrategy } from "@wix/sdk"; import { contributors } from "@wix/user-management"; const wixClient = createClient({ modules: { contributors }, auth: ApiKeyStrategy({ siteId: "MY-SITE-ID", apiKey: "MY-API-KEY", }), }); async function changeRole(accountId, options) { const response = await contributors.changeRole(accountId, options); } ``` ### changeRole (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 { contributors } from '@wix/user-management'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { contributors }, // Include the auth strategy and host as relevant }); async function changeRole(accountId,options) { const response = await myWixClient.contributors.changeRole(accountId,options); }; ``` ---