cannot obtain an api_id or api_hash
Code that causes the issue
Expected behavior
I keep encountering an “ERROR” box every time I click “Create application” on the my.telegram.org/apps page, even though I have:
- Entered a valid App title and a Short name (5–32 alphanumeric characters),
- Selected “Desktop” as the platform,
- Cleared browser cache and tried in incognito mode,
- Switched networks (mobile hotspot, home broadband, VPN),
- Waited 24–72 hours and retried.
None of these steps has worked, and I still cannot obtain an api_id or api_hash. The network console shows no helpful error messages. Please help me resolve this as soon as possible. Thank you!
Actual behavior
ERROR
Traceback
No response
Telethon version
1.0
Python version
3.19
Operating system (including distribution name and version)
windows11
Other details
No response
Checklist
- [x] The error is in the library's code, and not in my own.
- [x] I have searched for this issue before posting it and there isn't an open duplicate.
- [x] I ran
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zipand triggered the bug in the latest version.
I don't have any control over that page, I've never personally experienced the error myself, and the only thing I could suggest trying from what I've heard from others, are all things you've already tried.
If you are using VPN then try without that. I faced same long time ago, after disabling VPN it worked for me.
unfortunately i am in China,it doesn't work,anyway thanks
Himanshu @.***> 于 2025年7月30日周三 04:53写道:
Jain2098 left a comment (LonamiWebs/Telethon#4661) https://github.com/LonamiWebs/Telethon/issues/4661#issuecomment-3134042872
If you are using VPN then try without that. I faced same long time ago, after disabling VPN it worked for me.
— Reply to this email directly, view it on GitHub https://github.com/LonamiWebs/Telethon/issues/4661#issuecomment-3134042872, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRARCAD442CTC2QMCTZLXL3K7NOHAVCNFSM6AAAAACBVJNTECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCMZUGA2DEOBXGI . You are receiving this because you authored the thread.Message ID: @.***>
unfortunately i am in China,it doesn't work,anyway thanks
Himanshu @.***> 于 2025年7月30日周三 04:53写道: …
did you found any workaround?
Is your ID registered successfully? I also keep getting an error when I sign up
i think they did it inentionally for some countries so they prevent them getting api Id. i think it's more the issue of the cell phone number you use for getting api id rathher.
没有啊,注册不了
Morteza T @.***> 于 2025年8月5日周二 17:51写道:
yekanchi left a comment (LonamiWebs/Telethon#4661) https://github.com/LonamiWebs/Telethon/issues/4661#issuecomment-3154424355
Is your ID registered successfully? I also keep getting an error when I sign up
i think they did it inentionally for some countries so they prevent them getting api Id. i think it's more the issue of the cell phone number you use for getting api id rathher.
— Reply to this email directly, view it on GitHub https://github.com/LonamiWebs/Telethon/issues/4661#issuecomment-3154424355, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRARCBL5A7LYN63PTQQBDL3MB5CVAVCNFSM6AAAAACBVJNTECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCNJUGQZDIMZVGU . You are receiving this because you authored the thread.Message ID: @.***>
you must open this website from the same country as the phone number in the Telegram account
Actually ive been through this a lot, and i can confirm:
- They did not block access to any country.
- The fact that you need to open the website with the same ip location as your phone number origin is Not True.
- What i believe they did is that they blocked "any" VPN access, Proxies and even some DNSs.
Now there are two possible workarounds here:
- If you are not using a VPN to access the website, weird that you even have this issue but whatever. You now need to use a(nother) VPN or Proxy service and just hope for the best. Rolling through IPs and trying to find a clean, undetected one is not impossible but extremely hard.
- If you have a friend that is out in a more.. "Free" country, you can ask your friend to do the job for you with their IP. This always works for me and is the most stable way of doing it. Just pass it to someone else!
Based on my understanding of other people's past experiences, the most important thing is your IP address.
If you don't have a suitable IP address, just use someone else's api_id, I don't think there's a big problem.