Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Better Auth · Module

auth.api.signUpEmail

Creates a user with email and password through Better Auth's server API. Supply required identity and credential fields, with optional image and callback URL values.

How it works

Call the server API with a body containing the new user's name, email, and password. Optional image and callbackURL values can add a profile image and post-signup destination; the response contains the created user and session data.

Syntax

await auth.api.signUpEmail({ body: { name, email, password, image?, callbackURL? } });

Parameters

NameTypeDescription
bodyobjectRequest payload containing the new user's required name, email, and password, plus optional image and callbackURL values.
body.namestringThe user's display name.
body.emailstringThe user's email address.
body.passwordstringThe user's password.
body.imagestringOptional profile image URL.
body.callbackURLstringOptional post-signup redirect URL.

Returns

The created user and session data; the server response may also set cookies that need to be returned to the client.

Key points

  • Invoke the server endpoint as auth.api.signUpEmail and place request data under body.
  • An image URL may be included to initialize the user's profile image.
  • A callback URL may specify where the user should be redirected after registration.

Common mistakes

  • If the endpoint establishes a session, make sure the response cookies are forwarded to the client.
  • The default password constraint is 8–128 characters.

Example: Create a user with email and password

import { auth } from "@/lib/auth";

const result = await auth.api.signUpEmail({
  body: {
    name: "John Doe",
    email: "john.doe@example.com",
    password: "password1234",
    image: "https://example.com/image.png",
    callbackURL: "https://example.com/callback",
  },
});

console.log(result.user);

Creates a user through the server API using the required identity and password fields, with optional profile and callback values.

When to use it

Server registration

A server-side registration handler needs to create an account without using the client SDK.

Profile initialization

Registration should attach a profile image during account creation.

Post-signup navigation

The application needs to direct a newly registered user to a specific destination.

Interview questions

QHow do you call auth.api.signUpEmail?

Pass the signup fields inside the body property of auth.api.signUpEmail. The documented required values are name, email, and password; image and callbackURL are optional.

Follow-up: What must happen when this endpoint creates a session? Its response cookies must be forwarded to the client so the session is retained.

QWhich optional fields are shown for the email signup request?

The endpoint accepts an optional image URL for the user's profile image and an optional callbackURL for the destination after signup. Both belong in the request body alongside the required signup fields.

Follow-up: How would you support an additional signup field? Use the configured Better Auth schema or plugin field and include it in the body if that documentation exposes it.

QWhat password length rule applies by default?

The documented default password rule requires at least 8 characters and permits at most 128 characters. Inputs outside that range should be rejected by validation.

Follow-up: Would that rule necessarily be universal? No; treat it as the documented default and verify any configuration that changes password validation.

  • authClient.signUp.email
  • auth.api.signInEmail
  • auth.api.verifyEmail

Source: Email & Password | Better Auth. Checked 2026-10-15.