---
title: "Ban user"
method: POST
path: "/moderation/ban"
tags: ["Users", "Moderation"]
---

# Ban user

`POST /moderation/ban`

Restricts user activity either in specific channel or globally

## Request body

- BanRequest, nullable
  - `banned_by` UserObjectRequest — Represents chat user
    - `ban_expires` string, date-time — Expiration date of the ban
    - `banned` boolean — Whether a user is banned or not
    - `id` string, required — Unique user identifier
    - `invisible` boolean
    - `language` string — Preferred language of a user
    - `push_notifications` PushNotificationSettingsRequest
      - `disabled` boolean
      - `disabled_until` string, date-time
    - `revoke_tokens_issued_before` string, date-time — Revocation date for tokens
    - `role` string — Determines the set of user permissions
    - `teams` string[] — List of teams user is a part of
  - `banned_by_id` string — User ID who issued a ban
  - `id` string — Channel ID to ban user in
  - `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` number — Timeout of ban in minutes. User will be unbanned after this period of time
  - `type` string — Channel type to ban user in
  - `user` UserObjectRequest — Represents chat user
    - `ban_expires` string, date-time — Expiration date of the ban
    - `banned` boolean — Whether a user is banned or not
    - `id` string, required — Unique user identifier
    - `invisible` boolean
    - `language` string — Preferred language of a user
    - `push_notifications` PushNotificationSettingsRequest
      - `disabled` boolean
      - `disabled_until` string, date-time
    - `revoke_tokens_issued_before` string, date-time — Revocation date for tokens
    - `role` string — Determines the set of user permissions
    - `teams` string[] — List of teams user is a part of
  - `user_id` string

## Response `201`

Successful response

- Response, nullable
  - `duration` string, required — Duration of the request in human-readable format

## Other responses

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

---

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