Telethon: The api_id/api_hash combination is invalid
It turns out that my script worked perfectly until I tried using it on another server, and from that moment on it stopped working and the error appears api_id / api_hash combination is invalid. I have checked api_id and hash_id many times, but they haven’t changed… so I would appreciate some help. Thanks.
Traceback (most recent call last):
File "mytelegram.py", line 41, in <module>
tclient.send_code_request(phone)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/telethon/telegram_client.py", line 241, in send_code_request
result = self(SendCodeRequest(phone, self.api_id, self.api_hash))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/telethon/telegram_bare_client.py", line 486, in __call__
result = self._invoke(call_receive, request, ordered=ordered)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/telethon/telegram_bare_client.py", line 583, in _invoke
raise next(x.rpc_error for x in requests if x.rpc_error)
telethon.errors.rpc_error_list.ApiIdInvalidError: The api_id/api_hash combination is invalid
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (6 by maintainers)
Commits related to this issue
- Signing In docs: Clarify Bot Account section As mentioned in #836 by kylethedeveloper, it will be clearer if we more explicitly mention the origin of the API ID and hash used in bot accounts signing ... — committed to armanexplorer/Telethon by armanexplorer 2 years ago
- Update signing-in.rst As mentioned in #836 by kylethedeveloper, it will be clearer if we more explicitly mention the origin of the API ID and hash used in bot accounts signing in. Also, the example... — committed to armanexplorer/Telethon by armanexplorer 2 years ago
- Signing-in docs: Clarify bot accounts section As mentioned in #836 by kylethedeveloper, it will be clearer if we more explicitly mention the origin of the API ID and hash used in bot accounts signing... — committed to armanexplorer/Telethon by armanexplorer 2 years ago
I actually figured it out. It was my fault I guess.
I created a bot account from BotFather and I was using my bot’s API token for all the variables;
api_id
,api_hash
andbot_token
. I did not realize that I had to use myapi_id
andapi_hash
for those variables. So to summarize:I was actually going back and forth through the documentation and realized that I was wrong after reading TelegramClient page. In my opinion it should be mentioned on here too.
The “here” you mention already says:
API ID, API hash, and bot token, all are different terms. But if you can improve the documentation, feel free to send a PR.