We offer two kinds of APIs for developers. The Bot API allows you to easily create programs that use Telegram messages for an interface. The Telegram API and TDLib allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge.

You can also add Telegram Widgets to your website.

Designers are welcome to create Animated Stickers or Custom Themes for Telegram.

Bot API

This API allows you to connect bots to our system. Telegram Bots are special accounts that do not require an additional phone number to set up. These accounts serve as an interface for code running somewhere on your server.

To use this, you don't need to know anything about how our MTProto encryption protocol works — our intermediary server will handle all encryption and communication with the Telegram API for you. You communicate with this server via a simple HTTPS-interface that offers a simplified version of the Telegram API.

Bot developers can also make use of our Payments API to accept payments from Telegram users around the world.

TDLib – build your own Telegram

Even if you're looking for maximum customization, you don't have to create your app from scratch. Try our Telegram Database Library (or simply TDLib), a tool for third-party developers that makes it easy to build fast, secure and feature-rich Telegram apps.

TDLib takes care of all network implementation details, encryption and local data storage, so that you can dedicate more time to design, responsive interfaces and beautiful animations.

TDLib supports all Telegram features and makes developing Telegram apps a breeze on any platform. It can be used on Android, iOS, Windows, macOS, Linux and virtually any other system. The library is open source and compatible with virtually any programming language.

Telegram API

This API allows you to build your own customized Telegram clients. It is 100% open for all developers who wish to create Telegram applications on our platform. Feel free to study the open source code of existing Telegram applications for examples of how things work here. Don't forget to register your application in our system.

Getting started

How to get your application identifier and create a new Telegram app.

How to register a user's phone to start using the API.

How to login to a user's account if they have enabled 2FA, how to change password.

QR code login flow

How to handle API return errors correctly.

How to connect to the closest DC access point for faster interaction with the API, and things to watch out for when developing a client.

How to subscribe to updates and handle them properly.

How to subscribe and handle them properly.

How to handle channels, supergroups, groups, and what's the difference between them.

Telegram offers detailed channel statistics for channels with more than 500 subscribers.

Additional options for calling methods.

How to transfer large data batches correctly.

How to fetch results from large lists of objects.

The MTProto API has multiple client configuration parameters that can be fetched with the appropriate methods.

Security

End-to-end-encrypted messaging.

Important checks required in your client application.

Binding temporary authorization key to permanent ones.

End-to-end-encrypted calls.

Optimization

Ways to boost API interactions.

API methods

A list of available high-level methods.

Text and JSON-presentation of types and methods used in API.

A list of available schema versions.

Other articles

How to handle admin permissions, granular bans and global permissions in channels, groups and supergroups.

Sometimes, user and channel constructors met in group chat updates may not contain full info about the user: how to handle such constructors.

How to reset an account if the 2FA password was forgotten.

How to work with Telegram Passport directly using the MTProto API.

How to work with Telegram Payments directly using the MTProto API.

How to create styled text with message entities

Graphical telegram clients should transform emojis into their respective animated version.

Telegram supports sending animated dice emojis.

How to handle message drafts

Working with folders

If enabled, the rating of top peers indicates the relevance of a frequently used peer in a certain category (frequently messaged users, frequently used bots, inline bots, frequently visited channels and so on).

How to handle file references.

Handle Seamless Telegram Login URL authorization requests.

When interacting with HTML5 games and the websites of payment gateways, Telegram apps should expose the following JS APIs.