Skip to content

setMyDefaultAdministratorRights

Set the bot's default administrator rights when added as an administrator.

Request

POST /:token/setmydefaultadministratorrights

Parameters

ParameterTypeRequiredDescription
rightsChatAdministratorRightsNoDefault administrator rights object for the bot. If not specified, the previously set default rights will be cleared
for_channelsBooleanNoIf set to true, sets the default administrator rights for channels; otherwise sets the default administrator rights for groups and supergroups. Defaults to false

ChatAdministratorRights Object

FieldTypeDescription
is_anonymousBooleanWhether the administrator's actions should be anonymous
can_manage_chatBooleanWhether the administrator can manage the chat
can_delete_messagesBooleanWhether the administrator can delete messages
can_manage_video_chatsBooleanWhether the administrator can manage video chats
can_restrict_membersBooleanWhether the administrator can restrict members
can_promote_membersBooleanWhether the administrator can promote members to administrators
can_change_infoBooleanWhether the administrator can change chat information
can_invite_usersBooleanWhether the administrator can invite users
can_post_messagesBooleanWhether the administrator can post messages in the channel (channels only)
can_edit_messagesBooleanWhether the administrator can edit messages in the channel (channels only)
can_pin_messagesBooleanWhether the administrator can pin messages (groups and supergroups only)

Response

Returns Boolean true on success.

json
{
  "ok": true,
  "result": true
}

Error Codes

CodeDescription
400Bad request parameters, such as invalid rights format
401Invalid or expired token
500Internal server error

Example

cURL

Set default administrator rights for groups

bash
curl -X POST "https://api.example.com/<token>/setmydefaultadministratorrights" \
  -H "Content-Type: application/json" \
  -d '{
    "rights": {
      "is_anonymous": false,
      "can_manage_chat": true,
      "can_delete_messages": true,
      "can_manage_video_chats": false,
      "can_restrict_members": true,
      "can_promote_members": false,
      "can_change_info": false,
      "can_invite_users": true,
      "can_pin_messages": true
    }
  }'

Set default administrator rights for channels

bash
curl -X POST "https://api.example.com/<token>/setmydefaultadministratorrights" \
  -H "Content-Type: application/json" \
  -d '{
    "rights": {
      "is_anonymous": false,
      "can_manage_chat": true,
      "can_delete_messages": true,
      "can_post_messages": true,
      "can_edit_messages": true,
      "can_invite_users": true
    },
    "for_channels": true
  }'

Clear default administrator rights

bash
curl -X POST "https://api.example.com/<token>/setmydefaultadministratorrights" \
  -H "Content-Type: application/json" \
  -d '{}'