> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# UpdateTeamMemberAssignments

# Package: accounts

# Namespace: RolesManagementService

# Method link: https://dev.wix.com/docs/api-reference/account-level/user-management/accounts/users/update-team-member-assignments.md

## Permission Scopes:
Manage Team Members: SCOPE.IDENTITY.MANAGE-TEAM-MEMBERS

## Introduction

Updates the assignments of roles and conditions for an existing team member.  Changing assignments changes the team member’s access to account assets.
> **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only.

---

## REST API

### Schema

```
 Method: updateTeamMemberAssignments
 Description: Updates the assignments of roles and conditions for an existing team member.  Changing assignments changes the team member’s access to account assets. > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only.
 URL: https://www.wixapis.com/roles-management/v2/team/assignments
 Method: PATCH
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  userId, newAssignments
 Method parameters: 
   param name: assignmentIdsToRemove | type: array<assignmentIdsToRemove> | description: Existing assignment GUIDs to remove. To retrieve all existing assignment GUIDs for a team member, call Search Team.  | validation: minItems 0, maxItems 50, format GUID
   param name: newAssignments | type: array<newAssignments> | description: New assignments to apply to the team member in this account. | required: true | validation: maxItems 50
              - name: policyId | type: string | description: Role assigned to the user. To retrieve all available roles, call Get Roles Info.  
              - name: restrictions | type: Restriction | description: The asset where a user is assigned access in an assignment. When empty, the role covers all assets, with no restrictions to specific sites or folders.  
                 - ONE-OF: 
                    - name: conditions | type: Conditions | description: List of conditions restricting the user's access. Currently only folder conditions are supported.  
                       - name: conditions | type: array<Condition> | description: List of conditions.  
                          - name: conditionType | type: ConditionAttributeType | description: Condition type.  
                                     - enum: UNKNOWN_CONDITION_TYPE, FOLDER
                          - name: id | type: string | description: Condition GUID.  
                          - name: value | type: string | description: Expected value of the condition. When `conditionType` = "FOLDER", this is the folder path.  
                    - name: site | type: SiteRestriction | description: Site where the assignment restrictions apply.  
                       - name: id | type: string | description: Site GUID.  
                       - name: value | type: string | description: Site name.  
                    - name: locations | type: LocationsRestriction | description: Business locations where the assignment restrictions apply. Get location GUIDs from the [Locations API](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md).  
                       - name: ids | type: array<string> | description: Location GUIDs where the assignment restrictions apply.  | validation: maxItems 20, format GUID
              - name: subject | type: AssignedSubject | description: Identity assigned to the asset in an assignment, referred to as subject. Supported subjects include user GUIDs, account GUIDs, and app GUIDs.  
                 - name: subjectType | type: SubjectType | description: Identity type.  
                         - enum: UNKNOWN, ACCOUNT, USER, USER_GROUP, MEMBER_GROUP, VISITOR_GROUP, EXTERNAL_APP, ACCOUNT_GROUP, WIX_APP
   param name: userId | type: userId | description: GUID of team member being affected. | required: true | validation: format GUID
 Return type: UpdateTeamMemberAssignmentsResponse
  - name: assignments | type: array<AssignmentV3> | description: The new assignments, assigned to the given team member.  
     - name: policyId | type: string | description: Role assigned to the user. To retrieve all available roles, call Get Roles Info.  
     - name: assignmentId | type: string | description: Unique GUID for this specific assignment.  | read-only: true 
     - name: restrictions | type: Restriction | description: The asset where a user is assigned access in an assignment. When empty, the role covers all assets, with no restrictions to specific sites or folders.  
        - ONE-OF: 
           - name: conditions | type: Conditions | description: List of conditions restricting the user's access. Currently only folder conditions are supported.  
              - name: conditions | type: array<Condition> | description: List of conditions.  
                 - name: conditionType | type: ConditionAttributeType | description: Condition type.  
                         - enum: UNKNOWN_CONDITION_TYPE, FOLDER
                 - name: id | type: string | description: Condition GUID.  
                 - name: value | type: string | description: Expected value of the condition. When `conditionType` = "FOLDER", this is the folder path.  
           - name: site | type: SiteRestriction | description: Site where the assignment restrictions apply.  
              - name: id | type: string | description: Site GUID.  
              - name: value | type: string | description: Site name.  
           - name: locations | type: LocationsRestriction | description: Business locations where the assignment restrictions apply. Get location GUIDs from the [Locations API](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md).  
              - name: ids | type: array<string> | description: Location GUIDs where the assignment restrictions apply.  | validation: maxItems 20, format GUID
     - name: subject | type: AssignedSubject | description: Identity assigned to the asset in an assignment, referred to as subject. Supported subjects include user GUIDs, account GUIDs, and app GUIDs.  
        - name: id | type: string | description: Identity GUID.  | read-only: true | validation: format GUID
        - name: subjectType | type: SubjectType | description: Identity type.  
             - enum: UNKNOWN, ACCOUNT, USER, USER_GROUP, MEMBER_GROUP, VISITOR_GROUP, EXTERNAL_APP, ACCOUNT_GROUP, WIX_APP


```

### Examples

### Update assignments
```curl
curl -X PATCH \
'https://www.wixapis.com/roles-management/v2/team/assignments' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>' \
-d '{
        "userId": "fed9597b-00a1-4bd6-0000-aff2ec248e7a",
        "newAssignments": [
          {
            "policyId": "6600344420111308827"
          }
        ],
        "assignmentIdsToRemove": [
          "7167886595789334551"
        ]
      }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.userManagement.users.updateTeamMemberAssignments(userId, options)
 Description: Updates the assignments of roles and conditions for an existing team member.  Changing assignments changes the team member’s access to account assets. > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  userId, options.newAssignments, options
 Method parameters: 
   param name: userId | type: string | description: GUID of team member being affected. | required: true | validation: format GUID
   param name: options | type: UpdateTeamMemberAssignmentsOptions  none | required: true 
        - name: newAssignments | type: array<AssignmentV3> | description: New assignments to apply to the team member in this account. | required: true | validation: maxItems 50
           - name: policyId | type: string | description: Role assigned to the user. To retrieve all available roles, call Get Roles Info.  
           - name: restrictions | type: Restriction | description: The asset where a user is assigned access in an assignment. When empty, the role covers all assets, with no restrictions to specific sites or folders.  
              - ONE-OF: 
                 - name: conditions | type: Conditions | description: List of conditions restricting the user's access. Currently only folder conditions are supported.  
                    - name: conditions | type: array<Condition> | description: List of conditions.  
                       - name: conditionType | type: ConditionAttributeType | description: Condition type.  
                                 - enum: UNKNOWN_CONDITION_TYPE, FOLDER
                       - name: _id | type: string | description: Condition GUID.  
                       - name: value | type: string | description: Expected value of the condition. When `conditionType` = "FOLDER", this is the folder path.  
                 - name: site | type: SiteRestriction | description: Site where the assignment restrictions apply.  
                    - name: _id | type: string | description: Site GUID.  
                    - name: value | type: string | description: Site name.  
                 - name: locations | type: LocationsRestriction | description: Business locations where the assignment restrictions apply. Get location GUIDs from the [Locations API](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md).  
                    - name: ids | type: array<string> | description: Location GUIDs where the assignment restrictions apply.  | validation: maxItems 20, format GUID
           - name: subject | type: AssignedSubject | description: Identity assigned to the asset in an assignment, referred to as subject. Supported subjects include user GUIDs, account GUIDs, and app GUIDs.  
              - name: subjectType | type: SubjectType | description: Identity type.  
                     - enum: UNKNOWN, ACCOUNT, USER, USER_GROUP, MEMBER_GROUP, VISITOR_GROUP, EXTERNAL_APP, ACCOUNT_GROUP, WIX_APP
        - name: assignmentIdsToRemove | type: array<string> | description: Existing assignment GUIDs to remove. To retrieve all existing assignment GUIDs for a team member, call Search Team.  | validation: minItems 0, maxItems 50, format GUID
 Return type: PROMISE<UpdateTeamMemberAssignmentsResponse>
  - name: assignments | type: array<AssignmentV3> | description: The new assignments, assigned to the given team member.  
     - name: policyId | type: string | description: Role assigned to the user. To retrieve all available roles, call Get Roles Info.  
     - name: assignmentId | type: string | description: Unique GUID for this specific assignment.  | read-only: true 
     - name: restrictions | type: Restriction | description: The asset where a user is assigned access in an assignment. When empty, the role covers all assets, with no restrictions to specific sites or folders.  
        - ONE-OF: 
           - name: conditions | type: Conditions | description: List of conditions restricting the user's access. Currently only folder conditions are supported.  
              - name: conditions | type: array<Condition> | description: List of conditions.  
                 - name: conditionType | type: ConditionAttributeType | description: Condition type.  
                         - enum: UNKNOWN_CONDITION_TYPE, FOLDER
                 - name: _id | type: string | description: Condition GUID.  
                 - name: value | type: string | description: Expected value of the condition. When `conditionType` = "FOLDER", this is the folder path.  
           - name: site | type: SiteRestriction | description: Site where the assignment restrictions apply.  
              - name: _id | type: string | description: Site GUID.  
              - name: value | type: string | description: Site name.  
           - name: locations | type: LocationsRestriction | description: Business locations where the assignment restrictions apply. Get location GUIDs from the [Locations API](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md).  
              - name: ids | type: array<string> | description: Location GUIDs where the assignment restrictions apply.  | validation: maxItems 20, format GUID
     - name: subject | type: AssignedSubject | description: Identity assigned to the asset in an assignment, referred to as subject. Supported subjects include user GUIDs, account GUIDs, and app GUIDs.  
        - name: _id | type: string | description: Identity GUID.  | read-only: true | validation: format GUID
        - name: subjectType | type: SubjectType | description: Identity type.  
             - enum: UNKNOWN, ACCOUNT, USER, USER_GROUP, MEMBER_GROUP, VISITOR_GROUP, EXTERNAL_APP, ACCOUNT_GROUP, WIX_APP


```

### Examples

### Update a team member's assignments with an API key
```javascript
import { createClient, ApiKeyStrategy } from "@wix/sdk";
import { users } from "@wix/user-management";
const wixClient = createClient({
 modules: { users },
 auth: ApiKeyStrategy({
    apiKey: "MY-API-KEY",
  }),
});

async function updateTeamMemberAssignments(userId, options) {
  const response = await users.updateTeamMemberAssignments(userId, options);
}

```

### updateTeamMemberAssignments (self-managed)
Self-managed 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 { users } from '@wix/user-management';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { users },
  // Include the auth strategy and host as relevant
});


async function updateTeamMemberAssignments(userId,options) {
  const response = await myWixClient.users.updateTeamMemberAssignments(userId,options);
};
```

---