Telethon icon indicating copy to clipboard operation
Telethon copied to clipboard

cannot obtain an api_id or api_hash

Open wardcrisr opened this issue 5 months ago • 9 comments

Code that causes the issue

Image

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:

  1. Entered a valid App title and a Short name (5–32 alphanumeric characters),
  2. Selected “Desktop” as the platform,
  3. Cleared browser cache and tried in incognito mode,
  4. Switched networks (mobile hotspot, home broadband, VPN),
  5. 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.zip and triggered the bug in the latest version.

wardcrisr avatar Jul 16 '25 15:07 wardcrisr

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.

Lonami avatar Jul 17 '25 06:07 Lonami

If you are using VPN then try without that. I faced same long time ago, after disabling VPN it worked for me.

Jain2098 avatar Jul 29 '25 20:07 Jain2098

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: @.***>

wardcrisr avatar Jul 31 '25 01:07 wardcrisr

unfortunately i am in China,it doesn't work,anyway thanks

Himanshu @.***> 于 2025年7月30日周三 04:53写道:

did you found any workaround?

yekanchi avatar Aug 03 '25 06:08 yekanchi

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.

yekanchi avatar Aug 05 '25 09:08 yekanchi

没有啊,注册不了

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: @.***>

wardcrisr avatar Aug 15 '25 03:08 wardcrisr

you must open this website from the same country as the phone number in the Telegram account

centralhardware avatar Aug 24 '25 02:08 centralhardware

Actually ive been through this a lot, and i can confirm:

  1. They did not block access to any country.
  2. The fact that you need to open the website with the same ip location as your phone number origin is Not True.
  3. What i believe they did is that they blocked "any" VPN access, Proxies and even some DNSs. ‌

Now there are two possible workarounds here:

  1. 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.
  2. 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!

amirgame197 avatar Oct 14 '25 06:10 amirgame197

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.

yesanqian avatar Nov 12 '25 19:11 yesanqian