# Update Member

Move a member to another role.

`PUT https://connect.mindcloud.co/v2/members/:userId`

Permissions: `member:edit`.

## Parameters

### Path

- `userId` (string, required): The member's userId, from List Members.

### Headers

- `X-Company-Id` (string): Optional. The id of the organization to act in. Leave it out to act in the API key's own organization. A key can also act in its child organizations, and, with "Use this key across all of your organizations" on, in every organization its creator can open in the app. List them with GET /v2/companies. Every response's X-Company-Id header names the organization it acted in. See [Organizations](https://mindcloud.co/docs/api/rest/introduction/organizations).

### Body

- `roleId` (string, required): The role to give them, from List Roles.

## Example request

```bash
curl --request PUT \
  --url 'https://connect.mindcloud.co/v2/members/user_2wXk9Lm4Pq7Rz3Ts8Vb1Nc6Hd' \
  --header 'Authorization: Bearer $MINDCLOUD_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "roleId": "Rl5wB9cF3hJp"
}'
```

## Response fields

- `userId` (string): Unique id of the member.
- `name` (string): The member's name.
- `email` (string): The member's email address.
- `isPending` (boolean): True while their invite is waiting to be accepted.
- `roleId` (string): The role they hold.
- `roleName` (string): That role's name.
- `createdOn` (date): When they joined the company.

## Errors

- 400 Bad request (INVALID_QUERY, MEMBER_ROLE_ASSIGNMENT_INVALID, MEMBER_ROLE_LAST_OWNER_DEMOTION_FORBIDDEN): `VALIDATION_FAILED` / `MEMBER_ROLE_LAST_OWNER_DEMOTION_FORBIDDEN` "Cannot demote the last Owner. At least one Owner must remain in the company."
- 403 Access denied (API_KEY_PERMISSION_DENIED, MEMBER_ACTOR_NOT_RESOLVED, MEMBER_ROLE_SELF_UPDATE_FORBIDDEN, MEMBER_ROLE_EXCEEDS_ACTOR, MEMBER_ROLE_OWNER_MODIFICATION_FORBIDDEN): `FORBIDDEN` / `MEMBER_ROLE_SELF_UPDATE_FORBIDDEN` "Users cannot change their own role."
- 404 Member not found: `NOT_FOUND` / `MEMBER_ROLE_UPDATE_NOT_FOUND` "Member not found."
