Tired of bogus email addresses clogging up your signups? You're not alone. If you run a website and want clean, real, working emails—without annoying your users—this guide is for you. Here’s how to use the Usebouncer API to check emails as people type, so you catch the bad ones before they hit your database.
No hand-wavy marketing speak here—just a step-by-step walkthrough, real code, and a few honest warnings about gotchas and what’s actually worth your time.
Why Bother With Real-Time Email Validation?
- More real users: Fake or mistyped emails mean lost leads, bouncebacks, and headaches.
- Clean lists: Less junk in your system means lower costs and better deliverability.
- Better user experience: Catch typos early, not after you’ve sent a welcome email to nowhere.
You could let people sign up with any string that looks like an email, but you’ll pay for it later. That said, don’t get carried away—no tool is perfect, and overzealous validation can annoy real users.
Step 1: Get Your Usebouncer API Key
First things first, you need an account with Usebouncer. Here’s what to do:
- Sign up at the Usebouncer site and log in.
- Find your API key in the dashboard. It’s usually under something like “API” or “Integrations.”
- Copy it and keep it somewhere safe—you’ll need it for API calls.
Pro Tip: Don’t hardcode your API key in client-side code (JavaScript in the browser). It’s like leaving your house keys under the mat. Anyone can grab it and burn through your credits.
Step 2: Understand the Usebouncer API Basics
Usebouncer’s main job is to take an email address and tell you if it’s:
- Valid (real and deliverable)
- Invalid (typo, fake, or dead)
- Risky (catch-all, disposable, or suspicious)
You hit their endpoint with the email you want to check, and get a JSON response back. Simple enough.
API Endpoint Example:
POST https://api.usebouncer.com/v1/email/verify
Headers:
X-API-Key
: Your API keyContent-Type
: application/json
Body:
json { "email": "user@example.com" }
Sample Response:
json { "email": "user@example.com", "status": "deliverable", "reason": "accepted_email", "domain_status": "safe" }
Step 3: Decide Where to Validate—Frontend or Backend?
Here’s the honest answer: Do the actual API call from your backend. Never expose your API key in browser JavaScript. Client-side validation is fine for checking if an email “looks like” an email, but Usebouncer checks if it is one.
What works: - Use frontend (JavaScript) for instant feedback (e.g., missing “@”, obvious typos). - Use backend to call Usebouncer and get the real verdict.
What doesn’t:
- Calling Usebouncer directly from the browser (API key risk).
- Relying only on regex or HTML5 validation—people can easily bypass it.
Step 4: Add Real-Time Validation to Your Signup Form
Let’s put it all together. Here’s a basic flow:
- User enters email.
- Frontend does a quick format check (optional, but nice for UX).
- On blur or submit, send the email to your backend (Node, Python, PHP—whatever you use).
- Backend calls Usebouncer API.
- Backend returns the result to the frontend.
- Frontend shows a message: green check for good, warning for risky, red for invalid.
Example: Backend Email Check (Node.js/Express)
Here’s a straight-up backend endpoint you can use:
js // server.js const express = require('express'); const fetch = require('node-fetch');
const app = express(); app.use(express.json());
const USEBOUNCER_API_KEY = process.env.USEBOUNCER_API_KEY;
app.post('/validate-email', async (req, res) => { const { email } = req.body; try { const response = await fetch('https://api.usebouncer.com/v1/email/verify', { method: 'POST', headers: { 'X-API-Key': USEBOUNCER_API_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ email }) });
if (!response.ok) {
throw new Error('Usebouncer API error');
}
const data = await response.json();
res.json({ status: data.status, reason: data.reason });
} catch (err) { res.status(500).json({ error: 'Email validation failed' }); } });
app.listen(3000, () => console.log('Server running on port 3000'));
Don’t forget: Set your USEBOUNCER_API_KEY
in environment variables. Never check it into version control.
Example: Frontend Call (React, but works anywhere)
js // EmailInput.js import { useState } from 'react';
function EmailInput() { const [email, setEmail] = useState(''); const [validation, setValidation] = useState(null);
const checkEmail = async () => { const res = await fetch('/validate-email', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email }) }); const data = await res.json(); setValidation(data); };
return (
You can adapt this to Vue, plain JS, whatever. The flow’s the same.
Step 5: Handle Edge Cases (And Don’t Be a Jerk About It)
Not every “invalid” email is actually bad—sometimes Usebouncer will flag catch-all domains, or emails from weird providers. Here’s what to keep in mind:
- Don’t block users outright if the email is risky or unknown. Warn them, but let them proceed.
- Disposable/temporary emails: If you care about quality, block these. Usebouncer will usually flag them as risky or undeliverable.
- Catch-all domains: Some company emails might be flagged as risky. If you serve businesses, don’t overreact.
- Network errors: If Usebouncer is down or your server hiccups, let people through and maybe validate later. Don’t break your signup flow over an API timeout.
Pro Tip: Log the validation result in your database. That way, if something slips through, you’ve got an audit trail.
Step 6: Test, Monitor, and Tune
- Test with real and fake emails: Try Gmail, Outlook, disposable services (like Mailinator), and obvious gibberish.
- Monitor your API usage: Usebouncer isn’t free. Don’t check the same email 15 times for one user.
- Cache results: If a user tries the same email repeatedly, don’t re-validate every time.
- Watch for false positives: If you get complaints about “my real email isn’t working,” investigate. No tool is perfect.
Step 7: Don’t Sweat the Small Stuff
It’s tempting to obsess over catching every single fake email. Don’t. Usebouncer is good, but there will always be a few that slip through or get wrongly flagged. Focus on stopping the obvious junk, keeping your users happy, and not making signups a chore.
Final Thoughts
Adding real-time email validation with Usebouncer is straightforward if you stick to the basics:
- Do the heavy lifting server-side.
- Give users clear, friendly feedback.
- Don’t punish people for edge cases.
- Keep your implementation simple and improve it as you go.
The goal is fewer headaches, not more complexity. Get the basics working, watch what happens, and adjust. That’s really all you need.