How to Get Your Telegram API Key (ID & Hash) in 2026

Written by

in

Telegram does not issue a single “API key” like many REST services. Instead, which credential you need depends on what you are building:

  • Client API (api_id and api_hash): Required when building a custom Telegram client, Telegram’s proprietary messaging protocol for client-server communication. integration, or a user-account script (using libraries like Telethon or Pyrogram). Each phone number can have only one api_id connected to it.
  • Bot API (Bot Token): Required when building a standard Telegram bot that talks to Telegram’s HTTPS Bot API. You can create multiple bots and get a separate token for each one.

Getting Client API Credentials (api_id and api_hash)

  1. Log in to the developer portal: Open [https://my.telegram.org](https://my.telegram.org) in a browser and sign in using the phone number linked to your active Telegram account. Enter the login code delivered inside your Telegram app.
  2. Open API settings: Select API development tools on your account page.
  3. Register your application: Fill out the form with an App title and Short name (alphanumeric characters), choose your target Platform, and submit.
  4. Copy your credentials: Telegram displays your numeric api_id and secret api_hash immediately. Save both in environment variables or a secret manager rather than hardcoding them in source files.

Note: If my.telegram.org throws an error during creation, check that you are not routing traffic through a VPN or proxy that triggers anti-abuse blocks, and verify that your Telegram account is established and in good standing.


Getting a Bot API Token

If you only need a bot token rather than raw client credentials, you do not use my.telegram.org:

  1. Search for and open @BotFather inside Telegram.
  2. Send /newbot and follow the prompts to enter a display name and a unique username ending in bot.
  3. Copy the HTTP API token BotFather returns and store it securely.

Credentials and Security at a Glance

Credential Type Where You Get It Best For Key Rule to Remember
api_id + api_hash my.telegram.org Custom clients, MTProto tools, user scripts Tied to one phone number per api_id
Bot Token @BotFather in Telegram Standard bots over the HTTP Bot API Treat like a password; revoke via @BotFather if leaked

Keep your api_hash and bot tokens out of public repositories, respect Telegram’s API Terms of Service to avoid account restrictions or bans, and keep your phone number active so you receive developer notices.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *