# Deleting Channels

You can either delete or truncate a channel to remove its contents. For truncation go over to [Truncate Channel](/chat/docs/<framework>/truncate_channel/) page.

## Deleting a Channel

You can delete a single Channel using the  `delete`  method. This marks the channel as deleted and hides all the messages.

<codetabs>

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

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

channelClient.delete().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 destroy = await channel.delete();
```

</codetabs-item>

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

```php
$channel->delete();
```

</codetabs-item>

<codetabs-item value="dart" label="Dart">

```dart
await channel.delete();
```

</codetabs-item>

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

```swift
import Stream Chat

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

controller.deleteChannel { error in
  if let error = error {
    // handle error
    print(error)
  }
}
```

</codetabs-item>

<codetabs-item value="unreal" label="Unreal">

```cpp
Channel->Delete();
```

</codetabs-item>

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

```ruby
# require 'stream-chat'

channel.delete()
```

</codetabs-item>

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

```python
channel.delete()
```

</codetabs-item>

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

```go
channel.delete(ctx);
```

</codetabs-item>

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

```csharp
await channelClient.DeleteAsync("<channel-type>", "<channel-id>");
```

</codetabs-item>

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

```csharp
// Soft delete channel
await channel.DeleteAsync();
```

</codetabs-item>

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

```java
// Backend SDK
Channel.delete(
    channel.getType(),
    channel.getId())
  .request();
```

</codetabs-item>

</codetabs>

<admonition type="info">

If you recreate this channel, it will show up empty. Recovering old messages is not supported. Use the disable method if you want a reversible change.

</admonition>

## Deleting Many Channels

You can delete up to 100 channels and optionally all of their messages using this method. This can be a large amount of data to delete, so this endpoint processes asynchronously, meaning responses contain a `task ID` which can be polled using the [getTask endpoint](https://getstream.io/chat/docs/<framework>#tasks-gettask) to check status of the deletions. Channels will be soft-deleted immediately so that channels no longer return from queries, but permanently deleting the channel and deleting messages takes longer to process.

By default, messages are soft deleted, which means they are removed from client but are still available via server-side export functions. You can also hard delete messages, which deletes them from everywhere, by setting `"hard_delete": true` in the request. Messages that have been soft or hard deleted cannot be recovered.

This is currently supported on the following SDK versions (or higher):

- Javascript 4.3.0, Python 3.14.0, Ruby 2.12.0, PHP 2.6.0, Go 3.13.0, Java 1.4.0, Unity 2.0.0 and .NET 0.22.0

<codetabs>

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

```js
// client-side soft delete
const response = await client.deleteChannels([cid1, cid2]);
// client-side hard delete
const response = await client.deleteChannels([cid1, cid2], {
  hard_delete: true,
});
const result = response.result; // holds deletion result

// server-side soft delete
const response = await serverClient.deleteChannels([cid1, cid2]);
// server-side hard delete
const response = await serverClient.deleteChannels([cid1, cid2], {
  hard_delete: true,
});

const result = await serverClient.getTask(response.task_id);
if (result["status"] === "completed") {
  // success!
}
```

</codetabs-item>

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

```go
// soft deletion
taskID, _ := client.DeleteChannels([]string{cid1, cid2}, false)
// hard deletion
taskID, _ := client.DeleteChannels([]string{cid1, cid2}, true)

response, err := client.GetTask(taskID)
if err != nil {
  return err
}

if response.Status == "completed" {
  // success!
}
```

</codetabs-item>

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

```python
# soft deletion
response = client.delete_channels([cid1, cid2])
# hard deletion
response = client.delete_channels([cid1, cid2], hard_delete=True)

response = client.get_task(response["task_id"])
if response['status'] == 'completed':
  # success!
  pass
```

</codetabs-item>

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

```ruby
# soft deletion
response = client.delete_channels([cid1, cid2], hard_delete: false)
# hard deletion
response = client.delete_channels([cid1, cid2], hard_delete: true)

response = client.get_task(response["task_id"])
if response['status'] == 'completed'
  # success!
```

</codetabs-item>

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

```php
// soft deletion
$response = $client->deleteChannels([cid1, cid2], ["hard_delete" => false]);
// hard deletion
$response = $client->deleteChannels([cid1, cid2], ["hard_delete" => true]);

$response = $client->getTask($response["task_id"]);
if ($response["status"] == "completed") {
  // success!
};
```

</codetabs-item>

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

```java
// soft deletion
var taskId = Channel.deleteMany(List.of(cid1, cid1), DeleteStrategy.SOFT).request().getTaskId();
// hard deletion
var taskId = Channel.deleteMany(List.of(cid1, cid1), DeleteStrategy.HARD).request().getTaskId();

var taskStatusResponse = TaskStatus.get(taskId).request();
// "completed".equals(taskStatusResponse.status);
```

</codetabs-item>

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

```csharp
// soft deletion
var resp = await channelClient.DeleteChannelsAsync(new[] { cid }, hardDelete: false);

// hard deletion
var resp = await channelClient.DeleteChannelsAsync(new[] { cid }, hardDelete: true);

var response = await taskClient.GetTaskStatusAsync(resp.TaskId);
// response.Status == AsyncTaskStatus.Completed;
```

</codetabs-item>

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

```csharp
// Hard delete removes the channel entirely from the database while soft delete removes the from users to see but it's still accessible via server-side SDK as an archive
await Client.DeleteMultipleChannelsAsync(new[] { channel, channel2 }, isHardDelete: true);
```

</codetabs-item>

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

```java
// Android SDK
ChannelClient channelClient = client.channel("messaging", "general");

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

// Backend SDK
Channel.deleteMany(List.of("c:1", "c:2"), DeleteStrategy.HARD).request();
```

</codetabs-item>

</codetabs>

The  `deleteChannels`  response contain a taskID which can be polled using the [getTask endpoint](https://getstream.io/chat/docs/<framework>#tasks-gettask) to check the status of the deletions.

---

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

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