> ## Documentation Index
> Fetch the complete documentation index at: /llms.txt
> Use this file to discover all available pages before exploring further.

# Archive Channels

> Archive, unarchive, and query archived chat channels where the current SDK exposes archive APIs.

Archiving is a per-user chat-list operation. It hides a channel from the active list for the current user without deleting the channel or its messages. Archive APIs are available on TypeScript, iOS, Android, and Flutter.

## Platform Surface

| Operation | TypeScript | iOS | Android | Flutter |
| - | - | - | - | - |
| Archive | `ChannelRepository.archiveChannel(channelId)` | `channelRepository.archiveChannel(channelId:)` | `channelRepository.archiveChannel(channelId)` | `archiveChannel(channelId)` |
| Unarchive | `ChannelRepository.unarchiveChannel(channelId)` | `channelRepository.unarchiveChannel(channelId:)` | `channelRepository.unarchiveChannel(channelId)` | `unarchiveChannel(channelId)` |
| Query archived channels | `ChannelRepository.getArchivedChannels(...)` | `getArchivedChannels()` or `getArchivedChannelIds()` | `getArchivedChannels()` or `getArchivedChannelIds()` | `getArchivedChannels()` |

## Parameters

| Operation | Parameter | Required | Platforms | Description |
| - | - | - | - | - |
| Archive | `channelId` | Yes | TypeScript, iOS, Android, Flutter | Channel ID to hide from the current user's active channel list. |
| Unarchive | `channelId` | Yes | TypeScript, iOS, Android, Flutter | Archived channel ID to restore to the active channel list. |
| Query archived channels | `limit` | No | TypeScript | TypeScript collection page size. |
| Query archived channels | Pagination controls | No | TypeScript, iOS, Flutter | Use TypeScript collection callbacks, `nextPage()` on the iOS `AmityCollection`, or Flutter live collection loading. Android's `getArchivedChannels()` emits the full list on each update, so there is nothing to page. |

## Archive Or Unarchive

Archive or unarchive a channel for the current user when the platform exposes archive state.

```typescript TypeScript theme={null}
import { ChannelRepository } from '@amityco/ts-sdk';

await ChannelRepository.archiveChannel(channelId);
await ChannelRepository.unarchiveChannel(channelId);
```

```swift iOS theme={null}
try await channelRepository.archiveChannel(channelId: "channel-id")
try await channelRepository.unarchiveChannel(channelId: "channel-id")
```

```kotlin Android theme={null}
channelRepository.archiveChannel(channelId = channelId)
    .subscribe()

channelRepository.unarchiveChannel(channelId = channelId)
    .subscribe()
```

```dart Flutter theme={null}
final repository = AmityChatClient.newChannelRepository();

await repository.archiveChannel(channelId);
await repository.unarchiveChannel(channelId);
```

## Query Archived Channels

Use the archived-channel collection for an archived inbox. The TypeScript API accepts live collection parameters such as `limit`; the Flutter API returns a live collection stream for the current user.

```typescript TypeScript theme={null}
import { ChannelRepository } from '@amityco/ts-sdk';

const unsubscribe = ChannelRepository.getArchivedChannels(
  {
    limit: 20,
  },
  ({ data: channels, loading, error }) => {
    if (error) handleError(error);

    if (!loading && channels) {
      renderResults(channels);
    }
  },
);

unsubscribe();
```

```swift iOS theme={null}
// A live collection of archived channels.
let archivedChannels = channelRepository.getArchivedChannels()
token = archivedChannels.observe { collection, error in
    renderResults(collection.snapshots)
}

// Or just the archived channel IDs.
let ids = try await channelRepository.getArchivedChannelIds()
```

```kotlin Android theme={null}
// A stream of archived channels.
channelRepository.getArchivedChannels()
    .subscribe(
        { channels: List<AmityChannel> -> renderResults(channels) },
        { error -> handleGeneralError(error) },
    )

// Or just the archived channel IDs.
channelRepository.getArchivedChannelIds()
    .subscribe(
        { channelIds: List<String> -> renderResults(channelIds) },
        { error -> handleGeneralError(error) },
    )
```

```dart Flutter theme={null}
final archivedChannels = AmityChatClient.newChannelRepository()
    .getArchivedChannels();

archivedChannels.getStream().listen((event) {
  final channels = event.data;
  final isFetching = event.isFetching;
});

await archivedChannels.loadNext();
```

## Notes

| Topic | Current SDK guidance |
| - | - |
| Scope | Archive state belongs to the current user's archived-channel list. |
| Messages | Archiving is not message deletion. Use message delete APIs for message lifecycle changes. |
| Channel deletion | Archiving is separate from channel deletion or soft deletion. |
| Query shape | Every platform returns archived channels as a collection or stream. iOS and Android also expose an IDs-only variant, `getArchivedChannelIds()`. |

## Related Topics

> [card] [Query Channels](/social-plus-sdk/chat/conversation-management/channels/query-channels.md)
>
> Use `excludeArchives` where the platform query supports it.

> [card] [Get Channels](/social-plus-sdk/chat/conversation-management/channels/get-channel.md)
>
> Resolve an archived channel by ID before opening it.

> [card] [Delete Messages](/social-plus-sdk/chat/messaging-features/messages/edit-and-delete-messages.md)
>
> Delete messages instead of hiding a channel.

> [card] [Update Channels](/social-plus-sdk/chat/conversation-management/channels/update-channel.md)
>
> Update channel display and metadata separately from archive state.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.