Log in with a Telethon session
A Telethon session is a saved login file. You log in once with the phone number and code, Telethon stores the result in a .session file, and from then on your scripts connect without asking for a code again.
What are the API ID and API hash?
The API ID and API hash are keys from Telegram that identify your app or script when it connects through Telethon. Telethon can't log in or use a session without them.
Get your API ID and API hash
- 1
Open my.telegram.org
Go to my.telegram.org.
- 2
Log in with your Telegram phone number
- 3
Open “API development tools”
- 4
Create a new application
- 5
Copy the API ID and API hash Telegram shows you
Why use Telethon sessions?
- No need to request an OTP again
- Works well for automation and bots
- Fast, stable login
Keep session files private
Anyone with the .session file can use the account. Don't share it or upload it anywhere you don't trust.