API Reference
Complete reference for the gotd MTProto schema, generated directly from the
github.com/gotd/td/tg source so
signatures, parameters and documented errors always match the version of the library you
import:
- 781 methods — RPC calls you invoke on
client.API(). - 244 types — TL classes (boxed types) and their constructors.
- 1626 constructors — concrete TL types and their fields.
Generated reference
For an always-current view (and Go-specific helpers) see the full Go reference at ref.gotd.dev. New to gotd? Start with the Tutorial and Calling the API.
Calling a method
Every method is invoked on the raw client returned by client.API():
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
// help.getNearestDc — no auth required, a good connectivity check.
dc, err := api.HelpGetNearestDC(ctx)
if err != nil {
return err
}
_ = dc
return nil
})
How to read a method page
| Section | Meaning |
|---|---|
| Signature | Exactly what you call on client.API(). |
| Parameters | Fields of the method's request; — in Required marks an optional (conditional) field. |
| Returns | The Go type returned (besides error). |
| Possible errors | Documented Telegram errors; handle them with tgerr or the FLOOD_WAIT middleware. |
Namespaces
| Namespace | Methods | Description |
|---|---|---|
account | 128 | Account settings: privacy, sessions, two-factor auth, profile and notifications. |
aicompose | 7 | AI-assisted message composition. |
auth | 26 | Authorization: sign in and out, login codes, passwords and bot login. |
bots | 38 | Bot-side methods: commands, inline results, menus and web apps. |
channels | 58 | Channels and supergroups: administration, members and settings. |
chatlists | 11 | Shareable chat-folder (chat list) invite links. |
contacts | 28 | Contacts: add, block, search and import/export. |
folders | 1 | Peer folders, including the archive. |
fragment | 1 | Fragment.com collectible usernames and phone numbers. |
help | 25 | Server configuration, app updates, support and terms of service. |
langpack | 5 | Localization and language packs. |
messages | 256 | Sending, editing and fetching messages, plus reactions, stickers and drafts. |
payments | 65 | Payments, invoices, Telegram Stars and subscriptions. |
phone | 43 | Voice and video calls, including group calls. |
photos | 5 | Profile photos. |
premium | 5 | Telegram Premium features: boosts, gifts and more. |
smsjobs | 7 | SMS jobs (carrier verification integration). |
stats | 8 | Channel, message and story statistics. |
stickers | 11 | Creating and managing sticker sets. |
stories | 33 | Stories: posting, viewing, reactions and privacy. |
test | 2 | Test-only methods for the Telegram test servers. |
updates | 3 | Fetching update state and differences. |
upload | 8 | Uploading and downloading file parts. |
users | 7 | User information and full profiles. |