<metaproperty="description"content="Telegram allows placing chats into folders, based on their type, mute status, or other custom criteria, thanks to folder blacklists and whitelists.">
<metaproperty="og:title"content="Folders">
<metaproperty="og:image"content="">
<metaproperty="og:description"content="Telegram allows placing chats into folders, based on their type, mute status, or other custom criteria, thanks to folder blacklists and whitelists.">
<p>Telegram allows placing chats into folders, based on their type, mute status, or other custom criteria, thanks to folder blacklists and whitelists: these folders may also be shared with other users. </p>
<p>The boolean under the <ahref="/api/config#dialog-filters-tooltip"><code>dialog_filters_tooltip</code> JSON key</a> in the result of <ahref="/method/help.getAppConfig">help.getAppConfig</a> can be used to determine whether a folder tooltip should be presented to the user right away.<br>
The UI should then show a list of suggested folder combinations. </p>
<p>Once configuration is finished, apps call <ahref="/method/messages.updateDialogFilter">messages.updateDialogFilter</a> to create or update existing folders.<br>
As per the <ahref="/constructor/dialogFilter">dialogFilter</a>/<ahref="/constructor/dialogFilterChatlist">dialogFilterChatlist</a> constructors, folders have multiple flags that can be combined to determine which chats should be included in (or excluded from) the folder, which emoji to use as icon for the folder and its name.<br>
Folders can also have up to <code>dialogs_folder_pinned_limit_*</code> pinned chats, as determined by the <ahref="/api/config#client-configuration">client configuration</a>.</p>
<p><ahref="/constructor/dialogFilterChatlist">dialogFilterChatlist</a> constructors are used to represent imported <ahref="#shared-folders">shareable folders</a>. </p>
<p>To reorder existing folders, <ahref="/method/messages.updateDialogFiltersOrder">messages.updateDialogFiltersOrder</a> should be used with the IDs of the various dialog filters.</p>
<p><ahref="/api/premium">Premium</a> users also have access to a <ahref="/constructor/dialogFilterDefault">dialogFilterDefault</a> constructor, used only when reordering folders to indicate the default (all chats) folder. </p>
<p>To delete folders, use <ahref="/method/messages.updateDialogFilter">messages.updateDialogFilter</a> without populating the <code>filter</code> flag field. </p>
<p>Clients can receive <ahref="/constructor/updateDialogFilter">updateDialogFilter</a>, <ahref="/constructor/updateDialogFilterOrder">updateDialogFilterOrder</a> updates with new filter information, generated by other clients when modifying folder info.<br>
Clients can also receive <ahref="/constructor/updateDialogFilters">updateDialogFilters</a>, in which case folder info should be refetched manually using <ahref="/method/messages.getDialogFilters">messages.getDialogFilters</a>.</p>
<p>Folders may be shared using <ahref="/api/links#chat-folder-links">chat folder deep links</a>.<br>
These links are generated by invoking <ahref="/method/chatlists.exportChatlistInvite">chatlists.exportChatlistInvite</a>, passing the ID of the folder that should be exported, along with a list of <code>peers</code> that should be included in the shared folder.<br>
Only channels and groups/supergroups may be specified in the <code>peers</code> array; these channels and groups must be public, or the user must have permission to manage invite links. Basic groups will automatically be <ahref="/api/channel#migration">converted to supergroups</a> when invoking the method.<br>
An optional name for the shared link may also be specified using <code>title</code>. </p>
<p>Use <ahref="/method/chatlists.getExportedInvites">chatlists.getExportedInvites</a> to list all links generated for a folder, use <ahref="/method/chatlists.editExportedInvite">chatlists.editExportedInvite</a> to edit the title or list of <code>peers</code> of a specific link and <ahref="/method/chatlists.deleteExportedInvite">chatlists.deleteExportedInvite</a> to revoke an exported link, preventing new users from importing it. </p>
<p>The maximum number of per-folder invites that can be created by <ahref="/api/premium">Premium</a>/non-<ahref="/api/premium">Premium</a> users is specified by the <code>chatlist_invites_limit_default</code>/<code>chatlist_invites_limit_premium</code><ahref="/api/config#chatlist-invites-limit-default">client configuration parameters »</a>. </p>
<p>Use <ahref="/method/chatlists.checkChatlistInvite">chatlists.checkChatlistInvite</a> to obtain information about a chat folder deep link before importing it with <ahref="/method/chatlists.joinChatlistInvite">chatlists.joinChatlistInvite</a>, specifying in <code>peers</code> which channels and groups to join (excluding inaccessible channels/supergroups, i.e. the user may not join a supergroup/channel where they were banned, corresponding to a <ahref="/constructor/channelForbidden">channelForbidden</a> constructor).<br>
If the user can't join any of the <code>peers</code> of a folder, the folder can't be imported.</p>
<p>The maximum number of shareable folders that a <ahref="/api/premium">Premium</a>/non-<ahref="/api/premium">Premium</a> user may join is specified by the <code>chatlists_joined_limit_default</code>/<code>chatlists_joined_limit_premium</code><ahref="/api/config#chatlists-joined-limit-default">client configuration parameters »</a>. </p>
<p>Users that import a folder should retrieve additions made to the peer list by invoking <ahref="/method/chatlists.getChatlistUpdates">chatlists.getChatlistUpdates</a> at most every <code>chatlist_update_period</code> seconds (a <ahref="/api/config#chatlist-update-period">client configuration parameter »</a>).<br>
If the returned <code>missing_peers</code> list is non-empty, the client should present it to the user, who may choose to join all or a subset of them (excluding inaccessible channels/supergroups), passing them to the <code>peers</code> parameter of <ahref="/method/chatlists.joinChatlistUpdates">chatlists.joinChatlistUpdates</a>.<br>
If after excluding inaccessible peers and peers deselected by the user the <code>peers</code> list is empty, invoke <ahref="/method/chatlists.hideChatlistUpdates">chatlists.hideChatlistUpdates</a> instead of <ahref="/method/chatlists.joinChatlistUpdates">chatlists.joinChatlistUpdates</a>.</p>
<p>When removing an imported folder, the list of included peers should be presented to the user prior to deletion, with the peers listed in <ahref="/method/chatlists.getLeaveChatlistSuggestions">chatlists.getLeaveChatlistSuggestions</a> already pre-marked for deletion: the user may then choose to delete or keep some or all of the groups and channels of the folder when invoking <ahref="/method/chatlists.leaveChatlist">chatlists.leaveChatlist</a> to delete the folder, specifying in <code>peers</code> the list of channels and groups from the folder that should also be removed.</p>
<p>API peer folders are typically used only by <ahref="https://telegram.org/blog/archive-and-new-design">archived chats</a>, and are really handy for distinguishing groups of peers, since most peer-related constructors (updates, chat info) will contain the <code>folder_id</code> assigned the specified chat. </p>
<p>In Telegram apps, API peer folders are used only to implement the chat archive, identified by <code>folder_id</code><code>1</code>; all other peers are in <code>folder_id</code><code>0</code> by default; no other <code>folder_id</code> is allowed at the moment.</p>
<ul>
<li><ahref="/method/folders.editPeerFolders">folders.editPeerFolders</a> can be used to add and remove peers from peer folders.</li>
</ul>
<p>Both methods return an <ahref="/constructor/updates">updates</a> constructor, containing a single <ahref="/constructor/updateFolderPeers">updateFolderPeers</a> with the new <code>folder_id</code> of moved peers.<br>
Clients can also receive <ahref="/constructor/updateFolderPeers">updateFolderPeers</a> as a normal <ahref="/api/updates">update</a>, generated by other clients when modifying peer folders.</p>
<p>Clients can then use <ahref="/type/InputDialogPeer">InputDialogPeer</a> to refer either to a specific chat, or to all chats in a peer folder: the server will return a <ahref="/type/DialogPeer">DialogPeer</a> in certain constructors for the same purpose.</p></div>