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

# Manage Blocked Users

> Query the current user's blocked-user list with the social.plus SDKs.

Use blocked-user list APIs to build a settings screen where users can review accounts they have blocked and unblock them when needed.

There are two read patterns:

| API                    | Best for                            | Platforms                         |
| ---------------------- | ----------------------------------- | --------------------------------- |
| `getBlockedUsers()`    | A paginated management screen       | TypeScript, iOS, Android, Flutter |
| `getAllBlockedUsers()` | A one-shot list for local decisions | TypeScript, iOS, Android          |

<Info>
  These APIs return users the current user has **blocked**. To read the reverse direction — users who have **blocked the current user** — see [Users Who Blocked You](./manage-blocking-users).
</Info>

## Parameters

| Operation             | Parameter           | Required | Description                                                                                                    |
| --------------------- | ------------------- | -------- | -------------------------------------------------------------------------------------------------------------- |
| Get blocked users     | `limit` / page size | No       | Page size for the paginated blocked-user list where the platform exposes it.                                   |
| Get blocked users     | Pagination handle   | No       | Use each platform's live collection, paging, or callback pagination to load more blocked users.                |
| Get all blocked users | None                | No       | Returns a one-shot list on TypeScript, iOS, and Android. Not exposed in the current public Flutter repository. |

## Get Blocked Users

Query blocked users for a paginated account-management screen.

<CodeGroup>
  ```swift iOS theme={null}
  let repository = AmityUserRepository()
  let blockedUsers = repository.getBlockedUsers()

  _ = blockedUsers.observe { collection, error in
      if let error {
          handleError(error)
          return
      }

      let users = collection.snapshots
      _ = users.first?.userId
  }

  blockedUsers.nextPage()
  ```

  ```kotlin Android theme={null}
  val disposable = AmityCoreClient.newUserRepository()
      .getBlockedUsers()
      .subscribe(
          { pagingData: PagingData<AmityUser> ->
              showSuccessMessage(pagingData)
          },
          { error ->
              handleGeneralError(error)
          },
      )
  ```

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

  let loadMoreBlockedUsers: (() => void) | undefined;

  const unsubscribe = UserRepository.getBlockedUsers(
    { limit: 25 },
    ({ data: users, onNextPage, hasNextPage, loading, error }) => {
      if (error) {
        handleError(error);
        return;
      }

      if (!loading && users) {
        renderResults(users);
      }

      loadMoreBlockedUsers = hasNextPage ? onNextPage : undefined;
    },
  );
  ```

  ```dart Flutter theme={null}
  final page = await AmityCoreClient.newUserRepository()
      .getBlockedUsers()
      .getPagingData(limit: 20);

  final blockedUsers = page.data;
  ```
</CodeGroup>

## Get All Blocked Users

Use `getAllBlockedUsers()` when your app needs a one-shot list instead of a paginated collection. TypeScript, iOS, and Android return up to 100 blocked users and use a short SDK-side cache. Call the method again when you need a fresh snapshot.

<CodeGroup>
  ```swift iOS theme={null}
  let repository = AmityUserRepository()
  let blockedUsers = try await repository.getAllBlockedUsers()

  let blockedUserIds = Set(blockedUsers.map { $0.userId })
  ```

  ```kotlin Android theme={null}
  val disposable = AmityCoreClient.newUserRepository()
      .getAllBlockedUsers()
      .subscribe(
          { users: List<AmityUser> ->
              val blockedUserIds = users.map { it.getUserId() }.toSet()
              showSuccessMessage(blockedUserIds)
          },
          { error ->
              handleGeneralError(error)
          },
      )
  ```

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

  const blockedUsers = await UserRepository.getAllBlockedUsers();
  const blockedUserIds = new Set(blockedUsers.map((user) => user.userId));
  ```
</CodeGroup>

<Warning>
  The one-shot API is not available in the Flutter public repository. For Flutter, use `getBlockedUsers().getPagingData(...)` and page through the result.
</Warning>

## Related Topics

<CardGroup cols={3}>
  <Card title="Users Who Blocked You" href="./manage-blocking-users" icon="user-slash">
    Query the reverse direction.
  </Card>

  <Card title="Block & Unblock User" href="./block-unblock-user" icon="ban">
    Change blocked status.
  </Card>

  <Card title="Follower Lists" href="../following/get-follower-following-list" icon="list">
    Query social graph lists.
  </Card>
</CardGroup>
