<metaproperty="description"content="We offer two kinds of APIs for developers. The Bot API allows you to easily create programs that use Telegram messages for…">
<metaproperty="og:description"content="We offer two kinds of APIs for developers. The Bot API allows you to easily create programs that use Telegram messages for…">
<divid="dev_page_content"><p>We offer two 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.</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"href="#tdlib--build-your-own-telegram"id="tdlib--build-your-own-telegram"name="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>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"href="#creating-an-application"id="creating-an-application"name="creating-an-application"><iclass="anchor-icon"></i></a><ahref="/api/obtaining_api_id">Creating an application</a></h4>
<h4><aclass="anchor"href="#handling-different-data-centers"id="handling-different-data-centers"name="handling-different-data-centers"><iclass="anchor-icon"></i></a><ahref="/api/datacenter">Handling different data centers</a></h4>
<h4><aclass="anchor"href="#uploading-and-downloading-files"id="uploading-and-downloading-files"name="uploading-and-downloading-files"><iclass="anchor-icon"></i></a><ahref="/api/files">Uploading and Downloading Files</a></h4>
<h4><aclass="anchor"href="#end-to-end-encryption-in-voice-and-video-calls"id="end-to-end-encryption-in-voice-and-video-calls"name="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"href="#working-with-bots-using-the-mtproto-api"id="working-with-bots-using-the-mtproto-api"name="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>
<h4><aclass="anchor"href="#search-amp-filters"id="search-amp-filters"name="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.
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"href="#invite-links-and-join-requests"id="invite-links-and-join-requests"name="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"href="#admin-banned-and-default-rights-for-channels-supergroups-and-groups"id="admin-banned-and-default-rights-for-channels-supergroups-and-groups"name="admin-banned-and-default-rights-for-channels-supergroups-and-groups"><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"href="#channel-comments-and-message-threads"id="channel-comments-and-message-threads"name="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"href="#styled-text-with-message-entities"id="styled-text-with-message-entities"name="styled-text-with-message-entities"><iclass="anchor-icon"></i></a><ahref="/api/entities">Styled text with message entities</a></h4>
<h4><aclass="anchor"href="#working-with-gifs"id="working-with-gifs"name="working-with-gifs"><iclass="anchor-icon"></i></a><ahref="/api/gifs">Working with GIFs</a></h4>
<h4><aclass="anchor"href="#working-with-stickers"id="working-with-stickers"name="working-with-stickers"><iclass="anchor-icon"></i></a><ahref="/api/stickers">Working with stickers</a></h4>
<p>Telegram clients support displaying animated, static and video stickers.</p>
<h4><aclass="anchor"href="#working-with-custom-emojis"id="working-with-custom-emojis"name="working-with-custom-emojis"><iclass="anchor-icon"></i></a><ahref="/api/custom-emoji">Working with custom emojis</a></h4>
<p>Telegram allows including custom animated, static and video emojis directly inside of messages.</p>
<h4><aclass="anchor"href="#working-with-animated-emojis"id="working-with-animated-emojis"name="working-with-animated-emojis"><iclass="anchor-icon"></i></a><ahref="/api/animated-emojis">Working with animated emojis</a></h4>
<h4><aclass="anchor"href="#working-with-animated-dice"id="working-with-animated-dice"name="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 an in-app currency that allows the user to pay for digital goods and services offered by <ahref="https://telegram.org/blog/telegram-stars">Telegram bots</a> or <ahref="https://telegram.org/blog/mini-app-bar-paid-media-and-more#pay-for-content-with-telegram-stars">Telegram channels</a>. </p>
<h4><aclass="anchor"href="#channel-and-supergroup-boosts"id="channel-and-supergroup-boosts"name="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"href="#giveaways-amp-gifts"id="giveaways-amp-gifts"name="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"href="#channel-ad-revenue"id="channel-ad-revenue"name="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>