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:

AuthorizationAuthorizationSignUpRequired

Parameters

phone_numberstring
phone_code_hashstring
first_namestring
last_namestring

Known RPC errors

This request can cause 9 known errors:

FirstNameInvalidErrorThe first name is invalid.
MemberOccupyPrimaryLocFailedErrorOccupation of primary member location failed.
PhoneCodeEmptyErrorThe phone code is missing.
PhoneCodeExpiredErrorThe confirmation code has expired.
PhoneCodeInvalidErrorThe phone code entered was invalid.
PhoneNumberFloodErrorYou asked for the code too many times..
PhoneNumberInvalidErrorThe phone number is invalid.
PhoneNumberOccupiedErrorThe phone number is already in use.
RegIdGenerateFailedErrorFailure 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())