# Hiding Channels

Hiding a channel removes it from query channel requests for that user until a new message is added. Only channel members can hide a channel.

Hidden channels may still have unread messages. Consider [marking the channel as read](/chat/docs/react/unread/) before hiding it.

You can optionally clear the message history for that user when hiding. When a new message is received, it will be the only message visible to that user.

## Hide a Channel

<Tabs>

```kotlin label="Kotlin"
// Hides the channel until a new message is added there
channelClient.hide().enqueue { result ->
  if (result is Result.Success) {
    // Channel is hidden
  } else {
    // Handle Result.Failure
  }
}

// Shows a previously hidden channel
channelClient.show().enqueue { result ->
  if (result is Result.Success) {
    // Channel is shown
  } else {
    // Handle Result.Failure
  }
}

// Hide the channel and clear the message history
channelClient.hide(clearHistory = true).enqueue { result ->
  if (result is Result.Success) {
    // Channel is hidden
  } else {
    // Handle Result.Failure
  }
}
```

```js label="JavaScript"
// hides the channel until a new message is added there
await channel.hide();

// hides the channel until a new message is added there. This also clears the history for the user
await channel.hide(null, true);

// shows a previously hidden channel
await channel.show();
```

```php label="PHP"
use GetStream\ChatClient;
use GetStream\GeneratedModels as Models;

$client = new ChatClient("{{ api_key }}", "{{ api_secret }}");

// Hide the channel until a new message is added there
$client->hideChannel("messaging", "general", new Models\HideChannelRequest(
    userID: "john",
));

// Show a previously hidden channel
$client->showChannel("messaging", "general", new Models\ShowChannelRequest(
    userID: "john",
));
```

```dart label="Dart"
// hides the channel until a new message is added there
await channel.hide();

// shows a previously hidden channel
await channel.show();

// hide the channel and clear the message history
await channel.hide(clearHistory: true);
```

```swift label="Swift"
import StreamChat

let controller = chatClient.channelController(for: .init(type: .messaging, id: "general"))

// Controllers

// hide channel
controller.hideChannel { error in
  if let error = error {
    // handle error
    print(error)
  }
}

// show channel
controller.showChannel { error in
  if let error = error {
    // handle error
    print(error)
  }
}

// hide channel and clear message history
controller.hideChannel(clearHistory: true) { error in
  if let error = error {
    // handle error
    print(error)
  }
}

// State layer (async-await)

// hide channel
try await chat.hide()

// show channel
try await chat.show()

// hide channel and clear message history
try await chat.hide(clearHistory: true)
```

```cpp label="Unreal"
// hides the channel until a new message is added there
Channel->Hide();

// shows a previously hidden channel
Channel->Show();

// hide the channel and clear the message history
Channel->Hide(true);
```

```python label="Python"
# Get a channel
channel = client.chat.channel("messaging", "general")

# Hide the channel until a new message is added
channel.hide(user_id="john")

# Show a previously hidden channel
channel.show(user_id="john")
```

```ruby label="Ruby"
require 'getstream_ruby'

Models = GetStream::Generated::Models

# Hide the channel until a new message is added
client.chat.hide_channel("messaging", "general", Models::HideChannelRequest.new(
  user_id: 'john'
))

# Show a previously hidden channel
client.chat.show_channel("messaging", "general", Models::ShowChannelRequest.new(
  user_id: 'john'
))
```

```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";
var userId = "john";

// Hide the channel until a new message is added there
await chat.HideChannelAsync("messaging", channelId,
    new HideChannelRequest { UserID = userId });

// Show a previously hidden channel
await chat.ShowChannelAsync("messaging", channelId,
    new ShowChannelRequest { UserID = userId });
```

```go label="Go"
channel := client.Chat().Channel("messaging", "general")

// hides the channel until a new message is added there
channel.Hide(ctx, &getstream.HideChannelRequest{
	UserID: getstream.PtrTo("john"),
})

// shows a previously hidden channel
channel.Show(ctx, &getstream.ShowChannelRequest{
	UserID: getstream.PtrTo("john"),
})

// hide the channel and clear the message history
channel.Hide(ctx, &getstream.HideChannelRequest{
	UserID:       getstream.PtrTo("john"),
	ClearHistory: getstream.PtrTo(true),
})
```

```java label="Java"
// Hides the channel until a new message is added there
channelClient.hide(false).enqueue(result -> {
  if (result.isSuccess()) {
    // Channel is hidden
  } else {
    // Handle result.error()
  }
});

// Shows a previously hidden channel
channelClient.show().enqueue(result -> {
  if (result.isSuccess()) {
    // Channel is shown
  } else {
    // Handle result.error()
  }
});

// Hide the channel and clear the message history
channelClient.hide(true).enqueue(result -> {
  if (result.isSuccess()) {
    // Channel is hidden
  } else {
    // Handle result.error()
  }
});
```

```csharp label="Unity"
// Hide a channel
await channel.HideAsync();

// Show previously hidden channel
await channel.ShowAsync();
```

</Tabs>

<admonition type="info">

You can still retrieve the list of hidden channels using the `{ "hidden" : true }` query parameter.

</admonition>


---

This page was last updated at 2026-05-22T16:32:18.926Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/react/hiding-channels/](https://getstream.io/chat/docs/react/hiding-channels/).