Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

createEmailAddress()

Creates an EmailAddress for the specified user.

function createEmailAddress: (params: CreateEmailAddressParams) => Promise<EmailAddress>;

CreateEmailAddressParams

NameTypeDescription
userIdstringThe ID of the user to create the email address for.
emailAddressstringThe email address to assign to the specified user.
primary?booleanWhether or not to set the email address as the user's primary email address.
verified?booleanWhether or not the email address is verified.

createEmailAddress() example

const response = await clerkClient.emailAddresses.createEmailAddress({ userId: "user_2bxfCJOe0Ocd8DNe9hFN3EXvfOu", emailAddress: "testclerk123@gmail.com", primary: true, verified: true }) console.log(response); /* _EmailAddress { id: 'idn_2bxnrjq6IbzcU4iOR5i13v29VPK', emailAddress: 'testclerk123@gmail.com', verification: _Verification { status: 'verified', strategy: 'admin', externalVerificationRedirectURL: null, attempts: null, expireAt: null, nonce: null }, linkedTo: [] } */

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint POST/email_addresses. See the BAPI reference(opens in a new tab) for more details.

Last updated on February 22, 2024

What did you think of this content?

Clerk © 2024