Overview
useSendVerificationEmail returns a function that sends a verification email to the currently authenticated user. The token expires after 5 minutes. Calling it on an already-verified user is a no-op (resolves without sending).
Usage Example
Parameters
The returned function requires a props object.mode defaults to "code"; in code mode tokenFormat is required and decides what else applies:
How the token is delivered. Defaults to
"code"."code"— user receives a token to type into your app"link"— user receives a clickable button that verifies automatically
Character set for the token.
- Required in code mode — there’s no default, since
"hex"(see below) produces something no one would want to type. - Optional when
mode: "link"(defaults to"hex") — the token is embedded in a URL, never read by a human, so the format doesn’t matter.
Length of the generated token (4–12).
- Optional in code mode with a
"numeric","alpha"or"alphanumeric"token (defaults to6). - Not allowed when
tokenFormatis"hex"— hex ignores length and always produces a fixed 64-character token, so specifying one would be silently meaningless. - Optional when
mode: "link"(defaults to6).
URL to redirect to after link verification;
null for none. Only valid with mode: "link" (TypeScript refuses it in code mode). On success it receives verified=true in its query string; an invalid or expired link shows Sublay’s hosted error page instead.Must be an https address on one of your project’s Verified Domains (Dashboard → Settings → Domains). Each entry covers exactly the host it names, never its subdomains: example.com allows https://example.com/… on any port, but not www.example.com, which needs its own entry. A full address such as https://app.example.com covers only that host and port. localhost and *.localhost are always allowed, over http too. Anything else, including a custom-scheme deep link such as myapp://verified, is refused with 400 auth/redirect-url-not-allowed and no email is sent.Returns
The hook returns an async function that resolves with nothing (Promise<void>) when the request completes without a server error.

