How to get a chat_id for the Telegram Bot API
A chat_id tells the Bot API where to send a message. For a private chat it's the user's ID; for groups and channels it's the chat's ID. The quickest way to get either is @userid_bot; developers can also read it from getUpdates.
The fast way
- Your own chat_id: open @userid_bot and press Start. Your ID is your private chat_id.
- A group or channel: tap Group or Channel in @userid_bot and pick it.
With getUpdates
- Send any message to your bot (or post in the group or channel where your bot is an admin).
- Open this URL in a browser, with your own token:
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates - Find
"chat":{"id": ...}in the response. For channel posts look inchannel_post.chat.id.
If the response is empty, send a new message and reload. If you get a "Conflict" error, your bot has a webhook set; getUpdates doesn't work while a webhook is active.
Send a test message
curl -s "https://api.telegram.org/bot<YOUR_TOKEN>/sendMessage" \
-d chat_id=-1001234567890 \
-d text="Hello from my bot"
chat_id formats
| Chat type | Example |
|---|---|
| Private chat (user) | 6152847391 |
| Basic group | -412345678 |
| Supergroup / forum | -1001234567890 |
| Channel | -1001234567890 or @channelusername |
Common errors
- "chat not found": wrong ID (often the
-100is missing), or the bot isn't in that group or channel. - "bot can't initiate conversation with a user": the person has to press Start in your bot first.
- "not enough rights to send": make the bot an admin with permission to post (channels).
Never paste your bot token into websites or share it. Anyone with the token controls your bot.