# Set member role

> Source: https://elaichi.ai/docs/api-reference/members/member/patchmember/

`PATCH /member/{userId}`

Resource: **Member** · API: **Members**

## Path parameters

- **`userId`** _(string, required)_
  User id (`usr_…`) of an org member.

## Request body

- **`role_ids`** _(array<string>)_
  Exactly one role (`role_…`). It replaces the member's current role.

## Response body

- **`user_id`** _(string)_
  User id (`usr_…`). A membership has no id of its own.
- **`status`** _(string)_
  Only `active` members can act in the organization.
- **`via`** _(string,null)_
  How they joined — invite, verified domain, SCIM, and so on.
- **`joined_at`** _(string)_
- **`roles`** _(array<object>)_
  Roles held. Replace the whole set with `PATCH /member/{userId}`.
  - **`id`** _(string)_
    Role id (`role_…`).
  - **`name`** _(string)_
  - **`is_system`** _(boolean)_
  - **`seat_class`** _(string)_
    Allowed: `billable`, `free_admin`
- **`teams`** _(array<object>)_
  - **`id`** _(string)_
    Team id (`team_…`).
  - **`name`** _(string)_
- **`user`** _(object,null)_
  Global profile. Null when the profile row could not be resolved.

## Code examples

### curl

```bash
curl -X PATCH 'https://api.elaichi.ai/member/<userId>' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"role_ids":[]}'
```

### JavaScript

```javascript
const body = {
  "role_ids": []
};

const response = await fetch('https://api.elaichi.ai/member/<userId>', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/member/<userId>"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "role_ids": []
}

response = requests.patch(url, headers=headers, json=payload)
print(response.json())
```
