Telegram

Commands — Telegram

Find every Telegram CLI command, argument, option and exit code in the generated command reference.

Choose the reference for your task. Start with First tasks if you're getting acquainted; use this reference for exact commands, arguments and options. First tasks →

Find a command by name

How commands work

tg [profile] [options] <resource> <action> [arguments]
  • Resource first, then the action. The resource is what you work with: chats, messages, contacts. The action is what you do with it: list, show, send.
  • Name the profile as the first word: tg work chats list lists the chats of profile work. No profile is ever assumed: a command that needs an account and gets none from the first word or TG_PROFILE stops and lists your profiles, even when there is only one.
  • Global options work with every command: --json for scripts and agents, --dry-run to check a command without running it, --offline to answer from the local copy only.
  • A command that changes something is marked in the reference: “Changes something in Telegram” changes data in the messenger, “Changes something on this computer only” changes only files on this computer.
  • Permission levels can make a write ask for confirmation first. --yes gives that confirmation in advance.
  • Each reference ends with the exit codes. tg commands lists every command by section and marks the ones that change something; tg guide lists step-by-step scenarios. Options are in tg commands --json and tg <command> --help.

Profiles →Permissions →CLI contract →

Full reference in Markdown →