Developer documentation

Telegram TL language, types and serialization

Read TL constructors, methods, flags, vectors and serialization before generating client bindings.

GetTGAPI editorial teamUpdated
Documentation notesReviewed

Based on official sources and independently maintained by GetTGAPI. Documentation and glossary →

On this page
  1. Distinguish constructors, types and methods
  2. Conditional fields are not ordinary nullable values
  3. Code-generation recommendations

Distinguish constructors, types and methods

TL describes object structures and functions. Constructor identifiers, result types and field names have different roles, and schema sections distinguish functions from types. Name casing alone is insufficient to interpret a declaration.

Conditional fields are not ordinary nullable values

Flags control whether fields appear in the binary representation. Vectors, polymorphism and bare/boxed forms have their own rules. JSON field omission is not a substitute for binary serialization semantics.

Code-generation recommendations

Generate bindings from a pinned schema, preserving names and types. Test boundaries, optional-field combinations and round trips against independent official vectors, not only your own encoder and decoder together.

Handle unknown constructors as versioned data rather than guessing an older type. Read the complete combinator and polymorphism definitions before implementing a parser; this article provides a reading route.