Skip to main content

updatePhoneNumber()

Updates the given phone number.

Returns the updated PhoneNumber object.

function updatePhoneNumber(phoneNumberId: string, params: { primary?: boolean; reservedForSecondFactor?: boolean; verified?: boolean }): Promise<PhoneNumber>
  • Name
    phoneNumberId
    Type
    string
    Description

    The ID of the phone number to update.

  • Name
    params
    Type
    { primary?: boolean; reservedForSecondFactor?: boolean; verified?: boolean; }
    Description

    The parameters to update the phone number.

  • Name
    params.primary?
    Type
    boolean
    Description

    Whether the phone number should be the primary phone number. Defaults to false, unless it is the first phone number added to the user.

  • Name
    params.reservedForSecondFactor?
    Type
    boolean
    Description

    Whether the phone number should be reserved for multi-factor authentication. The phone number must also be verified. If there are no other reserved , the phone number will be set as the default second factor. Defaults to false.

  • Name
    params.verified?
    Type
    boolean
    Description

    Whether the phone number should be verified. Defaults to false.

Note

Using clerkClient varies based on the SDK you're using. Refer to the overview for usage details, including guidance on how to access the userId and other properties.

const phoneNumberId = 'idn_123'

const params = { verified: false }

const response = await clerkClient.phoneNumbers.updatePhoneNumber(phoneNumberId, params)

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint PATCH/phone_numbers/{phone_number_id}. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on