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

> Retrieve a community by ID and observe community updates with the SDK.

Call the get-community API with a `communityId` to retrieve a community's profile fields, counts, membership status, and settings. TypeScript and iOS expose Live Object style APIs, Android exposes an Rx stream, and Flutter exposes both a deprecated one-shot future and a live stream.

<CardGroup cols={2}>
  <Card title="Community Details" icon="circle-info">
    Access name, description, avatar, and basic community information
  </Card>

  <Card title="Membership Data" icon="users">
    View member counts, join status, and community accessibility
  </Card>

  <Card title="Live Updates" icon="bolt">
    Real-time synchronization of community changes and member activity
  </Card>

  <Card title="Preview Mode" icon="eye">
    Retrieve community data without joining
  </Card>
</CardGroup>

<Info>
  Use the live/observable form for detail screens so the UI can react when the community changes.
</Info>

## Parameters

| Operation           | Parameter     | Required | Description                                     |
| ------------------- | ------------- | -------- | ----------------------------------------------- |
| Get community by ID | `communityId` | Yes      | Unique identifier of the community to retrieve. |

## Get Community by ID

The get-community API retrieves a community by ID. Use it for detail screens, join previews, and any workflow that needs the current community record before taking an action.

<CodeGroup>
  ```swift iOS theme={null}
  var token: AmityNotificationToken?

  func observeCommunity(communityId: String) {
      token = communityRepository.getCommunity(withId: communityId).observe { liveObject, error in
          if let error = error {
              print("Error retrieving community: \(error)")
              return
          }

          guard let community = liveObject.snapshot else {
              print("Community not found")
              return
          }

          print("Community ID: \(community.communityId)")
          print("Name: \(community.displayName)")
      }
  }
  ```

  ```kotlin Android theme={null}
  fun observeCommunity() {
      AmitySocialClient.newCommunityRepository()
          .getCommunity(communityId = "communityId")
          .doOnNext { community: AmityCommunity ->
              println("Community ID: ${community.getCommunityId()}")
              println("Name: ${community.getDisplayName()}")
          }
          .doOnError { error ->
              println("Error retrieving community: ${error.message}")
          }
          .subscribe()
  }
  ```

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

  const unsubscriber = CommunityRepository.getCommunity(
    'communityId',
    ({ data: community, loading, error }) => {
      if (error) {
        // Handle any errors that occur during retrieving data
      }
      if (loading) {
        // Handle the loading state, e.g., show a loading spinner
      }
      if (community) {
        // Process the data
      }
    },
  );
  ```

  ```dart Flutter theme={null}
  void observeCommunity(String communityId) {
    AmitySocialClient.newCommunityRepository()
        .live
        .getCommunity(communityId)
        .listen((AmityCommunity community) {
          // Render community.
        }, onError: (error) {
          // Handle error.
        });
  }
  ```
</CodeGroup>

## Related Topics

<CardGroup cols={2}>
  <Card title="Query Communities" href="./query-communities" icon="magnifying-glass">
    Discover communities through search and filtering
  </Card>

  <Card title="Join Community" href="../membership/join-leave-community" icon="user-plus">
    Learn how to implement community membership actions
  </Card>

  <Card title="Community Categories" href="../organization/community-categories" icon="folder">
    Understand community organization and categorization
  </Card>

  <Card title="Trending Communities" href="./trending-and-recommended-communities" icon="arrow-trend-up">
    Implement community recommendation features
  </Card>
</CardGroup>
