await client.queryChannels({ disabled: false });Disabling Channels
Disabling a channel is a visibility and access toggle. The channel and all its data remain intact, but client-side read and write operations return a 403 Not Allowed error. Server-side access is preserved for admin operations like moderation and data export.
Disabled channels still appear in query results by default. This means users see the channel in their list but receive errors when attempting to open it. To hide disabled channels from users, filter them out in your queries:
Re-enabling a channel restores full client-side access with all historical messages intact.
Disable a Channel
// disable a channel with full update
await channel.update({ disabled: true });
// disable a channel with partial update
await channel.updatePartial({ set: { disabled: true } });
// enable a channel with full update
await channel.update({ disabled: false });
// enable a channel with partial update
await channel.updatePartial({ set: { disabled: false } });use GetStream\ChatClient;
use GetStream\GeneratedModels as Models;
$client = new ChatClient("{{ api_key }}", "{{ api_secret }}");
// Disable a channel with partial update
$client->updateChannelPartial("messaging", "general", new Models\UpdateChannelPartialRequest(
set: (object)["disabled" => true],
));
// Enable a channel with partial update
$client->updateChannelPartial("messaging", "general", new Models\UpdateChannelPartialRequest(
set: (object)["disabled" => false],
));from getstream.models import ChannelInputRequest
# Get a channel
channel = client.chat.channel("messaging", "general")
# disable a channel with full update
channel.update(data=ChannelInputRequest(disabled=True))
# disable a channel with partial update
channel.update_channel_partial(set={"disabled": True})
# enable a channel with full update
channel.update(data=ChannelInputRequest(disabled=False))
# enable a channel with partial update
channel.update_channel_partial(set={"disabled": False})require 'getstream_ruby'
Models = GetStream::Generated::Models
# disable a channel with full update
client.chat.update_channel("messaging", "general", Models::UpdateChannelRequest.new(
data: Models::ChannelInputRequest.new(disabled: true)
))
# disable a channel with partial update
client.chat.update_channel_partial("messaging", "general", Models::UpdateChannelPartialRequest.new(
set: { 'disabled' => true }
))
# enable a channel with full update
client.chat.update_channel("messaging", "general", Models::UpdateChannelRequest.new(
data: Models::ChannelInputRequest.new(disabled: false)
))
# enable a channel with partial update
client.chat.update_channel_partial("messaging", "general", Models::UpdateChannelPartialRequest.new(
set: { 'disabled' => false }
))// disable a channel with full update
chat.updateChannel("<channel-type>", "<channel-id>", UpdateChannelRequest.builder()
.data(ChannelInputRequest.builder().disabled(true).build())
.build()).execute();
// disable a channel with partial update
chat.updateChannelPartial("<channel-type>", "<channel-id>",
UpdateChannelPartialRequest.builder()
.set(Map.of("disabled", true))
.build()).execute();
// enable a channel with full update
chat.updateChannel("<channel-type>", "<channel-id>", UpdateChannelRequest.builder()
.data(ChannelInputRequest.builder().disabled(false).build())
.build()).execute();
// enable a channel with partial update
chat.updateChannelPartial("<channel-type>", "<channel-id>",
UpdateChannelPartialRequest.builder()
.set(Map.of("disabled", false))
.build()).execute();using GetStream;
using GetStream.Models;
var client = new StreamClient("{{ api_key }}", "{{ api_secret }}");
var chat = new ChatClient(client);
var channelId = "channel-id";
// Disable a channel with partial update
await chat.UpdateChannelPartialAsync("messaging", channelId,
new UpdateChannelPartialRequest
{
Set = new Dictionary<string, object> { ["disabled"] = true }
});
// Enable a channel with partial update
await chat.UpdateChannelPartialAsync("messaging", channelId,
new UpdateChannelPartialRequest
{
Set = new Dictionary<string, object> { ["disabled"] = false }
});channel := client.Chat().Channel("messaging", "general")
// disable a channel with full update
channel.Update(ctx, &getstream.UpdateChannelRequest{
Data: &getstream.ChannelInputRequest{Disabled: getstream.PtrTo(true)},
})
// disable a channel with partial update
channel.UpdateChannelPartial(ctx, &getstream.UpdateChannelPartialRequest{
Set: map[string]any{"disabled": true},
})
// enable a channel with full update
channel.Update(ctx, &getstream.UpdateChannelRequest{
Data: &getstream.ChannelInputRequest{Disabled: getstream.PtrTo(false)},
})
// enable a channel with partial update
channel.UpdateChannelPartial(ctx, &getstream.UpdateChannelPartialRequest{
Set: map[string]any{"disabled": false},
})// For security reasons, disabling channels is only possible via a server-side SDKTo prevent new messages while still allowing users to read existing messages, use freeze the channel instead.