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

# Ban Management

> Ban and unban chat channel members with the current SDK APIs.

Use channel bans when a member should lose access to a specific chat channel until a moderator restores access. The SDK operation is per-channel; ban reasons, appeal flows, and moderation audit logs are app-owned product logic.

## Platform Surface

| Operation | TypeScript | iOS | Android | Flutter |
| - | - | - | - | - |
| Ban members | `ChannelRepository.Moderation.banMembers(channelId, userIds)` | `AmityChannelModeration(channelId:).banMembers(_:)` | `moderation(channelId).banMembers(userIds)` | `moderation(channelId).banMembers(userIds)` |
| Unban members | `ChannelRepository.Moderation.unbanMembers(channelId, userIds)` | `AmityChannelModeration(channelId:).unbanMembers(_:)` | `moderation(channelId).unbanMembers(userIds)` | `moderation(channelId).unbanMembers(userIds)` |
| Result | Cached channel memberships | `Void` | `Completable` | `Future` |

## Parameters

| Parameter | Required | Description |
| - | - | - |
| `channelId` | Yes | Channel ID where the ban or unban should be applied. |
| `userIds` | Yes | One or more user IDs to ban or unban. Empty lists are rejected. |
| Moderation permission | Yes | The current user must have permission to moderate the target channel. |

## Ban Members

Ban removes the users from channel participation and prevents them from rejoining until they are unbanned.

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

const banned = await ChannelRepository.Moderation.banMembers(channelId, [
  userId,
]);

renderResults(banned.data);
```

```swift iOS theme={null}
let moderation = AmityChannelModeration(channelId: channelId)

try await moderation.banMembers([userId])

showSuccessMessage(channelId)
```

```kotlin Android theme={null}
val disposable = channelRepository
    .moderation(channelId = channelId)
    .banMembers(userIds = listOf(targetUserId))
    .subscribe(
        { showSuccessMessage(channelId) },
        { error -> handleGeneralError(error) },
    )
```

```dart Flutter theme={null}
await AmityChatClient.newChannelRepository()
    .moderation(channelId)
    .banMembers([targetUserId]);
```

## Unban Members

Unban restores the users to the channel's allowed membership state. If your app shows a ban list, refresh that list after the operation succeeds.

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

const unbanned = await ChannelRepository.Moderation.unbanMembers(channelId, [
  userId,
]);

renderResults(unbanned.data);
```

```swift iOS theme={null}
let moderation = AmityChannelModeration(channelId: channelId)

try await moderation.unbanMembers([userId])

showSuccessMessage(channelId)
```

```kotlin Android theme={null}
val disposable = channelRepository
    .moderation(channelId = channelId)
    .unbanMembers(userIds = listOf(targetUserId))
    .subscribe(
        { showSuccessMessage(channelId) },
        { error -> handleGeneralError(error) },
    )
```

```dart Flutter theme={null}
await AmityChatClient.newChannelRepository()
    .moderation(channelId)
    .unbanMembers([targetUserId]);
```

## Implementation Notes

> [card] Permission Checks
>
> The SDK call can fail when the current user cannot moderate the channel or the target user cannot be moderated. Handle permission and validation errors in your UI.

> [card] Channel Scope
>
> A channel ban applies to the target channel. It is not a global user block and does not replace user-level block or content flag workflows.

> [card] Product Policy
>
> Store ban reasons, moderator notes, appeal state, or compliance records in your own system if your product requires them.

> [card] Member Lists
>
> Query channel members with banned-membership filters when you need to render a ban list or confirm current ban state.

## Related Topics

> [card] [Query Members](/social-plus-sdk/chat/conversation-management/members/query-members.md)
>
> Filter channel members by membership state.

> [card] [Mute Management](/social-plus-sdk/chat/conversation-management/channels/governance/mute-management.md)
>
> Temporarily restrict message sending.

> [card] [Member Management](/social-plus-sdk/chat/conversation-management/channels/governance/member-management.md)
>
> Add or remove channel members.


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