promoteChatMember
Promote or demote a chat member to administrator.
Request
POST /:token/promotechatmember
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| chat_id | Integer/String | Yes | Unique identifier or username of the target chat |
| user_id | Integer | Yes | Unique identifier of the target user |
| is_anonymous | Boolean | No | Whether the administrator's actions should be anonymous |
| can_manage_chat | Boolean | No | Whether the administrator can manage the chat (access chat statistics, view channel member list, etc.) |
| can_post_messages | Boolean | No | Whether the administrator can post messages in the channel (channels only) |
| can_edit_messages | Boolean | No | Whether the administrator can edit messages in the channel (channels only) |
| can_delete_messages | Boolean | No | Whether the administrator can delete messages |
| can_manage_video_chats | Boolean | No | Whether the administrator can manage video chats |
| can_restrict_members | Boolean | No | Whether the administrator can restrict, ban, or unban members |
| can_promote_members | Boolean | No | Whether the administrator can add new administrators |
| can_change_info | Boolean | No | Whether the administrator can change the chat title, photo, and other settings |
| can_invite_users | Boolean | No | Whether the administrator can invite new users to the chat |
| can_pin_messages | Boolean | No | Whether the administrator can pin messages |
All optional permission parameters default to
false. Passtrueto grant a permission andfalseto revoke it. To demote an administrator to a regular member, set all permission parameters tofalse.
Response
Returns Boolean true on success.
json
{
"ok": true,
"result": true
}Error Codes
| Code | Description |
|---|---|
| 400 | Bad request parameters, such as missing chat_id or user_id |
| 401 | Invalid or expired token |
| 403 | Bot does not have sufficient administrator privileges to perform this action |
| 404 | Chat or user not found |
| 500 | Internal server error |
Example
cURL
Promote to administrator (grant partial permissions)
bash
curl -X POST "https://api.example.com/<token>/promotechatmember" \
-H "Content-Type: application/json" \
-d '{
"chat_id": -1001234567890,
"user_id": 987654321,
"can_manage_chat": true,
"can_delete_messages": true,
"can_restrict_members": true,
"can_invite_users": true,
"can_pin_messages": true
}'Demote to regular member
bash
curl -X POST "https://api.example.com/<token>/promotechatmember" \
-H "Content-Type: application/json" \
-d '{
"chat_id": -1001234567890,
"user_id": 987654321,
"can_manage_chat": false,
"can_delete_messages": false,
"can_restrict_members": false,
"can_invite_users": false,
"can_pin_messages": false
}'