> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/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. In the current public SDKs, archive APIs are exposed on TypeScript and Flutter; iOS and Android do not expose public channel archive methods in this checkout.

## Platform Surface

| Operation               | TypeScript                                      | iOS         | Android     | Flutter                       |
| ----------------------- | ----------------------------------------------- | ----------- | ----------- | ----------------------------- |
| Archive                 | `ChannelRepository.archiveChannel(channelId)`   | Not exposed | Not exposed | `archiveChannel(channelId)`   |
| Unarchive               | `ChannelRepository.unarchiveChannel(channelId)` | Not exposed | Not exposed | `unarchiveChannel(channelId)` |
| Query archived channels | `ChannelRepository.getArchivedChannels(...)`    | Not exposed | Not exposed | `getArchivedChannels()`       |

## Parameters

| Operation               | Parameter           | Required | Description                                                                                             |
| ----------------------- | ------------------- | -------- | ------------------------------------------------------------------------------------------------------- |
| Archive                 | `channelId`         | Yes      | Channel ID to hide from the current user's active channel list.                                         |
| Unarchive               | `channelId`         | Yes      | Archived channel ID to restore to the active channel list.                                              |
| Query archived channels | `limit`             | No       | TypeScript collection page size.                                                                        |
| Query archived channels | Pagination controls | No       | Use TypeScript collection callbacks or Flutter live collection loading to fetch more archived channels. |

## Archive Or Unarchive

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

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

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

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

  await repository.archiveChannel(channelId);
  await repository.unarchiveChannel(channelId);
  ```
</CodeGroup>

## 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.

<CodeGroup>
  ```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();
  ```

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

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

  await archivedChannels.loadNext();
  ```
</CodeGroup>

## 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.                             |
| Platform gaps    | Use platform checks before exposing archive UI on iOS or Android.                         |

## Related Topics

<CardGroup cols={2}>
  <Card title="Query Channels" href="./query-channels" icon="list-filter">
    Use `excludeArchives` where the platform query supports it.
  </Card>

  <Card title="Get Channels" href="./get-channel" icon="file">
    Resolve an archived channel by ID before opening it.
  </Card>

  <Card title="Delete Messages" href="../../messaging-features/messages/edit-and-delete-messages" icon="trash">
    Delete messages instead of hiding a channel.
  </Card>

  <Card title="Update Channels" href="./update-channel" icon="pen">
    Update channel display and metadata separately from archive state.
  </Card>
</CardGroup>
