Session Formats and Protocols
In Telegram automation and fleet management, "protocol accounts" or "sessions" are the foundation of all automated operations. Understanding their underlying technical architecture, format differences, and credential pairing rules is essential to keeping accounts stable and assets secure.
What is a session?
A so-called "protocol account" is an informal industry term. Under the hood, it is not a special account category, but an authorized login session (Session) established between a specific Telegram account and a specific client device. Within both official Telegram apps and TGDirector, these sessions appear as "active devices".
When a client finishes logging in using a phone number and verification code, Telegram servers negotiate and issue a unique credential key (AuthKey). Any application holding this key can communicate directly with Telegram gateways via the MTProto protocol, performing operations such as sending messages, joining groups, or updating profile details on behalf of that account.
Consequently, session files represent the login credentials themselves. Possessing a .session file is equivalent to having full operational control over that account on the corresponding device.
Common formats and compatibility
Various session storage formats circulate in the ecosystem, designed for different client libraries and operating environments. TGDirector compatibility is outlined below:
| Format | Description and Storage | TGDirector Compatibility |
|---|---|---|
| Telethon | Generated by the Python library Telethon as a .session SQLite database containing AuthKey, DC ID, and connection parameters | Supported natively (must be paired with an identical-named .json fingerprint file) |
| Pyrogram | Generated by the Pyrogram library; its internal SQLite table schema is incompatible with Telethon | Not directly supported; convert it to Telethon format first |
| tdata | The local cache and credential directory used by the official Telegram Desktop client on Windows and macOS | Not directly supported; convert it to a session file first |
| SMS API hosting | Cloud-hosted authorization services managed by third-party platforms | Not supported. Pepe does not use third-party hosting; log in directly with a phone number and code |
| String Session | Base64-encoded strings representing the session AuthKey | String imports are not supported; restore the string into a .session file first |
| Standalone JSON | Proprietary JSON formats exported by third-party tools exposing raw auth keys | Not supported; TGDirector .json files are used exclusively for device hardware fingerprints |
| Web Auth Key | Session keys kept in the browser by official Telegram Web clients, usually prefixed with 982FA | Not supported directly |
TGDirector specification and pairing rules
TGDirector imports protocol sessions strictly in Telethon format and enforces rigorous file-pairing rules.
Why device fingerprints are mandatory
During the connection handshake Telegram verifies not only the session key but also the device and environment parameters the client reports, such as device model, system version, client version, and language.
With only a .session and no original fingerprint, software has to invent a device profile. The same session then drifts between contradictory hardware details, which easily triggers forced logouts or risk-control freezes. Pepe therefore requires a fixed, known fingerprint for every session.
Pairing and parsing rules
When importing sessions, each account must consist of two paired files:
- File pairing: Each account requires one
<name>.sessionfile and an identically named<name>.jsonconfiguration file (e.g.,+12025550110.sessionand+12025550110.json). - Missing fingerprints: If a
.sessionfile has no matching.jsonin the target folder, the system labels it asMissing Fingerprint (缺指纹)and refuses to import it. - Phone number extraction: The system prioritizes the
phonefield inside the.jsonfile; if absent, it falls back to the file base name. - 2FA password synchronization: If a two-step verification password is recorded in the
.jsonfile, TGDirector automatically populates it into the account record for automated future logins. - Fingerprint persistence: Device fingerprints are stored independently with each account in the local database. When launching an actor client, TGDirector strictly reports this saved fingerprint, isolated from global application settings.
Import, export, and device management
TGDirector provides three primary management interfaces for session lifecycles:
- Import Sessions: Located at the top right of
Actor Management (账号管理)underImport Sessions (导入协议号). Supports dragging files or entire folders. You can select multiple proxy nodes for round-robin assignment. The optionImport data only, do not log in immediately (仅导入数据,不立即登录)is checked by default to prevent burst connection spikes. See Import Sessions. - Export sessions: The Export sessions (导出协议号) page writes accounts as
<phone>.sessionwith a matching.json. Authorization modes are original session export, plus QR auto-authorization and Passkey auto-authorization, which issue fresh sessions under a target fingerprint (official desktoptdesktopor Apple desktopmacos); proxy settings can optionally be written into the JSON. See Export Sessions. - Active devices: Devices (设备) in an account row menu lists every active session registered on Telegram servers, flags unconfirmed or non-official devices, and terminates them one by one. For bulk cleanup, select accounts and click Kick devices (踢设备) in the header to revoke every session except the app's current one. See Single-account actions and Account cleanup.
Session credentials and security
:::caution Session files represent full control
A .session file is an unrestricted authentication ticket. Anyone possessing this file can take over the session without needing SMS codes or passwords. Never store or share session files across untrusted machines or unverified software.
:::
- Account provenance: Sessions sourced from third-party sellers carry inherent ownership risks. If the seller retained an older active session, they can terminate your access at any moment. For control tier comparisons, see Sources and their risk levels.
- Pacing and anti-ban: Freshly imported or newly reconnected sessions should never be placed immediately into bulk messaging or scraping. Maintain pacing intervals and rotate proxies as outlined in Anti-Ban and Pacing Advice.