Quickstart
One POST /v1/check from your signup handler. Five minutes from key to first verdict.
01Get a key
Sign in with GitHub and your sg_live_ key is on the next screen, with 1,000 checks a month. It is shown once: keep it server-side, in a secret manager. Lost it? Rotate it from your dashboard (the old key keeps working for 24 hours). We run our own check on signups, so a GitHub account younger than 30 days starts with 100 checks a month; talk to the founder for the full free tier or a sg_test_ key for CI.
02First check with curl
Send the end user's email, and their IP if you have it. Only email is required.
curl -X POST https://api.bouncedmail.dev/v1/check \
-H "Authorization: Bearer $BOUNCEDMAIL_KEY" \
-H "Content-Type: application/json" \
-d '{"email": "john.smith+promo@gmail.com", "ip": "81.2.69.142"}'| Field | Notes |
|---|---|
email | Required, 3 to 320 characters. |
ip | The end user's IP as your platform's trusted header gives it. Never a raw X-Forwarded-For. |
phone, phone_country | Any format; send phone_country (e.g. GB) for national numbers. |
user_agent | The browser's user agent string. |
form_fill_ms | Render-to-submit time measured in the browser. |
record | Default true. Send false for on-blur validation: reads, stores nothing. |
external_id | Echoed back, never stored. |
Optional header Idempotency-Key (1 to 64 characters): a retry with the same key and body returns the stored response without counting usage again.
03JavaScript SDK
@bouncedmail/sdk has zero dependencies and runs in Node 18+, Cloudflare Workers, Deno, Bun and Vercel. getClientIp(req, platform) reads the one header each platform sets at its edge: vercel, cloudflare, fly, netlify, express or node.
import { createClient, getClientIp } from "@bouncedmail/sdk";
const bm = createClient({ apiKey: process.env.BOUNCEDMAIL_KEY! });
const verdict = await bm.check({
email,
ip: getClientIp(req, "vercel"), // end user's IP
user_agent: req.headers.get("user-agent") ?? undefined,
});
// Same inbox as an existing account: never create a second one.
if (verdict.suggested_ux === "login_instead") return showLoginInstead();
if (verdict.action === "block") return showNeutralError(verdict.did_you_mean);
if (verdict.action === "challenge") return requireEmailVerification();
// allow: create the accountThe npm package is published at launch; until then, copy sdk/index.ts from the repository.
04Act on the verdict
suggested_ux: "login_instead"first. The address reaches the same inbox as an account that was already checked. Show "You already have an account. Log in instead." and don't create a new one. Branch on this beforeaction: an alias farmer owns the inbox, so email verification alone won't stop them.block: reject with a neutral message; offerdid_you_meanif set.challenge: add one step (verify the email before free credits, Turnstile, a phone).allow: proceed. Storenormalized_emailand put a unique index ondedupe_key.
05Response fields
{
"request_id": "chk_01M8NCH1YV0W7PHS9ARG937691",
"risk_score": 75,
"action": "challenge",
"suggested_ux": "login_instead",
"reasons": [
{ "code": "duplicate_email", "weight": 70, "strength": "strong",
"message": "Same mailbox as an account checked before (first checked 3 days ago)." },
{ "code": "plus_alias", "weight": 5, "strength": "flag",
"message": "Uses a +tag alias; it reaches the same inbox as the address without the tag." }
],
"normalized_email": "johnsmith@gmail.com",
"dedupe_key": "johnsmith@gmail.com",
"did_you_mean": null,
"warnings": []
}| Field | Meaning |
|---|---|
risk_score | 0 to 100. By default 30+ challenges and 70+ with a strong reason blocks. |
action | allow, challenge or block. |
suggested_ux | "login_instead" or null. |
reasons | Each with code, weight, strength and a plain-English message. |
normalized_email, dedupe_key | The address to store, and the key that is the same for every alias of one inbox. |
did_you_mean | A suggested fix for a mistyped domain, or null. |
signals, warnings | Raw email, IP, phone and velocity signals; non-fatal notes such as dns_unavailable. |
06Drop-in examples
Full versions live in examples/ in the repository. Each one branches on suggested_ux first.
import { NextResponse, type NextRequest } from "next/server";
import { createClient, getClientIp } from "@bouncedmail/sdk";
const bm = createClient({ apiKey: process.env.BOUNCEDMAIL_KEY!, timeoutMs: 1500 });
export const config = { matcher: ["/api/signup"] };
export async function middleware(req: NextRequest) {
if (req.method !== "POST") return NextResponse.next();
const body = await req.clone().json().catch(() => null);
if (typeof body?.email !== "string") return NextResponse.next();
const verdict = await bm.check({ email: body.email, ip: getClientIp(req, "vercel") });
if (verdict.suggested_ux === "login_instead")
return NextResponse.json({ error: "account_exists" }, { status: 409 });
if (verdict.action === "block")
return NextResponse.json({ error: "signup_rejected", did_you_mean: verdict.did_you_mean }, { status: 422 });
const headers = new Headers(req.headers);
headers.set("x-bouncedmail-action", verdict.action); // challenge: verify email before free credits
return NextResponse.next({ request: { headers } });
}// Auth > Hooks > Before User Created (HTTPS). Returning an error rejects the signup.
import { Webhook } from "https://esm.sh/standardwebhooks@1.0.0";
import { createClient } from "npm:@bouncedmail/sdk";
const bm = createClient({ apiKey: Deno.env.get("BOUNCEDMAIL_KEY")!, timeoutMs: 1500 });
const secret = (Deno.env.get("BEFORE_USER_CREATED_HOOK_SECRET") ?? "").replace("v1,whsec_", "");
const reject = (message: string) =>
Response.json({ error: { http_code: 403, message } }, { status: 403 });
Deno.serve(async (req) => {
const event = new Webhook(secret).verify(await req.text(), Object.fromEntries(req.headers)) as any;
const email = event.user?.email;
if (!email) return Response.json({});
const verdict = await bm.check({ email, ip: event.metadata?.ip_address });
if (verdict.suggested_ux === "login_instead") return reject("You already have an account. Log in instead.");
if (verdict.action === "block") return reject("We couldn't create an account with this email.");
return Response.json({}); // allow and challenge proceed
});// user.created webhook: Clerk has already created the user, so ban or flag it.
import { verifyWebhook } from "@clerk/nextjs/webhooks";
import { createClerkClient } from "@clerk/backend";
import { createClient } from "@bouncedmail/sdk";
const bm = createClient({ apiKey: process.env.BOUNCEDMAIL_KEY!, timeoutMs: 1500 });
const clerk = createClerkClient({ secretKey: process.env.CLERK_SECRET_KEY! });
export async function POST(req: Request) {
const evt = await verifyWebhook(req as never);
if (evt.type !== "user.created") return new Response("ignored");
const user = evt.data;
const email = user.email_addresses.find((e) => e.id === user.primary_email_address_id)?.email_address;
if (!email) return new Response("no email");
const verdict = await bm.check({ email }, { idempotencyKey: req.headers.get("svix-id") ?? undefined });
if (verdict.action === "block" && verdict.suggested_ux !== "login_instead") await clerk.users.banUser(user.id);
else await clerk.users.updateUserMetadata(user.id, {
publicMetadata: { bouncedmail: { action: verdict.action, duplicate: verdict.suggested_ux === "login_instead" } },
});
return new Response("ok");
}import express from "express";
import { createClient, dedupeKey, getClientIp } from "@bouncedmail/sdk";
const app = express();
app.set("trust proxy", 1); // number of proxies in front of the app
app.use(express.json({ limit: "8kb" }));
const bm = createClient({ apiKey: process.env.BOUNCEDMAIL_KEY!, timeoutMs: 1500 });
app.post("/signup", async (req, res) => {
const { email, password } = req.body ?? {};
const verdict = await bm.check({ email, ip: getClientIp(req, "express"), user_agent: req.get("user-agent") });
if (verdict.suggested_ux === "login_instead") return res.status(409).json({ error: "account_exists" });
if (verdict.action === "block") return res.status(422).json({ error: "signup_rejected", did_you_mean: verdict.did_you_mean });
const user = await createUser({
email: verdict.normalized_email ?? email,
dedupeKey: verdict.dedupe_key ?? dedupeKey(email), // keep a UNIQUE index on this
password,
needsVerification: verdict.action === "challenge",
});
res.status(201).json({ id: user.id });
});07Failures and errors
The SDK never breaks your signup form, and it doesn't fail open to a flood either:
| What happened | SDK returns |
|---|---|
| Timeout (1,500 ms), network error, 5xx | allow with error set |
429 rate_limited or quota_exceeded | challenge (these mostly happen during a flood) |
| Other 4xx (e.g. a revoked key) | allow with error: "client"; watch your logs |
API errors look like {"error": {"code", "message", "request_id"}}: 400 invalid_json, 401 missing_api_key / invalid_api_key, 403 insufficient_scope, 413, 415, 422 validation_error, 429 rate_limited / quota_exceeded (with Retry-After), 503 unavailable. An invalid email is not an error: it is a 200 with email_invalid_syntax.
08Limits
- Monthly quota per plan (free 1,000, Starter 20,000, Growth 100,000, Scale 500,000). Up to 2× still works with a
quota_gracewarning. Every 200 carriesX-Quota-Limit,X-Quota-UsedandX-Quota-Reset. - Bursts: 500 requests per 10 seconds per key.
- Test keys (
sg_test_) run every check but store nothing, up to 1,000 checks a month. - Server-side only: there are no CORS headers. Base URL:
https://api.bouncedmail.dev.
09What we store
No raw email, IP, phone number or user agent is stored or logged. Repeat-account memory, velocity counters and phone links are keyed hashes (HMAC-SHA256 under a server secret and your account's salt), kept for 90 days by default (30 to 365, configurable); velocity counters expire within 24 hours. DELETE /v1/subjects erases one mailbox (every alias of it) from your account. Domain-age lookups send only the email's domain to that TLD's RDAP registry and can be switched off.
Your own BouncedMail account. When you sign in with GitHub we keep your GitHub id, username, name, primary verified email, plan, the verdict of our own check on your signup, and when you signed up. Not your GitHub token (revoked right after sign-in) or your repositories; your IP and browser only as the same short-lived keyed hashes our check keeps for every customer. Your API key is stored only as a hash. Want it all deleted? Talk to the founder.
10List sources
Disposable domains: disposable-email-domains (CC0), disposable/disposable-email-domains (MIT), 7c/fakefilter (BSD-3). Free providers: willwhite/freemail (ISC). Universities: Hipo university-domains-list (MIT). IP ranges published by AWS, Google Cloud, Azure, Oracle Cloud, DigitalOcean and Apple (iCloud Private Relay); IP to ASN: IPtoASN (PDDL); Tor exits: the Tor Project's bulk exit list.
11Talk to the founder
BouncedMail is built and run by one founder, who answers every message personally: paid plans and custom quotas, a signup our own check turned away, a starter quota you'd like lifted, a false positive, or a question before you integrate.
A booking link for a 20-minute call goes here shortly. Until then: every signup, including one our check turned away, lands on the founder's review list, and the founder writes to the primary email of your GitHub account. There's nothing else you need to send.