How do I block temporary email domains in Express?

Add a middleware to your registration route that reads req.body.email, calls signupDecision from the disban package, and responds with 400 when the action is block or fix. Allowed requests continue to your handler with the decision attached, so the handler can hold free credits for unknown domains. No API key is needed to start.

Install and try it

Node.js 18 or later is enough; the package has no dependencies.

npm install disban

curl https://disban.io/api/v1/check/mailinator.com
# {"domain":"mailinator.com","category":"disposable","disposable":true,"mail_routing":"routable"}

The middleware

Mount it only on the routes that create accounts, after express.json().

// blockDisposable.js
import { signupDecision } from "disban";

export async function blockDisposable(req, res, next) {
  const email = req.body?.email;
  if (typeof email !== "string") return res.status(400).json({ error: "Email is required." });

  const d = await signupDecision(email);
  if (d.action === "block")
    return res.status(400).json({ error: "Please use a permanent email address." });
  if (d.action === "fix")
    return res.status(400).json({ error: "This email domain can't receive mail. Check the address." });

  req.signup = d; // d.hold: true for unknown domains or when Disban was unreachable
  next();
}

// app.js
import express from "express";
import { blockDisposable } from "./blockDisposable.js";

const app = express();
app.use(express.json());
app.post("/register", blockDisposable, async (req, res) => {
  const user = await createUser({ email: req.body.email, holdCredits: req.signup.hold });
  res.json({ ok: true, id: user.id });
});

Production: add a free API key

The keyless endpoint allows 10 checks per hour and 30 per day per network; set DISBAN_API_KEY (free, 2,000 checks a month, no card) and the same code switches to the keyed API with full evidence.

npx disban signup
export DISBAN_API_KEY=dbn_...

Why not a static list of domains?

Open-source lists only know domains someone has already added, and they age: when we looked up the 429,532 domains in Disban's inventory in October 2026, 52.1% no longer existed. Disban also checks where a domain's mail goes and which operator runs those mail servers, so a brand-new domain on a known disposable operator is caught on its first signup, and every answer says why.

Handling unknown results and outages

signupDecision never locks real users out. If Disban is slow, rate-limited or unreachable it returns allow with hold: true, so you can create the account but hold free credits or rewards until the email is confirmed.

Source for provider behavior: Disban API documentation. Product-policy guidance is Disban's interpretation.