Skip to main content

createEmailAddress()

Creates a new email address for the given user.

Returns the created EmailAddress object.

function createEmailAddress(params: CreateEmailAddressParams): Promise<EmailAddress>
  • Name
    emailAddress
    Type
    string
    Description

    The email address to create.

  • Name
    primary?
    Type
    boolean
    Description

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

  • Name
    userId
    Type
    string
    Description

    The ID of the user to create the email address for.

  • Name
    verified?
    Type
    boolean
    Description

    Whether the email address 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 response = await clerkClient.emailAddresses.createEmailAddress({
  userId: 'user_123',
  emailAddress: 'testclerk123@gmail.com',
  primary: true,
  verified: true,
})

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint POST/email_addresses. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on