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

# Get Channels

> Retrieve a single chat channel or load known channel IDs with the current SDK APIs.

Use channel retrieval when your app already has a `channelId` and needs the current channel object for message routing, member preview, unread state, or display metadata.

Single-channel retrieval is available on all current SDKs. Batch lookup by channel IDs is exposed on TypeScript, iOS, and Android; the current public Flutter repository does not expose a batch-by-IDs method.

## Platform Surface

| Operation       | TypeScript                                          | iOS                                       | Android                                   | Flutter                                      |
| --------------- | --------------------------------------------------- | ----------------------------------------- | ----------------------------------------- | -------------------------------------------- |
| Get one channel | `ChannelRepository.getChannel(channelId, callback)` | `channelRepository.getChannel(channelId)` | `channelRepository.getChannel(channelId)` | `getChannel(channelId)`                      |
| Result style    | Live object callback                                | `AmityObject<AmityChannel>`               | `Flowable<AmityChannel>`                  | `Future<AmityChannel>`                       |
| Get channel IDs | `getChannels({ channelIds })`                       | `getChannels(channelIds:)`                | `getChannels(channelIds)`                 | Not exposed in the current public repository |

## Parameters

| Operation             | Parameter                         | Required | Description                                                                                     |
| --------------------- | --------------------------------- | -------- | ----------------------------------------------------------------------------------------------- |
| Get one channel       | `channelId`                       | Yes      | Channel ID to retrieve or observe.                                                              |
| Get one channel       | Callback / observer               | Depends  | Required by TypeScript and native live-object APIs to receive loading, error, and data updates. |
| Get one channel       | Unsubscriber / token / disposable | No       | Handle returned by live APIs; retain it while observing and release it when done.               |
| Get known channel IDs | `channelIds`                      | Yes      | List of channel IDs to resolve into channel objects where the platform exposes batch lookup.    |

## Get One Channel

Retrieve or observe one channel when your app already has its `channelId`.

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

  const unsubscribe = ChannelRepository.getChannel(
    channelId,
    ({ data: channel, loading, error }) => {
      if (error) handleError(error);

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

  unsubscribe();
  ```

  ```swift iOS theme={null}
  let liveChannel = channelRepository.getChannel("channel-id")

  token = liveChannel.observe { liveObject, error in
      if let error {
          handleError(error)
          return
      }

      guard let channel = liveObject.snapshot else { return }
      showSuccessMessage(channel.channelId)
  }
  ```

  ```kotlin Android theme={null}
  val disposable = channelRepository
      .getChannel(channelId = channelId)
      .subscribe(
          { channel -> showSuccessMessage(channel.getChannelId()) },
          { error -> handleGeneralError(error) },
      )
  ```

  ```dart Flutter theme={null}
  final channel = await AmityChatClient.newChannelRepository()
      .getChannel(channelId);

  final fetchedChannelId = channel.channelId;
  ```
</CodeGroup>

## Get Known Channel IDs

Use batch lookup when your app has a small list of known channel IDs and wants the matching channel objects. The collection is not the same as a general channel search; use [Query Channels](./query-channels) when you need filters or pagination.

<Info>
  The current public Flutter `AmityChannelRepository` exposes `getChannel(channelId)` and query builders, but not a batch `getChannels(channelIds)` method.
</Info>

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

  const unsubscribe = ChannelRepository.getChannels(
    {
      channelIds: [channelId, 'channel-2'],
    },
    ({ data: channels, loading, error }) => {
      if (error) handleError(error);

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

  unsubscribe();
  ```

  ```swift iOS theme={null}
  let channelIds = ["channel-1", "channel-2"]
  let channels = channelRepository.getChannels(channelIds: channelIds)

  token = channels.observe { collection, error in
      if let error {
          handleError(error)
          return
      }

      showSuccessMessage(collection.snapshots.count)
  }
  ```

  ```kotlin Android theme={null}
  val channelIds = listOf(channelId, "channel-2")

  val disposable = channelRepository
      .getChannels(channelIds = channelIds)
      .subscribe(
          { channels -> showSuccessMessage(channels.size) },
          { error -> handleGeneralError(error) },
      )
  ```
</CodeGroup>

## Related Topics

<CardGroup cols={2}>
  <Card title="Create Channels" href="./create-channel" icon="plus">
    Create community, live, or conversation channels.
  </Card>

  <Card title="Query Channels" href="./query-channels" icon="list-filter">
    Build paginated channel lists from filters.
  </Card>

  <Card title="Update Channels" href="./update-channel" icon="pen">
    Update channel attributes after retrieval.
  </Card>

  <Card title="Message Preview" href="../../engagement-features/message-preview" icon="message-square">
    Render latest-message preview data from channel objects.
  </Card>
</CardGroup>
