Telegram MTProto icon

Telegram MTProto

Full-featured Telegram MTProto client (Pyrogram equivalent)

Chat → Ban User

AI-generated

Summary

Ban a user from a specified Telegram chat by setting comprehensive banned rights, preventing them from viewing or interacting with the chat content.

Inputs

  • chatId (required) — The ID, username (@username), or phone number of the chat where the user will be banned.
  • userId (required) — The user ID or username of the user to ban in the chat.

Output shape

a single JSON object representing the result from Telegram API of the ban request, including updated chat/channel state or confirmation details

Returns the Telegram API response from invoking the chat ban; no pagination or additional metadata. Errors are thrown unless 'continue on fail' is enabled, in which case error message is returned in JSON.

Examples

Example 1: Ban user @exampleuser from chat @examplechat

Set resource to Chat, operation to Ban User, provide chatId as '@examplechat' and userId as '@exampleuser'.

Discussion