auth.sendCode

Sends an confirmation code message to the specified phone number via SMS.

auth.sentCode#efed51d9 phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode;
auth.sentAppCode#e325edcf phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode;
---functions---
auth.sendCode#768d5f4d phone_number:string sms_type:int api_id:int api_hash:string lang_code:string = auth.SentCode;

Parameters

phone_number string Phone number in international format
sms_type int Message text type.
Possible values:
0 - message contains a numerical code
1 (deprecated) - message contains a link {app_name}://{code}
5 - message sent via Telegram instead of SMS (the (auth.sentAppCode) constructor may be returned in this case)
api_id int Application identifier (see App configuration)
api_hash string Application secret hash (see App configuration)
lang_code string Code for the language used on a client, ISO 639-1 standard
Parameter added in layer 5.

Result

The method returns an auth.SentCode object with information on the message sent.

Query example

(auth.sendCode "79991234567" 1 32 "test-hash" "en")
=
(auth.sentCode
  phone_registered:(boolFalse)
  phone_code_hash:"2dc02d2cda9e615c84"
)

d16ff372 3939370b 33323139 37363534 00000001 00000020 73657409 61682d74 00006873 e77e812d
=
2215bcbd bc799737 63643212 32643230 39616463 35313665 00343863 e12b7901

Possible errors

Code Type Description
400 BAD_REQUEST PHONE_NUMBER_INVALID Invalid phone number
303 SEE_OTHER PHONE_MIGRATE_X Repeat the query to data-center X
303 SEE_OTHER NETWORK_MIGRATE_X Repeat the query to data-center X