# Update a User Membership

## PUT /v2/admin/usergroups/{groupId}/memberships/{userId}

> Add member to a Group if it does not exist, otherwise update it.

```json
{"openapi":"3.1.1","info":{"title":"Restricted Pod API","version":"20.17.1"},"servers":[{"url":"https://yourpodURL.symphony.com/pod"}],"paths":{"/v2/admin/usergroups/{groupId}/memberships/{userId}":{"put":{"summary":"Add member to a Group if it does not exist, otherwise update it.","parameters":[{"schema":{"type":"string"},"name":"sessionToken","description":"Session authentication token.","in":"header","required":true},{"schema":{"type":"string"},"name":"groupId","description":"URL-Safe encoded Group ID","in":"path","required":true},{"schema":{"type":"integer","format":"int64"},"name":"userId","in":"path","required":true}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserGroupMembershipData"}}}},"400":{"description":"Client error, see response body for further details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized: Session tokens invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden: Caller lacks necessary entitlement.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found. See response body for further details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error, see response body for further details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserGroupMembershipRequest"}}},"required":true}}}},"components":{"schemas":{"UserGroupMembershipData":{"description":"Body for user group membership response","type":"object","properties":{"id":{"type":"string"},"groupId":{"type":"string"},"userId":{"type":"integer","format":"int64"},"group":{"type":"object","$ref":"#/components/schemas/UserGroupData"},"user":{"type":"object","$ref":"#/components/schemas/MembershipData"},"active":{"type":"boolean"},"lastAddedDate":{"type":"integer","format":"int64"},"lastRemovedDate":{"type":"integer","format":"int64"}}},"UserGroupData":{"description":"Group object response","type":"object","properties":{"id":{"description":"Group Id","type":"string"},"name":{"description":"Group name","type":"string"},"area":{"description":"Group area","type":"string"},"type":{"description":"Group type","type":"string"},"active":{"description":"Group Status","type":"boolean"}}},"MembershipData":{"description":"User object response","type":"object","properties":{"id":{"type":"integer","format":"int64"},"userName":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"emailAddress":{"type":"string"}}},"Error":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}},"UserGroupMembershipRequest":{"description":"Body for user group membership creation","type":"object","properties":{"active":{"type":"boolean"}}}}}}
```

> #### 🚧 Roles and Privileges
>
> Calling this endpoint requires the **Scope Management** role with the MANAGE\_ROLE\_SCOPES entitleable action.\
> See [Bot Permissions](https://docs.developers.symphony.com/building-bots-on-symphony/configuration/bot-permissions) for a list of roles and associated privileges.
