# Better Auth Integration for Email Validation

URL: https://email-validation.org/integrations/better-auth/
Updated: 2026-11-29

> Documentation index: https://email-validation.org/llms.txt

A Better Auth server plugin checks each new user’s address with our API before Better Auth creates the user and, when the result is one you stop, the sign-up is refused with an error your client can show. Magic link and email OTP sign-ups are checked before any mail is sent.

[Read the full setup guide](https://email-validation.org/docs/guides/better-auth/) [Get an API key](https://email-validation.org/signin/)

- Status: Setup guide
- One TypeScript plugin file, no database tables

**Server variable** never in browser code

Environment

```text
EV_API_KEY   your API key
```

## At a glance.

- **Status**: **Setup guide.** Not listed on a marketplace yet: you set it up yourself in a few steps, below and in the full guide.
- **For**: Apps built on Better Auth that want accounts made with an undeliverable or throwaway address kept out, whether people sign up with a password, a magic link, a one-time code or an OAuth provider.
- **You need**: A Better Auth server, and an [API key](https://email-validation.org/app/api-keys/) made for it, with a [daily credit cap](https://email-validation.org/docs/authentication/#limits), kept in a server variable. The plugin goes into your server config only, never into the auth client.
- **Costs**: 1 credit = 1 validated address, as with any API request. Free: unknown results, API errors, malformed addresses, test addresses on sandbox.email-validation.org and, in a bulk list, repeats of an address (charged once).
- **Full guide**: [Read the full setup guide](https://email-validation.org/docs/guides/better-auth/)

## Typical uses.

- **Refuse it with a clear error**: An email and password sign-up with a stopped address gets an error with the code EMAIL\_ADDRESS\_NOT\_ACCEPTED and your message, and no user row is written.
- **Send no mail to a bad address**: Magic link and email OTP sign-ups are checked before the link or code goes out, so a stopped address never gets one and no user follows.
- **Leave returning users alone**: Only a new user reaches the check. Someone signing in again, or linking a new provider to an account they have, is never checked and never charged.

## Set it up. 4 steps.

The short version of the [full setup guide](https://email-validation.org/docs/guides/better-auth/), which stays the reference when a step does not match what you see.

1. **Download the file**: It is not on a registry yet: download email-validation-better-auth.ts from the guide and put it next to your Better Auth config.
2. **Add the plugin**: Add `emailValidation({ apiKey: process.env.EV_API_KEY })` to the `plugins` of your server `betterAuth()` config. There is no migration to run.
3. **Show the error**: On the client, show `error.message` when `error.code` is `EMAIL_ADDRESS_NOT_ACCEPTED`. For OAuth, read `error` from your error callback page.
4. **Test it**: Sign up with email and password as `disposable@sandbox.email-validation.org`: it is refused, for free. Test addresses receive no mail, so do not use them for magic links or codes that would really be sent.

## Good to know.

- A user who changes their address later is not checked, and neither is anything that writes user rows to the database without going through Better Auth.
- No key, a timeout, no credits or any other error lets the sign-up through. A check is never retried.
- A magic link or code checked when it was sent is not checked again when it is used on the same server; on serverless hosts one sign-up can cost up to 2 credits.
- Nothing is logged, and the address goes only to our US host, or with `region: 'eu'` to our [EU host](https://email-validation.org/docs/eu-data-residency/).

## Related

- [The full Better Auth setup guide](https://email-validation.org/docs/guides/better-auth/)
- [What it stops, per sign-in method](https://email-validation.org/docs/guides/better-auth/#how-it-works)
- [Options](https://email-validation.org/docs/guides/better-auth/#options)
- [Test addresses](https://email-validation.org/docs/test-addresses/)
- [Clerk integration](https://email-validation.org/integrations/clerk/)
- [Amazon Cognito integration](https://email-validation.org/integrations/cognito/)
- [Firebase integration](https://email-validation.org/integrations/firebase/)
- [Keycloak integration](https://email-validation.org/integrations/keycloak/)
- [All integrations](https://email-validation.org/integrations/)
