Skip to main content

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:

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

SectionMeaning
SignatureExactly what you call on client.API().
ParametersFields of the method's request; in Required marks an optional (conditional) field.
ReturnsThe Go type returned (besides error).
Possible errorsDocumented Telegram errors; handle them with tgerr or the FLOOD_WAIT middleware.

Namespaces

NamespaceMethodsDescription
account128Account settings: privacy, sessions, two-factor auth, profile and notifications.
aicompose7AI-assisted message composition.
auth26Authorization: sign in and out, login codes, passwords and bot login.
bots38Bot-side methods: commands, inline results, menus and web apps.
channels58Channels and supergroups: administration, members and settings.
chatlists11Shareable chat-folder (chat list) invite links.
contacts28Contacts: add, block, search and import/export.
folders1Peer folders, including the archive.
fragment1Fragment.com collectible usernames and phone numbers.
help25Server configuration, app updates, support and terms of service.
langpack5Localization and language packs.
messages256Sending, editing and fetching messages, plus reactions, stickers and drafts.
payments65Payments, invoices, Telegram Stars and subscriptions.
phone43Voice and video calls, including group calls.
photos5Profile photos.
premium5Telegram Premium features: boosts, gifts and more.
smsjobs7SMS jobs (carrier verification integration).
stats8Channel, message and story statistics.
stickers11Creating and managing sticker sets.
stories33Stories: posting, viewing, reactions and privacy.
test2Test-only methods for the Telegram test servers.
updates3Fetching update state and differences.
upload8Uploading and downloading file parts.
users7User information and full profiles.