API use cases

Does a Telegram bot need api_id and api_hash?

Compare hosted Bot API, MTProto bot authorization and self-hosted Bot API Server. Find out when you need a Bot Token, application ID and API hash for your integration.

GetTGAPI editorial teamUpdated

Quick answer: Telegram's hosted HTTP Bot API normally requires a Bot Token from BotFather. MTProto bot authorization and the official self-hosted Bot API Server additionally involve api_id and api_hash. These credentials are not interchangeable.

Many searches for a “Telegram API key” conflate application credentials and a bot's Token. Check the software's fields and protocol before applying for anything.

Compare the three approaches

Approach Credentials Typical purpose
Hosted Bot API Bot Token Menus, support, notifications, forms and bot payments
MTProto bot authorization api_id, api_hash and Bot Token Methods that explicitly allow bots
Official self-hosted Bot API Server Application credentials for the server; Token for bot requests Your own Bot API service and associated file capabilities

A bot authorized through MTProto remains a bot. Adding application credentials does not grant user-account permissions. Check each method's allowed identities.

Start ordinary bot features with Bot API

Commands, buttons, replies, media and basic group administration usually fit Bot API. A Mini App is a web application associated with a bot; it needs its own initialization-data validation. API Hash is not a website login password.

Inline bots, games and Business connections have their own interfaces. Do not collect customer user sessions simply because a broader integration seems attractive. Consult the bot development reference.

Validate one menu first

  1. Obtain the Token for a bot you control and keep it in restricted server configuration.
  2. Choose webhook or long polling and prevent competing processes from consuming updates.
  3. Have a test user open the bot, send /start and interact with a menu.
  4. Test text, photos, files, invalid input and duplicate update handling.
  5. Consider MTProto or self-hosting only when a required capability justifies it.

An accessible API does not let a bot privately message arbitrary phone numbers. Notifications require an established, permitted interaction under Telegram's bot rules.

Diagnose the right credential problem

Symptom First check
Token required but you have only ID and hash Whether you used the wrong credential source
Three credential fields required MTProto bot login or self-hosted server configuration
Bot cannot read full chat history Identity and method permissions
Menu appears but callbacks do not arrive Update delivery, running instances and service errors

Do not expose Tokens in public screenshots or URL logs. Tokens, API hashes and user sessions have different roles, but none belongs in an arbitrary third-party diagnostic form.

BotFather or GetTGAPI?

Manage a missing Bot Token through official BotFather. For application credentials, follow the developer portal guide. If that portal returns ERROR, contact GetTGAPI at gettgapi.com/en/help#contact, or use an access code at the application page.

GetTGAPI assists with developer application credentials. It does not sell Bot Tokens or require hosted Bot API users to obtain unnecessary credentials.

Official references