Bot API · Bot token

deleteMessage

Delete a message the bot sent

Deletes a message previously sent by the bot. Only the bot's own messages in its own threads can be deleted. The deletion is delivered to the user over realtime; the message vanishes. Replies to the deleted message survive (reply_to set null).

Request

curl https://api.sprintelex.com/deleteMessage \
  -H "Authorization: Bearer <bot-token>" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":"<chat-id-from-update>","message_id":"<message-id>"}'

Parameters

NameTypeRequiredRules
chat_idstring (UUID)Yesmust be a thread of this bot+env
message_idstring (UUID)Yesmust be a bot-sent message in chat_id

Response

{ ok: true, result: true }

Rate limit: 30 calls per 1-second window per bot+env

Errors

StatusErrorWhen
400chat_id is requiredmissing chat_id
400message_id is requiredmissing message_id
400chat not foundno thread with that id for this bot+env
400message not foundno message with that id in the chat
400only the bot's own messages can be deletedmessage sender_kind is not 'bot'
429rate limit exceeded: 30 messages/sec per botmore than 30 calls in 1 second
500could not delete messageDB delete failed