# NestJS Email Validation Integration

URL: https://email-validation.org/integrations/nestjs/
Updated: 2026-12-05

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

A NestJS module that checks the email address of a request before your route’s handler runs. It refuses addresses that cannot receive email and throwaway inboxes, hands the result to your handler, and lets the request go on when the API cannot answer in time.

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

- Status: Setup guide
- An npm package file for your NestJS app

**A guarded route** signup.controller.ts

TypeScript

```text
@Post('signup')
@ValidateEmail()
signup(@EmailOutcome() outcome: EmailValidationOutcome) {
  return { created: true, status: outcome.result?.status ?? null };
}
```

## 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**: NestJS developers with sign-up, invite or contact routes who want the addresses that will bounce refused before an account is created, without a second call in the handler.
- **You need**: NestJS 12 or 11 on its Express platform, Node.js 22.12 or newer, the package file from the guide, 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), set in your environment as `EV_API_KEY`.
- **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, addresses on reserved domains such as example.com and, in a bulk list, repeats of an address (charged once).
- **Full guide**: [Read the full setup guide](https://email-validation.org/docs/guides/nestjs/)

## Typical uses.

- **A guard on your routes**: @ValidateEmail() on a route or a controller refuses a request whose address you chose to stop, and @EmailOutcome() hands the result to the handler.
- **Middleware**: EmailValidationMiddleware checks the routes you give it in a module’s configure(); with the guard on the same route and no options of its own there, the address is checked once.
- **The service in your own code**: Inject EmailValidationService and call check(email), for example after a file-upload form is parsed, and refuse the way the guard does.

## Set it up. 5 steps.

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

1. **Download the package**: The package is not on npm yet: download the file from the guide into your app, and commit it if you want it in your dependencies.
2. **Install it**: Run `npm install` with the file’s path. It needs nothing besides NestJS itself.
3. **Import the module**: Add `EmailValidationModule.forRoot()` with your key to your app module, or `forRootAsync()` with `@nestjs/config`.
4. **Guard a route**: Put `@ValidateEmail()` on your sign-up route.
5. **Try it**: Post `disposable@sandbox.email-validation.org`, which gets a 422 answer, and `accepted@sandbox.email-validation.org`, which reaches your handler. Test addresses cost nothing. On a route that mails the address, try only the one that is refused.

## Good to know.

- `invalid` and `disposable` are refused by default; choose your own list with `stopStatuses`, for the whole app or one route. `catch_all` and `unknown` pass unless you list them.
- When the API cannot answer (a timeout, a network error, a rate limit, an empty balance), the request goes on and the handler can see why in `notChecked`. Set `failOpen: false` to answer 503 instead.
- The address and the key are never logged; NestJS’s logger gets only our error code and request id.
- For [EU data residency](https://email-validation.org/docs/eu-data-residency/), set `baseUrl` to `https://api-eu.email-validation.org`: the same key works on both.

## Related

- [The full NestJS setup guide](https://email-validation.org/docs/guides/nestjs/)
- [Every setting and its default](https://email-validation.org/docs/guides/nestjs/#settings)
- [Validating sign-up forms: what to block and what to accept](https://email-validation.org/docs/guides/signup-form-validation/)
- [The JavaScript client library, for other calls such as bulk lists](https://email-validation.org/docs/sdks/javascript/)
- [PandaDoc email validation integration](https://email-validation.org/integrations/pandadoc/)
- [Ploi email validation integration](https://email-validation.org/integrations/ploi/)
- [Postman email validation integration](https://email-validation.org/integrations/postman/)
- [Rails email validation integration](https://email-validation.org/integrations/rails/)
- [All integrations](https://email-validation.org/integrations/)
