Skip to content

deleteChatPhoto

Returns: TrueOfficial docs ↗

Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

Parameters

chat_idIntegerStringRequired
Unique identifier for the target chat or username of the target channel (in the format @channelusername)

Returns

On success, True is returned.

GramIO Usage

ts
// Delete a chat photo by numeric ID
await 
bot
.
api
.
deleteChatPhoto
({
chat_id
: -1001234567890,
});
ts
// Delete a channel photo by username
await 
bot
.
api
.
deleteChatPhoto
({
chat_id
: "@mychannel",
});
ts
// Admin command to remove the current chat photo
bot
.
command
("removephoto", async (
ctx
) => {
await
bot
.
api
.
deleteChatPhoto
({
chat_id
:
ctx
.
chatId
});
await
ctx
.
send
("Chat photo has been removed.");
});

Errors

CodeErrorCause
400Bad Request: chat not foundchat_id is invalid or the bot cannot access this chat
400Bad Request: CHAT_NOT_MODIFIEDThe chat already has no photo — nothing to delete
400Bad Request: can't change chat photo for private chatsThis method only works in groups, supergroups, and channels
403Forbidden: not enough rightsBot is not an admin or lacks the can_change_info administrator right
403Forbidden: bot is not a member of the channel chatBot has no access to the specified channel
429Too Many Requests: retry after NRate limit hit — check retry_after, use auto-retry plugin

Tips & Gotchas

  • Private chats are not supported. This method only applies to groups, supergroups, and channels. There is no API method to remove a photo from a private (DM) chat.
  • Bot must be admin with can_change_info. The bot needs to be a chat administrator and have the can_change_info right specifically — general admin status alone is not enough if this right is absent.
  • Accepts @username for public chats. For public channels and supergroups you can pass @channelusername instead of the numeric ID — useful for bots that manage well-known channels.
  • No need to delete before updating. If you want to replace the photo, just call setChatPhoto directly — it overwrites the current photo without requiring a deletion first.

See Also