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 } });// disable a channel with full update
$channel->update(["disabled" => true]);
// disable a channel with partial update
$channel->updatePartial(["disabled" => true]);
// enable a channel with full update
$channel->update(["disabled" => false]);
// enable a channel with partial update
$channel->updatePartial(["disabled" => false]);# disable a channel with full update
channel.update({"disabled": True})
# disable a channel with partial update
channel.update_partial(to_set={"disabled": True})
# enable a channel with full update
channel.update({"disabled": False})
# enable a channel with partial update
channel.update_partial(to_set={"disabled": False})# require 'stream-chat'
# disable a channel with full update
channel.update({"disabled" => true})
# disable a channel with partial update
channel.update_partial({"disabled" => true})
# enable a channel with full update
channel.update({"disabled" => false})
# enable a channel with partial update
channel.update_partial({"disabled" => false})// disable a channel with full update
Channel.update("<channel-type>", "<channel-id>")
.data(ChannelRequestObject.builder().additionalField("disabled", true).build())
.request();
// disable a channel with partial update
Channel.partialUpdate("<channel-type>", "<channel-id>")
.setValue("disabled", true)
.request();
// enable a channel with full update
Channel.update("<channel-type>", "<channel-id>")
.data(ChannelRequestObject.builder().additionalField("disabled", false).build())
.request();
// enable a channel with partial update
Channel.partialUpdate("<channel-type>", "<channel-id>")
.setValue("disabled", false)
.request();// disable a channel with full update
var updateReq = new ChannelUpdateRequest { Data = new ChannelRequest() };
updateReq.Data.SetData("disabled", true);
await channelClient.UpdateAsync("<channel-type>", "<channel-id>", updateReq);
// disable a channel with partial update
var channelUpdates = new PartialUpdateChannelRequest
{
Set = new Dictionary<string, object> { { "disabled", true } },
};
await channelClient.PartialUpdateAsync("<channel-type>", "<channel-id>", channelUpdates);
// enable a channel with full update
var updateReq = new ChannelUpdateRequest { Data = new ChannelRequest() };
updateReq.Data.SetData("disabled", false);
await channelClient.UpdateAsync("<channel-type>", "<channel-id>", updateReq);
// enable a channel with partial update
var enableUpdates = new PartialUpdateChannelRequest
{
Set = new Dictionary<string, object> { { "disabled", false } },
};
await channelClient.PartialUpdateAsync("<channel-type>", "<channel-id>", enableUpdates);// disable a channel with full update
channel.Update(ctx, map[string]interface{}{"disabled": true}, nil)
// disable a channel with partial update
channel.PartialUpdate(ctx, PartialUpdate{
Set: map[string]interface{}{
"disabled": true,
},
})
// enable a channel with full update
channel.Update(ctx, map[string]interface{}{"disabled": false}, nil)
// enable a channel with partial update
channel.PartialUpdate(ctx, PartialUpdate{
Set: map[string]interface{}{
"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.