Resources

Everything you need to get started — from API docs to bulk validation, email finder, and more.

Starter Templates

Copy-paste integration code for common frameworks. Drop it in and start validating.

Validate on form submission in a Next.js API route

// app/api/signup/route.ts
import { NextResponse } from "next/server";

export async function POST(req: Request) {
  const { email, name } = await req.json();

  // Validate email with MailSentry
  const check = await fetch("https://mailsentry.dev/api/v1/verify", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-API-Key": process.env.MAILSENTRY_API_KEY!,
    },
    body: JSON.stringify({ email }),
  }).then(r => r.json());

  if (check.score < 50) {
    return NextResponse.json(
      { error: "Please use a valid email address", suggestion: check.checks.typo?.suggestion },
      { status: 400 }
    );
  }

  // Email is valid — proceed with signup
  // await db.users.create({ email, name, emailScore: check.score });
  return NextResponse.json({ success: true });
}

Common Patterns

Copy-paste recipes for the most common validation use cases.

Block Disposable Emails on Signup

Reject throwaway emails before they hit your database.

const data = await verify(email);
if (data.checks.disposable.is_disposable) {
  return res.status(400).json({
    error: "Disposable emails are not allowed"
  });
}

Auto-Suggest Typo Corrections

Save signups by suggesting the correct domain.

const data = await verify(email);
if (data.checks.typo.has_typo) {
  showSuggestion(
    `Did you mean ${data.checks.typo.suggestion}?`
  );
}

Score Leads Before Passing to CRM

Only send high-quality leads to your sales team.

const data = await verify(lead.email);
if (data.score >= 70 && !data.checks.free_provider.is_free) {
  await crm.createLead({
    ...lead,
    email_score: data.score,
    is_business: true
  });
}

Clean a CSV List with the Bulk API

Validate an entire list and download clean results.

const job = await fetch("/api/v1/bulk", {
  method: "POST",
  headers: { "X-API-Key": key, ... },
  body: JSON.stringify({ emails: csvEmails })
}).then(r => r.json());

// Poll until complete
const results = await pollJob(job.id);
const clean = results.filter(r => r.score >= 70);

Popular Guides

Quick Start Guide

1

Create Your Account

Sign up for free — no credit card required. You'll get 1,000 email validations per month instantly.

2

Get Your API Key

Go to Dashboard → API Keys → Create New Key. Copy your key — you'll need it for every request.

ms_live_a1b2c3d4e5f6...
3

Make Your First API Call

Send a POST request to validate any email address. All 8 checks run in parallel.

curl -X POST https://mailsentry.dev/api/v1/verify \
  -H "Content-Type: application/json" \
  -H "X-API-Key: ms_live_your_key_here" \
  -d '{"email": "test@example.com"}'