SignUpRequest
Only users can use this method. See code examples.
---functions--- auth.signUp#80eee427 phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization
Returns
auth.Authorization |
This type can be an instance of either:
Authorization | AuthorizationSignUpRequired |
Parameters
phone_number | string | |
phone_code_hash | string | |
first_name | string | |
last_name | string |
Known RPC errors
This request can cause 9 known errors:
FirstNameInvalidError | The first name is invalid. |
MemberOccupyPrimaryLocFailedError | Occupation of primary member location failed. |
PhoneCodeEmptyError | The phone code is missing. |
PhoneCodeExpiredError | The confirmation code has expired. |
PhoneCodeInvalidError | The phone code entered was invalid. |
PhoneNumberFloodError | You asked for the code too many times.. |
PhoneNumberInvalidError | The phone number is invalid. |
PhoneNumberOccupiedError | The phone number is already in use. |
RegIdGenerateFailedError | Failure while generating registration ID. |
You can import these from telethon.errors
.
Example
Please refer to the documentation of client.sign_up()
to learn about the parameters and see several code examples on how to use it.
The method above is the recommended way to do it. If you need more control over the parameters or want to learn how it is implemented, open the details by clicking on the "Details" text.
from telethon.sync import TelegramClient from telethon import functions, types with TelegramClient(name, api_id, api_hash) as client: result = client(functions.auth.SignUpRequest( phone_number='some string here', phone_code_hash='some string here', first_name='some string here', last_name='some string here' )) print(result.stringify())