banChatMember
Bans a user from a group, supergroup, or channel and blocks them from rejoining via invite links until unbanned. Requires the bot to be an administrator with ban rights.
Instructions
Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"chat_id": "<chat_id>",
"user_id": "<user_id>"
},
"name": "banChatMember"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | Unique identifier for the target group or username of the target supergroup or channel in the format `@username` | |
| user_id | Yes | Unique identifier of the target user | |
| until_date | No | Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only. | |
| revoke_messages | No | Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels. |