How to Get Your Telegram API ID and API Hash
The Telegram API ID and API Hash are credentials needed for building custom Telegram clients or userbots using the MTProto protocol. Here is how to get them.
Step-by-Step Instructions
- Go to my.telegram.org in your browser.
- Enter your phone number (with country code) and click "Next".
- Telegram sends a verification code to your Telegram app (not SMS). Enter it.
- Click "API development tools".
- Fill out the form: App title, Short name, Platform, and Description.
- Click "Create application".
- Your App api_id and App api_hash are displayed. Save them securely.
Important Notes
- You only get one API ID per phone number. You cannot create another one or delete it.
- Never share your API Hash. It is a secret credential. If leaked, someone could impersonate your application.
- The API ID and Hash are different from a Bot Token. Bot Tokens are for the Bot API; API credentials are for MTProto.
What You Can Build
With an API ID, you can build custom Telegram clients, userbots (scripts that run on your own account), message scrapers, account automation, and more using libraries like Telethon (Python) or GramJS (JavaScript).
Frequently Asked Questions
What is the difference between API ID and Bot Token?
A Bot Token is used with the simpler Bot API to control a bot account. An API ID + Hash are used with the lower-level MTProto protocol to build full Telegram clients or automate your personal account (userbots).
Can I get a new API ID if mine is compromised?
No. Telegram only allows one API ID per phone number, and it cannot be deleted or regenerated. If your API Hash is leaked, contact Telegram support. To get a fresh set, you would need a different phone number.