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

# Get Posts

> Retrieve one post as a live object, or fetch a known set of post IDs where the SDK supports batch lookup.

Use post retrieval when your app already knows the post ID. Single-post retrieval returns a live object or stream on every SDK. Batch lookup is available on TypeScript, iOS, and Android.

## Parameters

| Operation | Parameter | Required | Description |
| - | - | - | - |
| Single post | `postId` | Yes | Unique post ID to observe or fetch. |
| Multiple posts by ID | `postIds` | Yes | List or set of post IDs to fetch on TypeScript, iOS, and Android. |

## Single Post

Observe a single post when a detail screen should update as post data, counters, or moderation state changes.

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

const unsubscribe = PostRepository.getPost(
  postId,
  ({ data: post, loading, error }) => {
    if (loading) return;
    if (error) {
      handleError(error);
      return;
    }
    if (post) {
      renderResults(post);
    }
  },
);
```

```kotlin Android theme={null}
postRepository.getPost(postId)
    .subscribe(
        { post -> showSuccessMessage(post.getPostId()) },
        { error -> handleGeneralError(error) }
    )
```

```swift iOS theme={null}
let postRepository = AmityPostRepository()
var token: AmityNotificationToken?

token = postRepository.getPost(withId: "post-id").observe { liveObject, error in
    guard let post = liveObject.snapshot else { return }
    showSuccessMessage(post.postId)
}
```

```dart Flutter theme={null}
final subscription = AmitySocialClient.newPostRepository()
    .live
    .getPost(postId)
    .listen((AmityPost post) {
      final id = post.postId;
    });

await subscription.cancel();
```

## Multiple Posts by ID

Fetch a known set of post IDs when your app already has exact IDs and does not need a paged feed query.

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

const { data: posts } = await PostRepository.getPostByIds([
  postId,
  "another-post-id",
]);
```

```kotlin Android theme={null}
postRepository.getPostByIds(setOf(postId, "another-post-id"))
    .subscribe(
        { posts -> showSuccessMessage(posts.size) },
        { error -> handleGeneralError(error) }
    )
```

```swift iOS theme={null}
let postRepository = AmityPostRepository()
var token: AmityNotificationToken?

token = postRepository.getPosts(postIds: ["post-id", "another-post-id"]).observe { collection, error in
    showSuccessMessage(collection.snapshots.count)
}
```

> [!NOTE]
>
> The current Flutter public post repository exposes single-post retrieval through `live.getPost(postId)` and the deprecated `getPost(postId)` future, but it does not expose a public batch get-by-IDs method.

## Notes

* Keep the unsubscriber or notification token so you can dispose the live object when the screen is destroyed.
* Use query APIs when you need a feed, pagination, filtering, or real-time collection updates.
* Batch lookup skips invalid IDs on iOS collection results; handle an empty collection as a valid outcome.

## Related Topics

> **[Query Posts](/social-plus-sdk/social/content-management/posts/retrieval/query-posts.md)**
>
> Query posts by feed target, post type, review status, or tags.

> **[Viewing Content](/social-plus-sdk/social/content-management/posts/retrieval/viewing-content.md)**
>
> Render post data and child media safely.

> **[Post Overview](/social-plus-sdk/social/content-management/posts/overview.md)**
>
> Review post structure and post data types.


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