# Disabling Channels

## Disable a channel

Disable a channel prevents users from viewing or creating messages on that channel. Any client-side read or write operations will results in a `403 Not Allowed` error. You can't fetch the channel client-side, but you can query channels and receive them, you will have to use `disabled:false` on your filters in order to filter the disabled channels out. The channel remains usable server-side and data can still be [exported](/chat/docs/<framework>/exporting_channels/).

Channels can be re-enabled which restores historical messages and allows creation of new messages again.

<codetabs>

<codetabs-item value="javascript" label="JavaScript">

```js
// 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 } });
```

</codetabs-item>

<codetabs-item value="php" label="PHP">

```php
// 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]);
```

</codetabs-item>

<codetabs-item value="python" label="Python">

```python
# 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})
```

</codetabs-item>

<codetabs-item value="ruby" label="Ruby">

```ruby
# 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})
```

</codetabs-item>

<codetabs-item value="java" label="Java">

```java
// 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", true)
  .request();
```

</codetabs-item>

<codetabs-item value="csharp" label="C#">

```csharp
// 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 channelUpdates = new PartialUpdateChannelRequest
{
  Set = new Dictionary<string, object> { { "disabled", true } },
};
await channelClient.PartialUpdateAsync("<channel-type>", "<channel-id>", channelUpdates);
```

</codetabs-item>

<codetabs-item value="go" label="Go">

```go
// 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": true,
	},
})
```

</codetabs-item>

<codetabs-item value="unity" label="Unity">

```csharp
// For security reasons, disabling channels is only possible via a server-side SDK
```

</codetabs-item>

</codetabs>

To prevent new messages from being created, while still being able to read previous messages, freeze the channel instead.

## Freeze a channel

Freezing a channel will disallow sending new messages and sending / deleting reactions. Sending a message to a frozen channel will return a message of type `error` . Sending and deleting reactions to frozen channels will result in a `403 Not Allowed` error. User roles with the `UseFrozenChannel` permission are still able to use frozen channels as if they weren't frozen. By default no user role has the `UseFrozenChannel` permission.

<codetabs>

<codetabs-item value="kotlin" label="Kotlin">

```kotlin
val channelClient = client.channel("messaging", "general")

channelClient.updatePartial(set = mapOf("frozen" to true)).enqueue { result ->
  if (result is Result.Success) {
    val channel = result.value
  } else {
    // Handle Result.Failure
  }
}
```

</codetabs-item>

<codetabs-item value="javascript" label="JavaScript">

```js
const update = await channel.update(
	{ frozen: true },
	{ text: 'Thierry has frozen the channel', user_id: "Thierry" }
)

const update = await channel.updatePartial(
	{set: {frozen: true}
)
```

</codetabs-item>

<codetabs-item value="swift" label="Swift">

```swift
let channelController = client.channelController(for: .init(type: .messaging, id: "general"))

channelController.freezeChannel()
```

</codetabs-item>

<codetabs-item value="php" label="PHP">

```php
$channel->update(["frozen" => true]);
```

</codetabs-item>

<codetabs-item value="python" label="Python">

```python
channel.update({"frozen": True})
```

</codetabs-item>

<codetabs-item value="ruby" label="Ruby">

```ruby
channel.update({"frozen" => true})
```

</codetabs-item>

<codetabs-item value="java" label="Java">

```java
// Android SDK
ChannelClient channelClient = client.channel("messaging", "general");
Map<String, Object> set = new HashMap<>();
set.put("freeze", true);
List<String> unset = new ArrayList<>();

channelClient.updatePartial(set, unset).enqueue(result -> {
  if (result.isSuccess()) {
    Channel channel = result.data();
  } else {
    // Handle result.error()
  }
});

// Backend SDK
ChannelRequestObject channelRequestObject = ChannelRequestObject.buildFrom(channel);
channelRequestObject.setFrozen(true);
Channel.update(channel.getType(), channel.getId())
  .data(channelRequestObject)
  .message(
    MessageRequestObject.builder()
      .text("Thierry has frozen the channel")
      .userId("Thierry")
      .build())
  .request();
```

</codetabs-item>

<codetabs-item value="csharp" label="C#">

```csharp
var updateReq = new ChannelUpdateRequest { Data = new ChannelRequest { Frozen = true} };
await channelClient.UpdateAsync("<channel-type>", "<channel-id>", updateReq);
```

</codetabs-item>

<codetabs-item value="go" label="Go">

```go
channel.Update(ctx, map[string]interface{}{"frozen": true}, nil)
```

</codetabs-item>

<codetabs-item value="unity" label="Unity">

```csharp
await channel.FreezeAsync();
```

</codetabs-item>

</codetabs>

### Unfreeze a Channel

<codetabs>

<codetabs-item value="kotlin" label="Kotlin">

```kotlin
val channelClient = client.channel("messaging", "general")

channelClient.updatePartial(unset = listOf("frozen")).enqueue { result ->
  if (result is Result.Success) {
    val channel = result.value
  } else {
    // Handle Result.Failure
  }
}
```

</codetabs-item>

<codetabs-item value="javascript" label="JavaScript">

```js
const update = await channel.update(
  { frozen: false },
  { text: "Thierry has unfrozen the channel", user_id: "Thierry" },
);
```

</codetabs-item>

<codetabs-item value="swift" label="Swift">

```swift
let channelController = client.channelController(for: .init(type: .messaging, id: "general"))

channelController.unfreezeChannel()
```

</codetabs-item>

<codetabs-item value="php" label="PHP">

```php
$channel->update(["frozen" => false]);
```

</codetabs-item>

<codetabs-item value="python" label="Python">

```python
channel.update({"frozen": False})
```

</codetabs-item>

<codetabs-item value="ruby" label="Ruby">

```ruby
channel.update({"frozen" => false})
```

</codetabs-item>

<codetabs-item value="java" label="Java">

```java
// Android SDK
ChannelClient channelClient = client.channel("messaging", "general");
Map<String, Object> set = new HashMap<>();
List<String> unset = new ArrayList<>();
unset.add("freeze");

channelClient.updatePartial(set, unset).enqueue(result -> {
  if (result.isSuccess()) {
    Channel channel = result.data();
  } else {
    // Handle result.error()
  }
});

// Backend SDK
ChannelRequestObject channelRequestObject = ChannelRequestObject.buildFrom(channel);
channelRequestObject.setFrozen(false);
Channel.update(channel.getType(), channel.getId())
  .data(channelRequestObject)
  .message(
    MessageRequestObject.builder()
      .text("Thierry has unfrozen the channel")
      .userId("Thierry")
      .build())
  .request();
```

</codetabs-item>

<codetabs-item value="csharp" label="C#">

```csharp
var updateReq = new ChannelUpdateRequest { Data = new ChannelRequest { Frozen = false} };
await channelClient.UpdateAsync("<channel-type>", "<channel-id>", updateReq);
```

</codetabs-item>

<codetabs-item value="go" label="Go">

```go
channel.Update(ctx, map[string]interface{}{"frozen": false}, nil)
```

</codetabs-item>

<codetabs-item value="unity" label="Unity">

```csharp
await channel.UnfreezeAsync();
```

</codetabs-item>

</codetabs>

### Granting the Frozen Channel Permissions

Since by default no role has the `UseFrozenChannel` permission, you can edit the channel type to grant the permission to a role (this is only allowed via server side API calls). [Read more about user permissions here](/chat/docs/<framework>/user_permissions/)

<codetabs>

<codetabs-item value="javascript" label="JavaScript">

```js
const { grants } = await client.getChannelType("messaging");
grants.admin.push("use-frozen-channel");
await client.updateChannelType("messaging", {
  grants: { admin: grants.admin },
});
```

</codetabs-item>

<codetabs-item value="php" label="PHP">

```php
$response = $client->getChannelType("messaging");

$response["grants"]["admin"][] = "use-frozen-channel";

$client->updateChannelType("messaging", [ "grants" => ["admin" => $response["grants"]["admin"] ] ]);
```

</codetabs-item>

<codetabs-item value="python" label="Python">

```python
resp = client.get_channel_type("messaging")

adminGrants = resp["grants"]["admin"] + ["use-frozen-channel"]

client.update_channel_type("messaging", grants={"admin": adminGrants})
```

</codetabs-item>

<codetabs-item value="ruby" label="Ruby">

```ruby
resp = client.get_channel_type("messaging")

adminGrants = resp["grants"]["admin"] + ["use-frozen-channel"]

client.update_channel_type("messaging", grants: {"admin": adminGrants})
```

</codetabs-item>

<codetabs-item value="go" label="Go">

```go
resp, err := c.GetChannelType(ctx, "messaging")
adminGrants = append(resp.Grants["admin"], "use-frozen-channel")

c.UpdateChannelType(ctx, "messaging", map[string]interface{}{"grants": map[string][]string{"admin": adminGrants}})
```

</codetabs-item>

<codetabs-item value="java" label="Java">

```java
// Backend SDK
ChannelTypeGetResponse resp = ChannelType.get("messaging").request();
Map<String, List<String>> currentGrants = resp.getGrants();

List<String> adminGrants = currentGrants.get("admin");
adminGrants.add("use-frozen-channel");
currentGrants.put("admin", adminGrants);

ChannelType.update("messaging")
 .grants(currentGrants)
 .request();
```

</codetabs-item>

<codetabs-item value="unity" label="Unity">

```csharp
// For security reasons, granting channel permissions is only possible via a server-side SDK
```

</codetabs-item>

</codetabs>

---

This page was last updated at 2025-08-15T14:15:08.562Z.

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