# Invites

Invites allow you to add users to a channel with a pending state. The invited user receives a notification and can accept or reject the invite.

Unread counts are not incremented for channels with a pending invite.

## Invite Users

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

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

var channelId = "channel-id";

// Send invites
await chat.UpdateChannelAsync("messaging", channelId,
    new UpdateChannelRequest
    {
        Invites = new List<ChannelMemberRequest>
        {
            new ChannelMemberRequest { UserID = "thierry" }
        }
    });
```

## Accept an Invite

Call `acceptInvite` to accept a pending invite. You can optionally include a `message` parameter to post a system message when the user joins (e.g., "Nick joined this channel!").

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

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

var channelId = "channel-id";

// Accept invite
await chat.UpdateChannelAsync("messaging", channelId,
    new UpdateChannelRequest
    {
        AcceptInvite = true,
        UserID = "thierry"
    });
```

## Reject an Invite

Call `rejectInvite` to decline a pending invite. Client-side calls use the currently connected user. Server-side calls require a `user_id` parameter.

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

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

var channelId = "channel-id";

// Reject invite
await chat.UpdateChannelAsync("messaging", channelId,
    new UpdateChannelRequest
    {
        RejectInvite = true,
        UserID = "thierry"
    });
```

## Query Invites by Status

Use `queryChannels` with the `invite` filter to retrieve channels based on invite status. Valid values are `pending`, `accepted`, and `rejected`.

### Query Accepted Invites

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

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

// Query accepted invites
await chat.QueryChannelsAsync(new QueryChannelsRequest
{
    FilterConditions = new Dictionary<string, object>
    {
        { "invite", "accepted" }
    }
});
```

### Query Rejected Invites

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

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

// Query rejected invites
await chat.QueryChannelsAsync(new QueryChannelsRequest
{
    FilterConditions = new Dictionary<string, object>
    {
        { "invite", "rejected" }
    }
});
```

### Query Pending Invites

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

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

// Query pending invites
await chat.QueryChannelsAsync(new QueryChannelsRequest
{
    FilterConditions = new Dictionary<string, object>
    {
        { "invite", "pending" }
    }
});
```

---

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