How to Get a Telegram Chat ID for a User, Group, Channel or Topic
A Telegram chat id is the number the Bot API uses to identify a chat: you pass it as chat_id to sendMessage and every other method that targets a chat. The fastest way to get it: send a message to your bot, call getUpdates and read message.chat.id. Below is how to get the chat id of a private chat, a group, a channel or a forum topic, and what to do when getUpdates returns nothing.
What a Telegram chat id looks like
| Chat type | Example | Notes |
|---|---|---|
| Private chat with a user | 123456789 | Positive; equals the user's id |
| Basic group | -123456789 | Negative, without the -100 prefix |
| Supergroup | -1001234567890 | Starts with -100 |
| Channel | -1001234567890 | Starts with -100 |
| Public channel or supergroup | @channelusername | The username also works as chat_id |
Chat ids can be longer than 32 bits (up to 52 significant bits), so store them as 64-bit integers, such as BIGINT in SQL, not a 32-bit INT. JavaScript numbers hold them safely. Always copy the full value with the minus sign: a dropped -100 is the classic cause of chat not found.
How to get a chat id with getUpdates
- Open your bot in Telegram and press Start or send any text. Bots can't message users who haven't started them, and there is no update until someone writes.
- Call
getUpdateswith your token, in a browser or with curl. - Find the update with your message and copy
message.chat.id.
curl "https://api.telegram.org/bot123456789:AAEexampleTokenReplaceWithYours/getUpdates"
{
"ok": true,
"result": [
{
"update_id": 870123457,
"message": {
"message_id": 12,
"from": {"id": 123456789, "is_bot": false, "first_name": "Alex"},
"chat": {"id": 123456789, "first_name": "Alex", "type": "private"},
"date": 1793266200,
"text": "hi"
}
}
]
}
No terminal? Open getUpdates in the Bot API Tester, start long polling and write to your bot: the update with chat.id appears in the history. Starting polling there removes an existing webhook, so restore it afterwards if your bot depends on one.
When there are many updates, this Python script prints every chat it finds, whatever the update type:
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
data = requests.get(f"https://api.telegram.org/bot{TOKEN}/getUpdates", timeout=10).json()
if not data["ok"]:
raise SystemExit(f'{data["error_code"]}: {data["description"]}')
for update in data["result"]:
for kind, payload in update.items():
if isinstance(payload, dict) and "chat" in payload:
chat = payload["chat"]
name = chat.get("title") or chat.get("first_name")
print(kind, chat["id"], chat["type"], name)
Telegram group chat id
- Add the bot to the group.
- Send
/start@your_botin the group, with your bot's username. By default bots run in privacy mode and receive only commands meant for them, replies to their messages and service messages, so an ordinary "hi" never reaches the bot. - Call
getUpdatesand copymessage.chat.id: a negative number, with the-100prefix for supergroups.
Often adding the bot is enough by itself: it produces a my_chat_member update and a service message, both containing the group's chat.id. If the bot should read every message, disable privacy mode with /setprivacy in @BotFather and re-add the bot to the group, or make it an administrator.
One catch: when a basic group is upgraded to a supergroup, its id changes. Sending to the old id fails with 400 Bad Request: group chat was upgraded to a supergroup chat, and the response carries the new id in parameters.migrate_to_chat_id. Save it and retry.
Telegram channel chat id
Public channel: you don't need the number. Use "chat_id": "@channelusername" directly, or call getChat with the username if you want the numeric id anyway. To post, the bot must be a channel administrator either way.
Private channel:
- Add the bot to the channel as an administrator.
- Publish a post in the channel.
- Call
getUpdatesand readchannel_post.chat.id.
{"update_id": 870123460, "channel_post": {"message_id": 15, "chat": {"id": -1001234567890, "title": "My Channel", "type": "channel"}, "date": 1793266300, "text": "test"}}
Another trick: copy the link of any post. Private links look like https://t.me/c/1234567890/15; put -100 in front of the number after /c/ to get the Bot API id, -1001234567890. The same works for private supergroups.
Forum topics: message_thread_id
Topics in a forum supergroup share the supergroup's chat id; the topic itself is identified by message_thread_id. Send /start@your_bot inside the topic, call getUpdates and read both message.chat.id and message.message_thread_id (such messages also carry "is_topic_message": true). Pass both values to post into that topic:
curl -X POST "https://api.telegram.org/bot123456789:AAEexampleTokenReplaceWithYours/sendMessage" \
-H "Content-Type: application/json" \
-d '{"chat_id": -1001234567890, "message_thread_id": 42, "text": "Hello, topic!"}'
Troubleshooting: empty result, 409 Conflict, chat not found
"result": []: there are no new updates. Write to the bot and call again. Updates are kept for 24 hours, and an update disappears once it is confirmed, so a running bot or an earlier call withoffsetmay already have consumed yours. In groups, remember privacy mode.409 Conflict: can't use getUpdates method while webhook is active: a webhook is set. CalldeleteWebhook, read the id, then set the webhook again if your bot or an n8n workflow needs it. Alternatively, log incoming updates in your webhook handler.409 Conflict: terminated by other getUpdates request: another process is polling with the same token. Stop it first.400 Bad Request: chat not foundwhen sending: a wrong id or missing-100prefix, a user who never started the bot, or a bot that isn't in the group or channel.403 Forbidden: bot was blocked by the user: the user blocked the bot, and only they can undo it.
curl "https://api.telegram.org/bot123456789:AAEexampleTokenReplaceWithYours/deleteWebhook"
Where you need the chat id
With a token and a chat id you can send notifications from scripts, cron jobs, CI pipelines and monitoring:
curl -X POST "https://api.telegram.org/bot123456789:AAEexampleTokenReplaceWithYours/sendMessage" \
-H "Content-Type: application/json" \
-d '{"chat_id": 123456789, "text": "Backup finished"}'
Automation tools such as n8n and AI assistants that connect to Telegram ask for the same pair: the bot token and the chat id to write to or accept messages from. See how to get and check a Telegram bot token for the first half, and how to send messages with the Bot API for formatting and buttons.
Frequently asked questions
How do I find my Telegram chat id?
Send any message to your bot, open https://api.telegram.org/bot<token>/getUpdates and read message.chat.id. In a private chat it is a positive number equal to your user id.
Why does a Telegram group chat id start with -100?
Supergroups and channels have ids like -1001234567890: -100 followed by the internal id. Basic groups have plain negative ids, and a group gets a new -100… id when it is upgraded to a supergroup.
Why does getUpdates return an empty result?
There are no new updates: send the bot a message and call it again. Updates are kept for only 24 hours, and in groups privacy mode hides ordinary messages, so send /start@your_bot. A 409 Conflict instead means a webhook is set.
Can I use @username instead of a numeric chat id?
Only for public channels and public supergroups: "chat_id": "@channelusername" works there. Users and private chats always need the numeric id, which you get from an update.
How do I get the chat id of a private Telegram channel?
Add the bot to the channel as an administrator, publish a post, call getUpdates and read channel_post.chat.id. It looks like -1001234567890.
Does a Telegram chat id ever change?
User, supergroup and channel ids are permanent. A basic group's id changes when the group is upgraded to a supergroup; the API then returns the new id in parameters.migrate_to_chat_id.
Related guides
How to Create a Telegram Bot: Step by Step with BotFather and Python
How to create a Telegram bot step by step: register it with @BotFather, get the token, test it with getMe and send a first message with curl or Python.
Telegram Bot API 10.0–10.3: Rich Messages, Ephemeral Messages, Guest Mode and More
What's new in Telegram Bot API 10.0–10.3: guest mode, rich messages, streamed drafts, ephemeral messages, join request queries, with JSON examples.
Telegram Bot API Limits: Rate Limits, 429 Errors, File Sizes and Message Length
Telegram Bot API rate limits explained: 30 msg/s, 1 msg/s per chat, 20/min in groups, handling 429 retry_after, plus file size and message length limits.
How to Send a Message with the Telegram Bot API (sendMessage)
Telegram Bot API send message guide: sendMessage with curl, Python and JavaScript, HTML and MarkdownV2 formatting, inline buttons and error fixes.
Telegram Bot Token: How to Get It, Find It Again, Check It and Keep It Safe
Telegram bot token guide: get one from @BotFather, find the token of an existing bot, check it with getMe, revoke a leaked token and store it safely.
How to Set Up a Telegram Bot Webhook: setWebhook, Secret Token and Troubleshooting
Set up a Telegram bot webhook: setWebhook URL requirements, secret_token header check, getWebhookInfo debugging, deleteWebhook and fixes for n8n.
How to Test a Telegram Mini App: From Browser Mock to Real Telegram
Test a Telegram Mini App step by step: browser mock mode, localhost via HTTPS tunnel, test environment, DevTools per platform, initData validation.