NewWacht Bench is live — AI-assisted development for Wacht

updateEmail()

Updates one email identifier by id for a specific user.

Usage

The following example shows a basic usage of the backend client from @wacht/nextjs/server.

import { wachtClient } from '@wacht/nextjs/server';export async function markPrimaryEmail(userId: string, emailId: string) {  const client = await wachtClient();  return client.users.updateEmail(userId, emailId, { is_primary: true });}

Signature

function updateEmail(  userId: string,  emailId: string,  request: UpdateEmailRequest,): Promise<UserEmail>

Parameters

userId: string;
Target user id.
emailId: string;
Target email id.
email?: string | undefined;
Updated email value.
is_primary?: boolean | undefined;
Mark this email as primary.

Return value

id?: string | undefined;
Email record id.
email?: string | undefined;
Updated email value.
is_primary?: boolean | undefined;
Primary-email flag after update.

Behavior

  • Applies a partial update and returns the server-side updated resource.
  • Treat omitted optional fields as unchanged unless explicitly documented otherwise.

On this page