---
title: "Change the role of a member"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Change the role of a member

Path: CloudRaker Workspace API › Organization Settings

`PATCH /users/memberships/{membershipId}`

Sets the product role of a membership in the caller's organization. Body: `{ roleSlug: string }`. An owner keeps `owner` beside the new role; `owner` itself is not a valid value. Authorization: organization administrators only. Returns 204 on success; 400 on a malformed body; 404 if it does not exist or is not in this org; 409 when refused: your own membership (`cannot_change_self`) or a directory-managed membership (`directory_managed`).

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `membershipId` (`changeMemberRole.path.membershipId`; string, required)

## Request body

_Required._

- `roleSlug` (`changeMemberRole.roleSlug`; string, required)
  - minLength 1; maxLength 64; example `"member"`

## Example request

```json
{
  "roleSlug": "member"
}
```

## Code samples

### cURL

```bash
curl --request PATCH \
  --url 'https://api.cloudraker.com/users/memberships/<membershipId>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "roleSlug": "member"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/users/memberships/<membershipId>';
const options = {
  method: 'PATCH',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({roleSlug: 'member'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/users/memberships/<membershipId>"

payload = { "roleSlug": "member" }
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 204

Role changed (empty body).


Source: https://docs.cloudraker.com/workspace/api/organization-settings/change-member-role/index.md
