send_code()

Client.send_code()

Sends a code to the specified phone number. Aborts previous phone number verification if there was one.

Usable by Users Bots

Parameters:
  • phone_number (str) – Phone number in international format (includes the country prefix).

  • settings (PhoneNumberAuthenticationSettings, optional) – Settings for the authentication of the user’s phone number.

  • type (PhoneNumberCodeType, optional) – Type of the request for which the code is sent. Defaults to authentication.

  • recaptcha_token (str, optional) – Recaptcha token.

Returns:

SentCode – On success, returns information about the sent code.

Raises:

raises ~pyrogram.errors.BadRequest: In case the phone number is invalid.