ContactChannel

ContactChannel represents a user's contact information, such as an email address or phone number. Some auth methods, like OTP/magic link or password, use contact channels for authentication.

On this page:

ContactChannel

Basic information about a contact channel, as seen by a user themselves.

Usually obtained by calling user.listContactChannels() or user.useContactChannels() .

Table of Contents

The id of the contact channel as a string.

Type Definition
declare const id: string;

The value of the contact channel. If type is "email", this is an email address.

Type Definition
declare const value: string;

The type of the contact channel. Currently always "email".

Type Definition
declare const type: 'email';

Indicates whether the contact channel is the user's primary contact channel. If an email is set to primary, it will be the value on the user.primaryEmail field.

Type Definition
declare const isPrimary: boolean;

Indicates whether the contact channel is verified.

Type Definition
declare const isVerified: boolean;

Indicates whether the contact channel is used for authentication. If set to true, the user can use this contact channel with OTP or password to sign in.

Type Definition
declare const usedForAuth: boolean;

Sends a verification email to this contact channel. Once the user clicks the verification link in the email, the contact channel will be marked as verified.

Parameters

None.

Returns

Promise<void>

Signature
declare function sendVerificationEmail(): Promise<void>;
Examples
await contactChannel.sendVerificationEmail();

Updates the contact channel. After updating the value, the contact channel will be marked as unverified.

Parameters

optionsobjectrequired

An object containing properties for updating.

Show Properties
valuestring

The new value of the contact channel.

type'email'

The new type of the contact channel. Currently always "email".

usedForAuthboolean

Indicates whether the contact channel is used for authentication.

isPrimaryboolean

Indicates whether the contact channel is the user's primary contact channel.

Returns

Promise<void>

Signature
declare function update(options: {
  value?: string;
  type?: 'email';
  usedForAuth?: boolean;
  isPrimary?: boolean;
}): Promise<void>;
Examples
await contactChannel.update({
  value: "new-email@example.com",
  usedForAuth: true,
});

Deletes the contact channel.

Parameters

None.

Returns

Promise<void>

Signature
declare function delete(): Promise<void>;
Examples
await contactChannel.delete();

ServerContactChannel

Like ContactChannel, but includes additional methods and properties that require the SECRET_SERVER_KEY.

Usually obtained by calling serverUser.listContactChannels() or serverUser.useContactChannels() .

Table of Contents


Updates the contact channel.

This method is similar to the one on ContactChannel, but also allows setting the isVerified property.

Parameters

optionsobjectrequired

An object containing properties for updating.

Show Properties
valuestring

The new value of the contact channel.

type'email'

The new type of the contact channel. Currently always "email".

usedForAuthboolean

Indicates whether the contact channel is used for authentication.

isVerifiedboolean

Indicates whether the contact channel is verified.

isPrimaryboolean

Indicates whether the contact channel is the user's primary contact channel.

Returns

Promise<void>

Signature
declare function update(options: {
  value?: string;
  type?: 'email';
  usedForAuth?: boolean;
  isVerified?: boolean;
  isPrimary?: boolean;
}): Promise<void>;
Examples
await serverContactChannel.update({
  value: "new-email@example.com",
  usedForAuth: true,
  isVerified: true,
});

Stack Auth AI

Documentation assistant

Experimental: AI responses may not always be accurate—please verify important details.

For the most accurate information, please join our Discord or email us.

How can I help?

Ask me about Stack Auth while you browse the docs.