tdlib /td

Cross-platform library for building Telegram clients

★ 9,255⑂ 2,226👁 437⑃ 315● 3,200▤ 0
C++Created 2018-01-01core.telegram.org/tdlib
9,255
stars
+0+3+94
2,226
forks
437
watchers
315
prs
3,200
issues
0
releases
–
discussions

README

TDLib

TDLib (Telegram Database library) is a cross-platform library for building Telegram clients. It can be easily used from almost any programming language.

 Table of Contents
- Features
- Examples and documentation
- Dependencies
- Building
- Using in CMake C++ projects
- Using in Java projects
- Using in .NET projects
- Using with other programming languages
- License


 Features

TDLib has many advantages. Notably TDLib is:

 Cross-platform: TDLib can be used on Android, iOS, Windows, macOS, Linux, FreeBSD, OpenBSD, NetBSD, illumos, Windows Phone, WebAssembly, watchOS, tvOS, visionOS, Tizen, Cygwin. It should also work on other nix systems with or without minimal effort.
 Multilanguage: TDLib can be easily used with any programming language that is able to execute C functions. Additionally, it already has native Java (using JNI) bindings and .NET (using C++/CLI and C++/CX) bindings.
 Easy to use: TDLib takes care of all network implementation details, encryption and local data storage.
 High-performance: in the Telegram Bot API, each TDLib instance handles more than 43000 active bots simultaneously.
 Well-documented: all TDLib API methods and public interfaces are fully documented.
 Consistent: TDLib guarantees that all updates are delivered in the right order.
 Reliable: TDLib remains stable on slow and unreliable Internet connections.
 Secure: all local data is encrypted using a user-provided encryption key.
 Fully-asynchronous: requests to TDLib don't block each other or anything else, responses are sent when they are available.


 Examples and documentation
See our Getting Started tutorial for a description of basic TDLib concepts.

Take a look at our examples.

See a TDLib build instructions generator for detailed instructions on how to build TDLib.

See description of our JSON, C++, Java and .NET interfaces.

See the td_api.tl scheme or the automatically generated HTML documentation
for a list of all available TDLib methods and classes.


 Dependencies
TDLib depends on:

 C++17 compatible compiler (Clang 5.0+, GCC 7.0+, MSVC 19.1+ (Visual Studio 2017.7+), Intel C++ Compiler 19+)
 OpenSSL
 zlib
 gperf (build only)
 CMake (3.10+, build only)
 PHP (optional, for documentation generation)


 Building

The simplest way to build TDLib is to use our TDLib build instructions generator.
You need only to choose your programming language and target operating system to receive complete build instructions.

In general, you need to install all TDLib dependencies, enter directory containing TDLib sources and compile them using CMake:


mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .


To build TDLib on low memory devices you can run SplitSource.php script
before compiling TDLib source code and compile only needed targets:

php SplitSource.php
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --target tdjson
cmake --build . --target tdjson_static
cd ..
php SplitSource.php --undo

In our tests clang 6.0

Snapshot: 2026-11-04T14:00:00Z · Data license Apache-2.0 · JSON