Telethon API

This documentation was generated straight from the scheme.tl provided by Telegram. However, there is no official documentation per se on what the methods, constructors and types mean. Nevertheless, this page aims to provide easy access to all the available methods, their definition and parameters.

light / dark theme.

Please note that when you see this:

---functions---
users.getUsers#0d91a548 id:Vector<InputUser> = Vector<User>

This is not Python code. It's the "TL definition". It's an easy-to-read line that gives a quick overview on the parameters and its result. You don't need to worry about this. See Understanding the Type Language for more details on it.

Index

Methods

Currently there are {method_count} methods available for the layer {layer}. See the complete method list.

Methods, also known as requests, are used to interact with the Telegram API itself and are invoked through client(Request(...)). Only these can be used like that! You cannot invoke types or constructors, only requests. After this, Telegram will return a result, which may be, for instance, a bunch of messages, some dialogs, users, etc.

Types

Currently there are {type_count} types. See the complete list of types.

The Telegram types are the abstract results that you receive after invoking a request. They are "abstract" because they can have multiple constructors. For instance, the abstract type User can be either UserEmpty or User. You should, most of the time, make sure you received the desired type by using the isinstance(result, Constructor) Python function. When a request needs a Telegram type as argument, you should create an instance of it by using one of its, possibly multiple, constructors.

Constructors

Currently there are {constructor_count} constructors. See the list of all constructors.

Constructors are the way you can create instances of the abstract types described above, and also the instances which are actually returned from the functions although they all share a common abstract type.

Core types

Core types are types from which the rest of Telegram types build upon:

Full example

All methods shown here have dummy examples on how to write them, so you don't get confused with their TL definition. However, this may not always run. They are just there to show the right syntax.

You should check out how to access the full API in ReadTheDocs.