send_phone_number_code()

async Client.send_phone_number_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.

  • current_number (bool, optional) – Deprecated, use settings instead. Pass True if the phone number is the one the client is already signed in with.

  • allow_flashcall (bool, optional) – Deprecated, use settings instead. Pass True if the code may be delivered as a flash call.

  • allow_app_hash (bool, optional) – Deprecated, use settings instead. Pass True if the code may be delivered through the app hash.

  • allow_missed_call (bool, optional) – Deprecated, use settings instead. Pass True if the code may be delivered as a missed call.

  • allow_firebase (bool, optional) – Deprecated, use settings instead. Pass True if the code may be delivered through Firebase.

  • logout_tokens (List of bytes, optional) – Deprecated, use settings instead. Tokens of the sessions the user was signed out of, so the server can offer a faster sign-in.

  • token (str, optional) – Deprecated, use settings instead. Push notification token the code may be delivered to.

  • app_sandbox (bool, optional) – Deprecated, use settings instead. Pass True to use the sandbox push service rather than the production one.

Returns:

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

Raises:

BadRequest – In case the phone number is invalid.