What is Telegram Session+Json and how to use it? A complete guide
"A Telegram session file (.session) is a SQLite database that stores authentication credentials, including the authorization key, server address, and user data. Combined with a JSON metadata file containing app_id, app_hash, and phone number, it allows full API access via MTProto." — Telegram API Documentation Reference.
You wrote a parser that needs to check 500 Telegram groups every hour. Or you're building a notification bot for your SaaS product. The one thing standing between you and working code is a .session file.
Python libraries like Telethon and Pyrogram authenticate exclusively through .session files. This guide covers what Session+Json is, how to load it in your scripts, and what gets accounts banned (and how to avoid it).
What is Telegram Session+Json?
Session+Json is a two-file format that stores everything needed to authenticate a Telegram account through the MTProto API. Unlike Tdata (which works with Telegram Desktop), Session+Json is designed for code-based automation.
- .session file — A SQLite database that holds the authorization key, server salt, and connection state. Telethon and Pyrogram read this file to pick up where you left off, no login code required.
- .json metadata file — Plain-text JSON with
app_id,app_hash, phone number, and an optional 2FA password. You need these values to initialize the MTProto client.
Why Session+Json beats Tdata for automation
Session+Json accounts work at the API level, not the GUI level. A Telethon script with a Session+Json account can send messages, join groups, scrape members, and manage channels in a few lines of Python. You don't need a desktop client or GUI automation. No screen scraping either. You can run hundreds of sessions on a single VPS without spinning up extra desktops.
If you're comparing formats, check the Tdata guide for the desktop approach.
How to use Telegram Session+Json accounts (step-by-step)
- Install Telethon or Pyrogram. Run
pip install telethonorpip install pyrogram tgcryptoin your Python environment. - Place your files. Drop the
.sessionand.jsonfiles into your project directory next to your script. - Load the session in code. Use the session file name (without extension) when you create the client. The JSON metadata supplies the API credentials.
# Telethon example from telethon import TelegramClient import json with open('account.json') as f: meta = json.load(f) client = TelegramClient('account', meta['app_id'], meta['app_hash']) client.start(phone=meta['phone']) # Session is active. You can call any API method now. - Run your script. Telethon and Pyrogram read the existing
.sessionfile at startup. No QR code or SMS needed.
Session+Json vs Tdata: which format should you pick?
| Factor | Session+Json | Tdata |
|---|---|---|
| Best for | Python scripts, API automation, chatbots | Desktop GUI, Telegram Portable |
| Protocol | MTProto API (direct Telegram protocol) | Local desktop cache (indirect) |
| Concurrent sessions | Unlimited (one VPS can run thousands) | Limited by desktop resources |
| API access | Full MTProto API (messages, channels, contacts) | Only what Telegram Desktop exposes |
| Setup time | 30 seconds (pip install + file drop) | 2 minutes (download portable + folder setup) |
Troubleshooting common Session+Json issues
- Session revoked (error 401). The account was logged out remotely. Telegram flags accounts that move too fast. Let the account rest for 24 hours before retrying.
- Flood wait errors. You are hitting API rate limits. Add random delays between actions (5 to 15 seconds) and avoid sending the same message to multiple chats in a row.
- Phone number invalid. The phone in the .json file does not match the session. Make sure your metadata comes from the same account as the session file.
Anti-ban rules for Session+Json accounts
Session+Json accounts use the raw Telegram API, which means they are more visible to Telegram's abuse detection. These rules help you keep accounts alive longer:
| Rule | Description | Recommendation |
|---|---|---|
| Proxy match | The proxy GEO must match the account's registration country. | Mobile SOCKS5 proxies work best. |
| Session file | Keep the .session file as-is. Editing or regenerating it breaks the auth. | Store backups in a secure directory. |
| Rate limits | Stay within Telegram's per-method rate limits. | Keep it under 30 messages per second per account. |
| Warm-up | Do not run automation on a fresh session. | Wait 12 to 24 hours after the first login. |
| 2FA | A two-factor password keeps the account secure after purchase. | Add it to the .json metadata file. |
Where to buy Telegram Session+Json accounts
On accs.tg, Session+Json accounts are available for the USA, UK, Ukraine, Russia, and other GEOs. Each order includes the .session file plus .json metadata with app_id and app_hash. Delivery takes under 5 seconds. Accounts are registered on clean IP pools through real mobile devices, which keeps trust levels high.
Each account comes with everything you need to start automating within minutes.
Browse the full catalog at accs.tg/services or use the API for bulk orders. If you prefer the desktop format, read the Tdata guide instead.