account.changePhone
Change the phone number of the current account
func (c *Client) AccountChangePhone(ctx context.Context, request *AccountChangePhoneRequest) (UserClass, error)
Calling this method
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
res, err := api.AccountChangePhone(ctx, &tg.AccountChangePhoneRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UserClass
return nil
})
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
PhoneNumber | string | yes | New phone number |
PhoneCodeHash | string | yes | Phone code hash received when calling account.sendChangePhoneCode |
PhoneCode | string | yes | Phone code received when calling account.sendChangePhoneCode |
Returns
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | PHONE_CODE_EMPTY | phone_code is missing. |
| 400 | PHONE_CODE_EXPIRED | The phone code you provided has expired. |
| 400 | PHONE_CODE_INVALID | The provided phone code is invalid. |
| 406 | PHONE_NUMBER_INVALID | The phone number is invalid. |
| 400 | PHONE_NUMBER_OCCUPIED | The phone number is already in use. |
References
- Official documentation
- Generated Go reference
- TL definition:
account.changePhone#70c32edb