# Truncate Channel

Truncating a channel removes all messages but preserves the channel data and members. To delete both the channel and its messages, use [Delete Channel](https://getstream.io/chat/docs/unity/channel-delete/) instead.

Truncation can be performed client-side or server-side. Client-side truncation requires the `TruncateChannel` permission.

On server-side calls, use the `user_id` field to identify who performed the truncation.

By default, truncation hides messages. To permanently delete messages, set `hard_delete` to `true`.
Truncation applies to every member by default. Set `member_ids` to scope it to specific members instead.

## Truncate a Channel

```csharp label="Unity"
await channel.TruncateAsync(systemMessage: "Clearing up the history!");
```

## Truncate for Specific Members

Set `member_ids` to hide the message history for specific members only. Every other member keeps their full view, and no messages are deleted. They stay in the channel and remain visible to everyone not listed.

Messages created before `truncated_at` are hidden from the listed members. When `truncated_at` is omitted it defaults to the time of the request, hiding the history to date.

This sets the same per-member history cutoff as [Hide Channel](https://getstream.io/chat/docs/unity/hiding-channels/) with `clear_history`, but it does not hide the channel. The channel stays in the listed members' channel lists, and every member receives `channel.truncated` instead of the hiding user alone receiving `channel.hidden`.

```csharp label="C#"
await chat.TruncateChannelAsync("messaging", channelId,
    new TruncateChannelRequest
    {
        MemberIds = new List<string> { "jane", "john" }
    });
```

### Constraints

- Every ID in `member_ids` must belong to a current member of the channel. The request fails with `not all users are active channel members` otherwise.
- `member_ids` accepts at most 100 IDs.
- `hard_delete` cannot be combined with `member_ids`. Member-scoped truncation only hides messages, it never deletes them.
- `truncated_at` replaces each listed member's existing cutoff rather than keeping the later of the two. A second call with an earlier `truncated_at` makes the messages between the two times visible to those members again.
- `truncated_at` must be later than the channel's last whole-channel truncation and not in the future. Otherwise the request fails with `"truncated_at" field must be more recent than previous one` or `"truncated_at" field must not be more recent than current time`. A fixed past date, like the `2026-01-01` example above, fails on any channel truncated after it.
- The `channel.truncated` event is delivered to every member of the channel, not only the members listed in `member_ids`. Client SDKs that clear their cached messages on this event do so for all members; the messages are unaffected on the server and reappear on the next fetch.

## Truncate Options

| Field        | Type   | Description                                            | Optional |
| ------------ | ------ | ------------------------------------------------------ | -------- |
| truncated_at | Date   | Truncate messages up to this time                      | ✓        |
| user_id      | string | User who performed the truncation (server-side only)   | ✓        |
| message      | object | A system message to add after truncation               | ✓        |
| skip_push    | bool   | Do not send a push notification for the system message | ✓        |
| hard_delete  | bool   | Permanently delete messages instead of hiding them     | ✓        |
| member_ids   | array  | Hide messages for specific members only                | ✓        |

---

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/unity/truncate-channel/](https://getstream.io/chat/docs/unity/truncate-channel/).