The official Node.js SDK for StopReg, providing advanced email and domain verification to protect your application from fraudulent registrations and disposable email addresses.
- Email Verification: Check if an email is disposable, role-based, or blocked.
- Domain Verification: Verify domains for MX records and provider reputation.
- MX Record Lookup: Automated mail server verification.
- Provider Reputation: Identify high-risk providers and disposable email services.
- TypeScript Support: Fully typed for a better developer experience.
npm install @stopreg/stopreg
# or
pnpm add @stopreg/stopreg
# or
yarn add @stopreg/stopregInitialize the client with your StopReg API token (get one at stopreg.com/dashboard).
import { StopReg } from '@stopreg/stopreg';
const stopreg = new StopReg({
apiToken: 'your_api_token_here'
});
async function runCheck() {
// 1. Verify an email address
const emailResult = await stopreg.verification.checkEmail('test@disposable.com');
console.log('Is Disposable:', emailResult.data.classification.is_disposable);
// 2. Verify a domain
const domainResult = await stopreg.verification.checkDomain('gmail.com');
console.log('Provider:', domainResult.data.domain.provider);
}
runCheck();Check detailed metrics for any email address:
import { StopReg } from '@stopreg/stopreg';
const stopreg = new StopReg({ apiToken: '...' });
const result = await stopreg.verification.checkEmail('user@gmail.com');
console.log(result.data.input.email); // "user@gmail.com"
console.log(result.data.classification.is_disposable); // false
console.log(result.data.classification.is_role_based); // false
console.log(result.data.mail_server.mx_found); // trueVerify a domain before allowing a user to register:
const result = await stopreg.verification.checkDomain('stopreg.com');
console.log(result.data.domain.name); // "stopreg.com"
console.log(result.data.domain.provider); // "google"
console.log(result.data.mail_server.mx_found); // trueThe SDK throws descriptive errors for invalid inputs or API issues.
try {
await stopreg.verification.checkEmail('invalid-email');
} catch (error) {
// "A valid email address is required."
console.log(error.message);
}MIT © StopReg