# Channel Members

Channel members are users who have been added to a channel and can participate in conversations. This page covers how to manage channel membership, including adding and removing members, controlling message history visibility, and managing member roles.

## Adding and Removing Members

### Adding Members

Using the `addMembers()` method adds the given users as members to a channel.

```csharp label="C#"
using GetStream;
using GetStream.Models;

var client = new StreamClient("{{ api_key }}", "{{ api_secret }}");
var chat = new ChatClient(client);

await chat.UpdateChannelAsync("messaging", channelId,
    new UpdateChannelRequest
    {
        AddMembers = new List<ChannelMemberRequest>
        {
            new ChannelMemberRequest { UserID = "thierry" },
            new ChannelMemberRequest { UserID = "josh" }
        }
    });
```

<Admonition type="info">

**Note:** You can only add/remove up to 100 members at once.

</Admonition>

Members can also be added when creating a channel:

```csharp label="C#"
// Members can be added when creating a channel
var resp = await chat.GetOrCreateChannelAsync("messaging", "my-channel-id",
    new ChannelGetOrCreateRequest
    {
        Data = new ChannelInput
        {
            CreatedByID = "user-1",
            Members = new List<ChannelMemberRequest>
            {
                new ChannelMemberRequest { UserID = "user-1" },
                new ChannelMemberRequest { UserID = "user-2" },
                new ChannelMemberRequest { UserID = "user-3" }
            }
        }
    });
```

### Removing Members

Using the `removeMembers()` method removes the given users from the channel.

```csharp label="C#"
await chat.UpdateChannelAsync("messaging", channelId,
    new UpdateChannelRequest
    {
        RemoveMembers = new List<string> { "thierry", "josh" }
    });
```

### Leaving a Channel

Users can leave a channel without moderator-level permissions. Ensure channel members have the `Leave Own Channel` permission enabled.

```js label="JavaScript"
// Remove own channel membership
await channel.removeMembers(["my_user_id"]);
```

<Admonition type="info">

You can familiarize yourself with all permissions in the [Permissions section](https://getstream.io/chat/docs/dotnet-csharp/chat-permission-policies/).

</Admonition>

## Hide History

When members join a channel, you can specify whether they have access to the channel's message history. By default, new members can see the history. Set `hide_history` to `true` to hide it for new members.

```csharp label="C#"
await chat.UpdateChannelAsync("messaging", channelId,
    new UpdateChannelRequest
    {
        AddMembers = new List<ChannelMemberRequest>
        {
            new ChannelMemberRequest { UserID = "thierry" }
        },
        HideHistory = true
    });
```

### Hide History Before a Specific Date

Alternatively, `hide_history_before` can be used to hide any history before a given timestamp while giving members access to later messages. The value must be a timestamp in the past in RFC 3339 format. If both parameters are defined, `hide_history_before` takes precedence over `hide_history`.

```csharp label="C#"
var cutoff = DateTime.UtcNow.AddDays(-7); // Last 7 days
await chat.UpdateChannelAsync("messaging", channelId,
    new UpdateChannelRequest
    {
        AddMembers = new List<ChannelMemberRequest>
        {
            new ChannelMemberRequest { UserID = "thierry" }
        },
        HideHistoryBefore = cutoff
    });
```

## System Message Parameter

You can optionally include a message object when adding or removing members that client-side SDKs will use to display a system message. This works for both adding and removing members.

```csharp label="C#"
await chat.UpdateChannelAsync("messaging", channelId,
    new UpdateChannelRequest
    {
        AddMembers = new List<ChannelMemberRequest>
        {
            new ChannelMemberRequest { UserID = "tommaso" }
        },
        Message = new MessageRequest
        {
            Text = "Tommaso joined the channel",
            UserID = "tommaso"
        }
    });
```

## Adding and Removing Moderators

Using the `addModerators()` method adds the given users as moderators (or updates their role to moderator if already members), while `demoteModerators()` removes the moderator status.

### Add Moderators

```csharp label="C#"
await chat.UpdateChannelAsync("messaging", channelId,
    new UpdateChannelRequest
    {
        AddModerators = new List<string> { "thierry", "josh" }
    });
```

### Remove Moderators

```csharp label="C#"
await chat.UpdateChannelAsync("messaging", channelId,
    new UpdateChannelRequest
    {
        DemoteModerators = new List<string> { "tommaso" }
    });
```

<Admonition type="info">

These operations can only be performed server-side, and a maximum of 100 moderators can be added or removed at once.

</Admonition>

## Member Custom Data

Custom data can be added at the channel member level. This is useful for storing member-specific information that is separate from user-level data. Ensure custom data does not exceed 5KB.

### Adding Custom Data

```csharp label="C#"
// Add a member first
await chat.UpdateChannelAsync("messaging", "my-channel-id",
    new UpdateChannelRequest
    {
        AddMembers = new List<ChannelMemberRequest>
        {
            new ChannelMemberRequest { UserID = "user-2" }
        }
    });

// Set custom data on the member
await chat.UpdateMemberPartialAsync("messaging", "my-channel-id",
    new UpdateMemberPartialRequest
    {
        Set = new Dictionary<string, object>
        {
            ["hat"] = "blue" // Channel member custom data is separate from user custom data
        }
    });
```

### Updating Member Data

Channel members can be partially updated. Only custom data and channel roles are eligible for modification. You can set or unset fields, either separately or in the same call.

```csharp label="C#"
// Set some fields
// Note: user_id is passed as a query parameter
await client.MakeRequestAsync<UpdateMemberPartialRequest, UpdateMemberPartialResponse>(
    "PATCH",
    "/api/v2/chat/channels/{type}/{id}/member",
    new Dictionary<string, string> { ["user_id"] = "user-2" },
    new UpdateMemberPartialRequest
    {
        Set = new Dictionary<string, object>
        {
            ["hat"] = "blue",
            ["score"] = 1000
        }
    },
    new Dictionary<string, string> { ["type"] = "messaging", ["id"] = "my-channel-id" });

// Unset some fields
await client.MakeRequestAsync<UpdateMemberPartialRequest, UpdateMemberPartialResponse>(
    "PATCH",
    "/api/v2/chat/channels/{type}/{id}/member",
    new Dictionary<string, string> { ["user_id"] = "user-2" },
    new UpdateMemberPartialRequest
    {
        Unset = new List<string> { "hat", "score" }
    },
    new Dictionary<string, string> { ["type"] = "messaging", ["id"] = "my-channel-id" });

// Set and unset in a single request
await client.MakeRequestAsync<UpdateMemberPartialRequest, UpdateMemberPartialResponse>(
    "PATCH",
    "/api/v2/chat/channels/{type}/{id}/member",
    new Dictionary<string, string> { ["user_id"] = "user-2" },
    new UpdateMemberPartialRequest
    {
        Set = new Dictionary<string, object> { ["hat"] = "blue" },
        Unset = new List<string> { "score" }
    },
    new Dictionary<string, string> { ["type"] = "messaging", ["id"] = "my-channel-id" });
```


---

This page was last updated at 2026-08-07T20:37:57.459Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/dotnet-csharp/channel-members/](https://getstream.io/chat/docs/dotnet-csharp/channel-members/).