---
title: "Ban user"
method: POST
path: "/moderation/ban"
tags: ["product:chat"]
---

# Ban user

`POST /moderation/ban`

Restricts user activity either in specific channel or globally

Sends events:
- user.banned
- user.messages.deleted

## Request body

- BanRequest, nullable
  - `ban_from_future_channels` boolean — Whether to also ban the user from all future channels created by the banner
  - `banned_by` UserRequest — User request object
    - `custom` object — Custom user data
    - `id` string, required — User ID
    - `image` string — User's profile image URL
    - `invisible` boolean
    - `language` string
    - `name` string — Optional name of user
    - `privacy_settings` PrivacySettingsResponse
      - `delivery_receipts` DeliveryReceiptsResponse
        - `enabled` boolean
      - `read_receipts` ReadReceiptsResponse
        - `enabled` boolean
      - `typing_indicators` TypingIndicatorsResponse
        - `enabled` boolean
    - `role` string — User's global role
    - `teams` string[] — List of teams the user belongs to
    - `teams_role` object — Map of team-specific roles for the user
  - `banned_by_id` string — User ID who issued a ban
  - `channel_cid` string — Channel CID to ban user in eg. messaging:123
  - `delete_messages` 'soft' | 'pruning' | 'hard'
  - `delete_reactions` boolean — Whether to delete reactions by the banned user on other users' messages
  - `ip_ban` boolean — Whether to perform IP ban or not
  - `reason` string — Ban reason
  - `shadow` boolean — Whether to perform shadow ban or not
  - `target_user_id` string, required — ID of user to ban
  - `timeout` integer — Timeout of ban in minutes. User will be unbanned after this period of time
  - `user` UserRequest — User request object
    - `custom` object — Custom user data
    - `id` string, required — User ID
    - `image` string — User's profile image URL
    - `invisible` boolean
    - `language` string
    - `name` string — Optional name of user
    - `privacy_settings` PrivacySettingsResponse
      - `delivery_receipts` DeliveryReceiptsResponse
        - `enabled` boolean
      - `read_receipts` ReadReceiptsResponse
        - `enabled` boolean
      - `typing_indicators` TypingIndicatorsResponse
        - `enabled` boolean
    - `role` string — User's global role
    - `teams` string[] — List of teams the user belongs to
    - `teams_role` object — Map of team-specific roles for the user
  - `user_id` string

## Response `201`

Response

- Response, nullable — Basic response information
  - `duration` string, required — Duration of the request in milliseconds

## Other responses

- `400` — Bad request
- `429` — Too many requests

---

[API](https://skmtc.net/getstream/apis/stream-api.md) · [All operations](https://skmtc.net/getstream/apis/stream-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/getstream/stream-api/versions/509a44ead023/schema)
