Next.js integration
Block disposable emails in Next.js
You're running a Next.js app and fake signups keep getting through. Check every email and IP on the server, in a Route Handler or a Server Action, before the account exists.
How it works
Call Fidro from a Route Handler or a Server Action with the built-in fetch, so your API key never reaches the browser. Fidro checks the email, the IP and what it has already seen from them, then answers allow, challenge or block. Works with the App Router and the Pages Router.
One fake signup can look perfectly normal. Five from the same IP in an hour don't. Send event and user_id with each call and Fidro remembers, so it catches the pattern as well as the person. You get a score from 0 to 100 and one answer: allow, challenge or block.
1. Install what you need
# Nothing to install: Next.js has fetch built in
You'll also need an API key. Sign up free and you'll have one in a minute, no card needed.
2. Check every signup
Send the email and IP to POST /api/validate. Fidro checks for disposable domains, missing mail servers, VPNs, proxies and Tor, and answers allow, challenge or block. Let the allows straight in, ask the challenges to confirm their email, and turn the blocks away.
// app/api/signup/route.ts (App Router)
import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest) {
const { email } = await request.json();
const ip = request.headers.get("x-forwarded-for")?.split(",")[0].trim() ?? "";
const response = await fetch("https://fidro.io/api/validate", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FIDRO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ email, ip, event: "signup" }),
});
if (!response.ok) {
return NextResponse.json({ error: "Validation failed" }, { status: 502 });
}
const result = await response.json();
if (result.recommendation === "block") {
return NextResponse.json(
{ error: "This signup has been flagged as high risk" },
{ status: 403 }
);
}
// Create the account...
return NextResponse.json({ recommendation: result.recommendation });
}
// ----- Or as a Server Action -----
// app/actions/check-signup.ts
"use server";
import { headers } from "next/headers";
export async function checkSignup(email: string) {
const ip = (await headers()).get("x-forwarded-for")?.split(",")[0].trim() ?? "";
const response = await fetch("https://fidro.io/api/validate", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FIDRO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ email, ip, event: "signup" }),
});
if (!response.ok) {
throw new Error("Validation failed");
}
return response.json(); // { risk_score, recommendation, data: { checks, ... } }
}
3. Look up an IP
Just want to know where a request came from? GET /api/ip/{ip} returns the country, city, ISP and network, without scoring. The VPN, proxy and Tor flags come from /api/validate, under data.checks.
// app/api/check-ip/route.ts (App Router)
import { NextRequest, NextResponse } from "next/server";
export async function GET(request: NextRequest) {
const ip = request.headers.get("x-forwarded-for")?.split(",")[0].trim() ?? "";
const response = await fetch(`https://fidro.io/api/ip/${ip}`, {
headers: { Authorization: `Bearer ${process.env.FIDRO_API_KEY}` },
});
if (!response.ok) {
return NextResponse.json({ error: "IP lookup failed" }, { status: 502 });
}
const result = await response.json();
return NextResponse.json({
country: result.location.country_name,
isp: result.location.isp,
});
}
Want to see real results first? Try any address in the free IP checker.
Next steps
The API reference has every field. The free checker shows you real results. And if you're weighing up alternatives, the comparisons are honest about where others fit.
Frequently Asked Questions
How do I add fraud detection to Next.js?
Does Fidro have a Next.js SDK?
Is Fidro free to use with Next.js?
What should I do when Fidro says challenge?
Start catching bad signups in the next 5 minutes
Create your account, grab your API key, and send your first request. Free plan with 200 validations/month. No credit card. Cancel anytime.