# Node.js, Express & Next.js Email Verification API Tutorial (TypeScript)

> Complete Node.js and TypeScript guide for real-time email verification with native fetch, Express middleware, and Next.js App Router Server Actions.

- **Author**: Darius, Lead Engineer
- **Published**: 2026-11-09
- **Source**: https://mailveri.com/blog/nodejs-email-validation-guide
- **AI Reference**: https://mailveri.com/llms-full.txt

---

Node.js and TypeScript power modern SaaS authentication flows, Next.js App Router applications, and serverless API gateways. Adding real-time email verification at the point of capture blocks [disposable burner signups that drain AI token budgets](https://mailveri.com/blog/stop-disposable-emails-draining-ai-saas-credits), prevents typo bounces, and keeps your transactional sender reputation spotless at just **$0.0002 to $0.00059 per check**.

## 1. TypeScript Interfaces & Native `fetch` Client

In Node.js 20+ and Next.js 15, you do not need heavy third-party HTTP dependencies like `axios` or `node-fetch`. Built-in Undici-backed `fetch` paired with `AbortSignal.timeout(3500)` guarantees that a slow downstream DNS or MX lookup never blocks your Node.js event loop or delays a customer registration request.

MailVeri returns 7 explicit verification statuses (`VALID`, `INVALID`, `DISPOSABLE`, `ROLE_ACCOUNT`, `CATCH_ALL`, `FULL_INBOX`, and `UNKNOWN`) along with `credits_used`, `quality_score` (0–100), and the `is_forwarding` boolean flag—and automatically refunds 100% of credits whenever a check returns `UNKNOWN`:

```typescript
export type MailVeriStatus =
  | 'VALID'
  | 'INVALID'
  | 'DISPOSABLE'
  | 'ROLE_ACCOUNT'
  | 'CATCH_ALL'
  | 'FULL_INBOX'
  | 'UNKNOWN';

export interface MailVeriResponse {
  error: number;
  message: string;
  email: string;
  mail: string;
  status: MailVeriStatus;
  balance: number;
  credits_used: number;
  quality_score: number;
  is_forwarding: boolean;
}

export async function verifyEmail(email: string): Promise<MailVeriResponse> {
  const response = await fetch('https://api.mailveri.com/v1/verify-mail/', {
    method: 'POST',
    headers: {
      'X-Api-Key': process.env.MAILVERI_API_KEY!,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ email: email.trim().toLowerCase() }),
    signal: AbortSignal.timeout(3500),
  });

  if (!response.ok) {
    throw new Error(`MailVeri API error: ${response.status}`);
  }

  return (await response.json()) as MailVeriResponse;
}
```

Example JSON payload returned by the MailVeri API when a user attempts to sign up with a disposable burner address:

```json
{
  "error": 0,
  "message": "Verified temp.user99@10minutemail.com successfully",
  "email": "temp.user99@10minutemail.com",
  "mail": "temp.user99@10minutemail.com",
  "status": "DISPOSABLE",
  "credits_used": 1,
  "quality_score": 0,
  "is_forwarding": false,
  "balance": 9998
}
```

## 2. Express.js Registration Guard Middleware

If your backend runs on Express or Fastify, attach a lightweight verification middleware to your registration and lead-capture routes. Notice how the middleware gracefully fails open if an external network timeout occurs, flagging the user for mandatory email link verification rather than dropping legitimate traffic:

```typescript
import type { Request, Response, NextFunction } from 'express';
import { verifyEmail } from './lib/mailveri';

export async function requireDeliverableEmail(
  req: Request,
  res: Response,
  next: NextFunction
) {
  const email = req.body?.email;
  if (!email || typeof email !== 'string') {
    return res.status(400).json({ error: 'A valid email address is required.' });
  }

  try {
    const result = await verifyEmail(email);

    if (result.status === 'DISPOSABLE') {
      return res.status(422).json({
        error: 'Temporary or disposable email addresses are not permitted.',
        code: 'DISPOSABLE_EMAIL_BLOCKED',
      });
    }

    if (result.status === 'INVALID' || result.status === 'FULL_INBOX') {
      return res.status(422).json({
        error: 'This email address cannot receive mail. Please check for typos.',
        code: 'UNDELIVERABLE_EMAIL',
      });
    }

    res.locals.emailVerification = result;
    return next();
  } catch (error) {
    // Fail-open on timeout so signup conversion is never blocked
    res.locals.emailVerification = { status: 'UNKNOWN', failOpen: true };
    return next();
  }
}
```

## 3. Next.js 15 App Router Server Action Integration

In Next.js App Router applications (including [Supabase Auth and Clerk signup flows](https://mailveri.com/blog/how-to-block-disposable-emails-supabase-clerk-nextjs)), run email verification inside a Server Action. Your `MAILVERI_API_KEY` remains 100% server-side with zero client-side JavaScript bundle impact:

```typescript
'use server';

import { verifyEmail } from '@/lib/mailveri';

export async function submitTrialSignup(formData: FormData) {
  const rawEmail = String(formData.get('email') ?? '').trim();
  if (!rawEmail.includes('@')) {
    return { ok: false, message: 'Please enter a valid email address.' };
  }

  try {
    const check = await verifyEmail(rawEmail);
    if (check.status === 'INVALID' || check.status === 'DISPOSABLE') {
      return {
        ok: false,
        message: 'Please use an active work or personal email (no burner domains).',
      };
    }
  } catch {
    // Graceful fallback if timeout occurs
  }

  // Proceed to create user in Supabase / Clerk / Prisma
  return { ok: true, message: 'Check your inbox to confirm your account!' };
}
```

## 4. Node.js Implementation Patterns Compared

| Integration Pattern | Best For | Recommended Timeout | Fallback Strategy |
| --- | --- | --- | --- |
| Next.js Server Action | SaaS trial signups, gated content forms | 3,000 – 3,500 ms | Fail-open + require email confirmation link |
| Express / Fastify Middleware | REST APIs, mobile app auth backends | 3,500 – 4,000 ms | Attach `UNKNOWN` flag & withhold trial AI quota until email link is verified |
| BullMQ / Background Worker | CRM webhook ingestion, CSV imports | 10,000 ms | Exponential backoff retry on HTTP 429/503 |

Explore full request and webhook specifications in the [MailVeri API Documentation](https://mailveri.com/docs/api), review production integration patterns in our [Email Verification API Integration Guide](https://mailveri.com/blog/email-verification-api-integration-guide), or see [email verification API pricing](https://mailveri.com/pricing) from $0.20 per 1,000 checks.

## Frequently Asked Questions

### What is the most important takeaway from Node.js, Express & Next.js Email Verification API Tutorial (TypeScript)?

Complete Node.js and TypeScript guide for real-time email verification with native fetch, Express middleware, and Next.js App Router Server Actions. When applying typescript interfaces & native fetch client, teams should always validate recipient addresses before sending or provisioning accounts so hard bounce rates stay strictly below 2% and sender reputation remains protected across Gmail, Microsoft 365, and Yahoo.

### How does MailVeri help teams implement TypeScript Interfaces & Native fetch Client at scale?

MailVeri provides real-time REST API, native MCP server (mailveri-mcp), and 1,000,000-row bulk CSV verification across 7 granular statuses (VALID, INVALID, DISPOSABLE, CATCH_ALL, ROLE_ACCOUNT, FULL_INBOX, and UNKNOWN). This lets you automate express.js registration guard middleware while filtering out dead mailboxes, 100,000+ burner domains, and over-quota inboxes.

### How much does email verification cost for Node.js, Express & Next.js Email Verification API Tutorial (TypeScript) workflows?

MailVeri uses 100% pay-as-you-go Universal Credits that never expire: $9 for 10,000 credits, $59 for 100,000 credits, $299 for 1,000,000 credits, and $999 for 5,000,000 credits ($0.0002 per email—up to 90% cheaper than legacy verifiers). Every new account includes up to 1,000 free trial credits with no credit card required, and UNKNOWN responses cost 0 credits.
