CLI
The tgconv CLI converts session strings between formats, inspects session data, and reads SQLite session files — all from the terminal.
Install
go install github.com/mtgo-labs/session-converter/cmd/tgconv@latestCommands
convert
Convert a session string to another format. Auto-detects the source format.
tgconv convert <SESSION_STRING> -t <FORMAT> [flags]| Flag | Description |
|---|---|
-f, --from | Source format (auto-detect if omitted) |
-t, --to | Target format (default: telethon) |
--api-id | API ID (required for Pyrogram/MTKruto output) |
--user-id | User ID (required for Pyrogram/MTKruto output) |
--is-bot | Mark session as a bot account |
tgconv convert "1ApWapzMBuwAAB..." -t pyrogram \
--api-id 2040 --user-id 123456789 --is-botMissing fields
Some target formats require fields that the source format doesn't carry (e.g. Pyrogram needs api_id, user_id, is_bot). Supply them via the flags above. See Format Reference — Field availability.
info
Decode a session string and print the extracted fields without converting.
tgconv info <SESSION_STRING> [-f <FORMAT>]$ tgconv info "1ApWapzMBuwAAB..."
Format: telethon
DC: 2
Address: 149.154.167.51:443
API ID: 2040
Auth key: a4f1...8b3c (256 bytes)When -f is omitted, the format is auto-detected.
from-file
Read a Telethon or Pyrogram SQLite .session file and export as a string.
tgconv from-file <PATH> [-t <FORMAT>]tgconv from-file myaccount.session -t telethonThe file is opened read-only and never modified. The library (Telethon vs Pyrogram) is auto-detected from the table schema.
list
Print all supported formats:
$ tgconv list
Supported formats:
telethon
pyrogram
gramjs
mtcute
mtkruto
gogram
gotgprotoFormat names
All commands accept these format names for -f / -t:
telethon pyrogram gramjs mtcute mtkruto gogram gotgproto