# How to get a Telegram api_id and api_hash

Step by step: my.telegram.org, the app form and the rules that get accounts banned.

https://shiba-bank.com/en/guides/telegram-api-id

Updated 2026-10-02 · 2 min read

api_id and api_hash are the app keys for the Telegram API (MTProto). You need them to write your own Telegram client or a program that signs in to Telegram as a user — for example, with Telethon, Pyrogram or TDLib. Bots don't need them: a bot works with a token from @BotFather.

## How to get api_id and api_hash

1. Sign up for Telegram with an official app.
2. Open [my.telegram.org](https://my.telegram.org) and log in with your phone number — the confirmation code arrives in Telegram.
3. Open "API development tools".
4. Fill in the form: the app's title (App title), a short name (Short name) and the platform.
5. Save — the page now shows **App api_id** and **App api_hash**.

Each phone number can have only one api_id.

> **Important:** Use a number you actually use: Telegram sends important developer notifications to it.

See also: [How to create a Telegram bot](https://shiba-bank.com/en/guides/create-telegram-bot).

## How to keep the keys

- api_hash is a secret. Don't publish it in open code, on GitHub or in chats.
- Don't use someone else's keys from examples on the internet in your app: published keys get the `API_ID_PUBLISHED_FLOOD` error, and logging in with them fails.
- The keys are tied to your account — you are responsible for what an app does with them.

## What Telegram bans for

Under the Telegram API rules, an account is banned forever for flooding, spamming or faking channel subscriber and view counts through the API. Accounts that sign in through unofficial clients are put under observation. If you were banned by mistake, Telegram suggests writing to recover@telegram.org and describing how you use the API.

## If you need Stars and Premium, not keys

To sell something for Stars in your own bot you don't need an api_id — the Bot API is enough: [how to accept Stars payments in a bot](https://shiba-bank.com/en/guides/stars-payments-in-bot). And buying Stars or Premium for your users from your own program is done through the Shiba Bank bot's API — [the Telegram Stars API](https://shiba-bank.com/en/guides/telegram-stars-api).

## FAQ

### Where do I get a Telegram api_id and api_hash?
On my.telegram.org: log in with your phone number, open "API development tools" and fill in the app form.

### Does a bot need an api_id?
No. A bot works through the Bot API with a token from @BotFather. api_id and api_hash are for programs that sign in to Telegram as a user.

### Can I get several api_ids?
Only one api_id per phone number.

### Can I share my api_hash?
No. It's the app's secret: keep it out of open code and away from strangers.
