Skip to main content
Use the block API when the current user wants to block another user. Use the unblock API to remove that block. The SDK updates relationship data after block and unblock calls. TypeScript returns the updated payload (follows and followCounts). iOS, Android, and Flutter expose these actions as async or completable operations.
Blocking removes follows and pending follow requests between the two users, in both directions. You don’t need to call unfollow before blockUser. See Effect on follow relationships.

Parameters

Block User

Block a user when the current user wants to prevent or limit relationship-based interactions with that account.
On TypeScript, follows[0] is the relationship from the current user to the blocked user, with status blocked. followCounts[0] holds the current user’s updated follower, following, and pending counts. The response does not include the blocked user’s counts.

Handle the blocked-user limit

A network caps how many users one account can block, and how many accounts can block one user. Either limit makes the block call fail instead of succeeding:
  • The current user is at their block limit. The call fails with a “maximum blocked users reached” error. On TypeScript this surfaces as the server error code Amity.ServerError.MAX_BLOCKED_USERS_REACHED (400324). Prompt the user to unblock someone before blocking another account.
  • The target user is already blocked by the maximum number of accounts. The call fails with a general bad-request error that has no dedicated error code. Treat it as a generic failure.

Unblock User

Unblock a user when the current user removes a previously created block. Unblocking a user who is not blocked fails with a bad-request error.
On TypeScript, follows[0] has status none after an unblock.

Effect on Follow Relationships

A block replaces the follow relationship between the two users. The diagram and table show the status in each direction, where the current user is the one calling blockUser or unblockUser.
  • Unblocking does not restore follows. After an unblock, either user must follow the other again. On networks that require follow approval, that means a new follow request.
  • Follow counts change for both users. Removing follows and pending requests can lower each user’s follower, following, and pending counts. The block response carries only the current user’s counts, so refresh the target user’s counts wherever your UI shows them.
  • Each user’s block is independent. When both users blocked each other, one user’s unblock leaves the other user’s block in place, and following stays rejected until both blocks are removed.
  • Following is rejected while a block is in place. The current user can’t follow a user they blocked, and the blocked user can’t follow the user who blocked them. See Follow/Unfollow User.
  • To remove a block, call unblockUser. Calling unfollow on a user the current user blocked fails with a bad-request error and leaves the block in place.

After Block Or Unblock

After a successful block or unblock action:
  • Refresh follow info if the current screen shows relationship status or counters.
  • Refresh follower/following lists if the current screen displays social graph data.
  • Refresh blocked-user lists if the current screen lets users manage blocked accounts.
  • Post and comment queries leave out content authored by users in either block direction. On TypeScript, iOS, and Android, turn on excludeBlockUserPosts and excludeBlockUserComments to also drop content that is already loaded, and posts that mention those users. See Users Who Blocked You.

Manage Blocked Users

Query the blocked-user list.

Users Who Blocked You

Query the reverse direction.

Follow/Unfollow User

Change follow relationships.