createPhoneNumber()
Creates a new phone number for the given user.
Returns the created PhoneNumber object.
function createPhoneNumber(params: CreatePhoneNumberParams): Promise<PhoneNumber>- Name
-
phoneNumber - Type
string- Description
The phone number to assign to the specified user. Must be in E.164 format.
- Name
-
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.
const response = await clerkClient.phoneNumbers.createPhoneNumber({
userId: 'user_123',
phoneNumber: '15551234567',
primary: true,
verified: true,
})Backend API (BAPI) endpoint
This method in the SDK is a wrapper around the BAPI endpoint POST/phone_numbers. See the BAPI reference for more information.
Feedback
Last updated on