<metaproperty="description"content="We offer three kinds of APIs for developers. The Bot API allows you to easily create programs that use Telegram messages…">
<metaproperty="og:description"content="We offer three kinds of APIs for developers. The Bot API allows you to easily create programs that use Telegram messages…">
<divid="dev_page_content"><p>We offer three kinds of APIs for developers. The <ahref="#bot-api"><strong>Bot API</strong></a> allows you to easily create programs that use Telegram messages for an interface. The <ahref="#tdlib--build-your-own-telegram"><strong>Telegram API and TDLib</strong></a> allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. Lastly, the <ahref="#gateway-api"><strong>Gateway API</strong></a> allows any business, app or website to send verification codes through Telegram instead of traditional SMS.</p>
<p>You can also add <ahref="/widgets"><strong>Telegram Widgets</strong></a> to your website.</p>
<p>Designers are welcome to create <ahref="/animated_stickers"><strong>Animated Stickers</strong></a> or <ahref="/themes"><strong>Custom Themes</strong></a> for Telegram.</p>
<p>This API allows you to connect bots to our system. <ahref="/bots"><strong>Telegram Bots</strong></a> 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.</p>
<p>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.</p>
<p>Bot developers can also make use of our <ahref="/bots/payments"><strong>Payments API</strong></a> to accept <strong>payments</strong> from Telegram users around the world.</p>
<h3><aclass="anchor"name="tdlib-build-your-own-telegram"href="#tdlib-build-your-own-telegram"><iclass="anchor-icon"></i></a>TDLib – build your own Telegram</h3>
<p>Even if you're looking for maximum customization, you don't have to create your app from scratch. Try our <ahref="https://core.telegram.org/tdlib"><strong>Telegram Database Library</strong></a> (or simply TDLib), a tool for third-party developers that makes it easy to build fast, secure and feature-rich Telegram apps.</p>
<p>TDLib takes care of all <strong>network implementation</strong> details, <strong>encryption</strong> and <strong>local data storage</strong>, so that you can dedicate more time to design, responsive interfaces and beautiful animations.</p>
<p>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 <strong>any programming language</strong>.</p>
<blockquote>
<p><ahref="https://core.telegram.org/tdlib"><strong>Learn more about TDLib here »</strong></a></p>
<p>The Telegram Gateway API allows any business, app or website to send authorization codes through Telegram instead of traditional SMS – offering a powerful and convenient way to <strong>lower costs</strong> while increasing the <strong>security</strong> and <strong>delivery speed</strong> of your codes to Telegram’s 950+ million monthly active users. Users will <strong>instantly receive</strong> messages with codes in a special chat inside Telegram.</p>
<blockquote>
<p><ahref="/gateway"><strong>Telegram's Gateway API is completely free to test. Learn more here »</strong></a></p>
<p>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 <ahref="https://telegram.org/apps#source-code">source code</a> of existing Telegram applications for examples of how things work here. Don't forget to <ahref="/api/obtaining_api_id">register</a> your application in our system. </p>
<h4><aclass="anchor"name="creating-an-application"href="#creating-an-application"><iclass="anchor-icon"></i></a><ahref="/api/obtaining_api_id">Creating an application</a></h4>
<h4><aclass="anchor"name="handling-different-data-centers"href="#handling-different-data-centers"><iclass="anchor-icon"></i></a><ahref="/api/datacenter">Handling different data centers</a></h4>
<h4><aclass="anchor"name="uploading-and-downloading-files"href="#uploading-and-downloading-files"><iclass="anchor-icon"></i></a><ahref="/api/files">Uploading and Downloading Files</a></h4>
<h4><aclass="anchor"name="end-to-end-encryption-in-voice-and-video-calls"href="#end-to-end-encryption-in-voice-and-video-calls"><iclass="anchor-icon"></i></a><ahref="https://core.telegram.org/api/end-to-end/video-calls">End-to-End Encryption in Voice and Video Calls</a></h4>
<h4><aclass="anchor"name="working-with-bots-using-the-mtproto-api"href="#working-with-bots-using-the-mtproto-api"><iclass="anchor-icon"></i></a><ahref="/api/bots">Working with bots, using the MTProto API</a></h4>
<p>Users can interact with your bot via <strong>buttons</strong> or even <strong>inline buttons</strong>, straight from inline <strong>messages</strong> in <strong>any</strong> chat. </p>
<p>Users can interact with your bot via <strong>inline queries</strong>, straight from the <strong>text input field</strong> in <strong>any</strong> chat. </p>
<p>Bots can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats; how to work with games in the MTProto API.</p>
<p>The API offers a method to obtain a list of similarly themed public channels, selected based on similarities in their <strong>subscriber bases</strong>. </p>
<p>Telegram allows users to specify granular privacy settings, choosing which users can or can't interact with them in certain ways.</p>
<h4><aclass="anchor"name="search-amp-filters"href="#search-amp-filters"><iclass="anchor-icon"></i></a><ahref="/api/search">Search & filters</a></h4>
<p>Telegram allows applying detailed message filters while looking for messages in chats.<br>This allows the server to filter messages based on a text query, and even on their type, and this feature is often used by graphical clients to implement features like the chat gallery, chat profile pictures and more.</p>
<p>Sticker, custom emoji and GIF selection UIs should offer a list of categories to quickly filter results by a (list of) emojis, or by some other criteria. </p>
<p>Telegram allows users to set an emoticon or a <ahref="/api/custom-emoji">custom emoji</a> as status, to show next to their name in chats and profiles.</p>
<h4><aclass="anchor"name="invite-links-and-join-requests"href="#invite-links-and-join-requests"><iclass="anchor-icon"></i></a><ahref="/api/invites">Invite links and join requests</a></h4>
<p>Channels, basic groups and supergroups may have a public username or a private invite link: private invite links may be further enhanced with per-user join requests.</p>
<h4><aclass="anchor"name="admin-banned-and-default-rights-for-channels-supergroups-and-gro"href="#admin-banned-and-default-rights-for-channels-supergroups-and-gro"><iclass="anchor-icon"></i></a><ahref="/api/rights">Admin, banned and default rights for channels, supergroups and groups</a></h4>
<p><ahref="/api/channel">Groups</a> can be associated to a <ahref="/api/channel">channel</a> as a <ahref="https://telegram.org/blog/privacy-discussions-web-bots">discussion group</a>, to allow users to discuss about posts. </p>
<h4><aclass="anchor"name="channel-comments-and-message-threads"href="#channel-comments-and-message-threads"><iclass="anchor-icon"></i></a><ahref="/api/threads">Channel comments and message threads</a></h4>
<p>Telegram allows commenting on a <ahref="/api/channel">channel post</a> or on a generic <ahref="/api/channel">group message</a>, thanks to message threads.</p>
<p>Both supergroups and channels offer a so-called <ahref="https://telegram.org/blog/admin-revolution">admin log</a>, a log of recent relevant supergroup and channel actions, like the modification of group/channel settings or information on behalf of an admin, user kicks and bans, and more. </p>
<p>Telegram allows mentioning other users in case of urgent duckling matters, and quickly navigating to those mentions in order to read them as swiftly as possible.</p>
<p>Sometimes, <ahref="/constructor/user">user</a> and <ahref="/constructor/channel">channel</a> constructors met in group chat updates may not contain full info about the user: how to handle such constructors.</p>
<h4><aclass="anchor"name="styled-text-with-message-entities"href="#styled-text-with-message-entities"><iclass="anchor-icon"></i></a><ahref="/api/entities">Styled text with message entities</a></h4>
<h4><aclass="anchor"name="working-with-stickers"href="#working-with-stickers"><iclass="anchor-icon"></i></a><ahref="/api/stickers">Working with stickers</a></h4>
<h4><aclass="anchor"name="working-with-custom-emojis"href="#working-with-custom-emojis"><iclass="anchor-icon"></i></a><ahref="/api/custom-emoji">Working with custom emojis</a></h4>
<h4><aclass="anchor"name="working-with-animated-emojis"href="#working-with-animated-emojis"><iclass="anchor-icon"></i></a><ahref="/api/animated-emojis">Working with animated emojis</a></h4>
<h4><aclass="anchor"name="working-with-animated-dice"href="#working-with-animated-dice"><iclass="anchor-icon"></i></a><ahref="/api/dice">Working with animated dice</a></h4>
<p>If <ahref="/method/contacts.toggleTopPeers">enabled</a>, the rating of <ahref="/constructor/topPeer">top peers</a> indicates the relevance of a frequently used peer in a certain <ahref="/type/TopPeerCategory">category</a> (frequently messaged users, frequently used bots, inline bots, frequently visited channels and so on).</p>
<p>Admins of supergroups with a certain number of members can choose to unleash the full proactive power of Telegram's own antispam algorithms – turning on the new Aggressive mode for the automated spam filters.</p>
<p>Telegram users can make it easy for others to contact them or find their public groups and channels via <ahref="https://telegram.org/faq#usernames-and-t-me">usernames</a>: clients can also assign multiple <ahref="https://fragment.com">Fragment »</a><strong>collectible usernames</strong> to accounts, supergroups and channels they own; <ahref="https://fragment.com">Fragment »</a> also allows purchasing phone number collectibles that can be used to register Telegram accounts. </p>
<p>Telegram Premium is an optional subscription service that unlocks additional exclusive client-side and API-side features, while helping support the development of the app. It is a part of Telegram’s <strong>sustainable monetization</strong>– driven by our users, rather than advertisers or shareholders. This way, Telegram can remain independent and prioritize its users first. </p>
<p>Users can turn their Telegram account into a <strong>business account</strong>, gaining access to business features such as opening hours, location, quick replies, automated messages, custom start page, chatbot support, and more.</p>
<p>For the moment, all Telegram Business features are available for free to <ahref="/api/premium">Telegram Premium</a> subscribers. </p>
<p>Telegram Stars are virtual items that allow users to purchase digital goods and services from bots and mini apps inside the Telegram ecosystem, send gifts to content creators on the Telegram platform, and more. </p>
<p>Content creators can accept <ahref="/api/stars">Stars</a> by publishing <strong>paid photos or videos</strong> on their channels. Subscribers will be allowed to view such posts only after paying the author to unlock them. </p>
<h4><aclass="anchor"name="channel-and-supergroup-boosts"href="#channel-and-supergroup-boosts"><iclass="anchor-icon"></i></a><ahref="/api/boost">Channel and supergroup boosts</a></h4>
<p><ahref="/api/premium">Telegram Premium</a> users can grant their favorite channels additional features like the ability to post <ahref="/api/stories">stories</a> by giving them <strong>boosts</strong>. </p>
<h4><aclass="anchor"name="giveaways-amp-gifts"href="#giveaways-amp-gifts"><iclass="anchor-icon"></i></a><ahref="/api/giveaways">Giveaways & gifts</a></h4>
<p>Telegram <ahref="/api/channel">channel</a> administrators may launch giveaways to randomly distribute <ahref="/api/premium">Telegram Premium</a> subscriptions and other gifts among their followers, in exchange for <ahref="/api/boost">boosts</a>.</p>
<p>Sometimes, when interacting with Telegram users via private or secret chats, an action bar must be shown on top of the chat, offering convenient action buttons or notices regarding the user.</p>
<p>The Saved Messages chat allows users to bookmark messages and media: it's a personal cloud storage for any messages or media you may want to send or forward there. </p>
<p>If your app allows accessing content from Telegram <ahref="https://telegram.org/tour/channels">channels</a>, you must include support for <ahref="https://core.telegram.org/api/sponsored-messages">official sponsored messages</a> in Telegram channels. </p>
<h3><aclass="anchor"name="channel-ad-revenue"href="#channel-ad-revenue"><iclass="anchor-icon"></i></a><ahref="/api/revenue">Channel ad revenue</a></h3>
<p>Telegram has one of the <strong>most generous reward systems</strong> in the history of social media. Telegram channel owners can now receive <strong>50%</strong> of the revenue from ads displayed in their channels.</p>
<p>This page describes the methods used to withdraw channel ad revenue, as well as view detailed revenue stats. </p>
<p>Telegram clients must handle special <code>tg://</code> and <code>t.me</code> deep links encountered in messages, link entities and in other apps by registering OS handlers. </p>