# 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

```java label="Java"
chat.updateChannel("messaging", "general", UpdateChannelRequest.builder()
    .invites(List.of(
        ChannelMemberRequest.builder().userID("thierry").build(),
        ChannelMemberRequest.builder().userID("tommaso").build()))
    .build()).execute();
```

## 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!").

```java label="Java"
chat.updateChannel("messaging", "general", UpdateChannelRequest.builder()
    .acceptInvite(true)
    .userID("nick")
    .message(MessageRequest.builder().text("Nick joined the channel").userID("nick").build())
    .build()).execute();
```

## 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.

```java label="Java"
chat.updateChannel("messaging", "general", UpdateChannelRequest.builder()
    .rejectInvite(true)
    .userID("nick")
    .build()).execute();
```

## 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

```java label="Java"
chat.queryChannels(QueryChannelsRequest.builder()
    .filterConditions(Map.of("invite", "accepted"))
    .build()).execute();
```

### Query Rejected Invites

```java label="Java"
chat.queryChannels(QueryChannelsRequest.builder()
    .filterConditions(Map.of("invite", "rejected"))
    .build()).execute();
```

### Query Pending Invites

```java label="Java (Android)"
FilterObject filter = Filters.eq("invite", "pending");
int offset = 0;
int limit = 10;
QuerySorter<Channel> sort = new QuerySortByField<>();
int messageLimit = 0;
int memberLimit = 0;
QueryChannelsRequest request = new QueryChannelsRequest(filter, offset, limit, sort, messageLimit, memberLimit);

client.queryChannels(request).enqueue(result -> {
  if (result.isSuccess()) {
    List<Channel> channels = result.getOrNull();
  } else {
    // Handle error
  }
});
```


---

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

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