Skip to main content

account.sendChangePhoneCode

Verify a new phone number to associate to the current account

func (c *Client) AccountSendChangePhoneCode(ctx context.Context, request *AccountSendChangePhoneCodeRequest) (AuthSentCodeClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.AccountSendChangePhoneCode(ctx, &tg.AccountSendChangePhoneCodeRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // AuthSentCodeClass
return nil
})

Parameters

NameTypeRequiredDescription
PhoneNumberstringyesNew phone number
SettingsCodeSettingsyesPhone code settings

Returns

AuthSentCodeClass

Possible errors

CodeTypeDescription
406FRESH_CHANGE_PHONE_FORBIDDENYou can't change phone number right after logging in, please wait at least 24 hours.
400PHONE_NUMBER_BANNEDThe provided phone number is banned from telegram.
406PHONE_NUMBER_INVALIDThe phone number is invalid.
400PHONE_NUMBER_OCCUPIEDThe phone number is already in use.

References