npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@verifyforge/sdk

v1.0.1

Published

Official TypeScript/JavaScript SDK for VerifyForge Email Validation API

Readme

VerifyForge TypeScript SDK - Email Validation API

npm version TypeScript License: MIT

Official TypeScript/JavaScript SDK for the VerifyForge Email Validation API.

Features

  • 🔍 Hybrid Validation - Syntax, MX records, SMTP verification, and disposable detection
  • Fast & Reliable - Optimized for speed with smart caching
  • 🚀 Bulk Processing - Validate up to 100 emails in a single request
  • 💯 Type Safe - Full TypeScript support with comprehensive type definitions
  • 🛡️ Error Handling - Comprehensive error handling with custom error classes
  • 🔐 Secure - API key authentication
  • 📦 Universal - Works in Node.js and modern browsers
  • 🌳 Tree-shakeable - ESM and CommonJS builds

Installation

npm install @verifyforge/sdk

Or using yarn:

yarn add @verifyforge/sdk

Or using pnpm:

pnpm add @verifyforge/sdk

Quick Start

import { VerifyForge } from '@verifyforge/sdk';

// Initialize the client
const client = new VerifyForge({ apiKey: 'your_api_key_here' });

// Validate a single email
const result = await client.validate('[email protected]');

if (result.data.isValid) {
  console.log('✓ Email is valid!');
  console.log(`Reachability: ${result.data.reachability}`);
} else {
  console.log('✗ Email is invalid');
}

console.log(`Credits remaining: ${result.remainingCredits}`);

Usage Examples

Single Email Validation

import { VerifyForge } from '@verifyforge/sdk';

const client = new VerifyForge({ apiKey: 'your_api_key' });

// Validate an email
const result = await client.validate('[email protected]');

// Access validation details
console.log(`Email: ${result.data.email}`);
console.log(`Valid: ${result.data.isValid}`);
console.log(`Disposable: ${result.data.disposable}`);
console.log(`Role Account: ${result.data.roleAccount}`);
console.log(`Free Provider: ${result.data.freeProvider}`);
console.log(`Reachability: ${result.data.reachability}`);

// Check MX records
for (const mx of result.data.mxRecordsList) {
  console.log(`MX: ${mx.exchange} (priority: ${mx.priority})`);
}

// SMTP analysis
const smtp = result.data.smtp;
if (smtp.connectionSuccessful) {
  console.log(`SMTP accepts mail: ${smtp.acceptsMail}`);
}

Bulk Email Validation

import { VerifyForge } from '@verifyforge/sdk';

const client = new VerifyForge({ apiKey: 'your_api_key' });

// Validate multiple emails
const emails = [
  '[email protected]',
  '[email protected]',
  '[email protected]',
];

const result = await client.validateBulk(emails);

// Summary statistics
console.log(`Total validated: ${result.data.summary.total}`);
console.log(`Duplicates removed: ${result.data.summary.duplicatesRemoved}`);
console.log(`Credits used: ${result.creditsUsed}`);

// Individual results
for (const item of result.data.results) {
  const status = item.isValid ? '✓' : '✗';
  console.log(`${status} ${item.email} - ${item.reachable}`);
}

Error Handling

import {
  VerifyForge,
  VerifyForgeError,
  AuthenticationError,
  InsufficientCreditsError,
  ValidationError,
} from '@verifyforge/sdk';

const client = new VerifyForge({ apiKey: 'your_api_key' });

try {
  const result = await client.validate('[email protected]');
  console.log(result);
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Invalid API key');
  } else if (error instanceof InsufficientCreditsError) {
    console.error('Not enough credits');
  } else if (error instanceof ValidationError) {
    console.error(`Validation error: ${error.message}`);
    console.error(`Details: ${JSON.stringify(error.details)}`);
  } else if (error instanceof VerifyForgeError) {
    console.error(`API error: ${error.toString()}`);
  } else {
    console.error('Unknown error:', error);
  }
}

Advanced Configuration

import { VerifyForge } from '@verifyforge/sdk';

// Custom base URL and timeout
const client = new VerifyForge({
  apiKey: 'your_api_key',
  baseUrl: 'https://custom-domain.com', // Optional
  timeout: 60000, // Request timeout in milliseconds (default: 30000)
});

TypeScript Usage

The SDK is written in TypeScript and provides full type definitions:

import {
  VerifyForge,
  ValidationResponse,
  BulkValidationResponse,
  ValidationResult,
} from '@verifyforge/sdk';

const client = new VerifyForge({ apiKey: 'your_api_key' });

// Type-safe responses
const result: ValidationResponse = await client.validate('[email protected]');
const bulkResult: BulkValidationResponse = await client.validateBulk([
  '[email protected]',
  '[email protected]',
]);

// Access typed properties
const validation: ValidationResult = result.data;
console.log(validation.isValid); // TypeScript knows this is a boolean
console.log(validation.reachability); // TypeScript knows this is 'safe' | 'risky' | 'invalid' | 'unknown'

Browser Usage

The SDK works in modern browsers with native fetch support:

<script type="module">
  import { VerifyForge } from 'https://unpkg.com/@verifyforge/sdk';

  const client = new VerifyForge({ apiKey: 'your_api_key' });

  const result = await client.validate('[email protected]');
  console.log(result);
</script>

API Reference

VerifyForge

Main client class for interacting with the VerifyForge API.

Constructor

new VerifyForge(config: VerifyForgeConfig)

Parameters:

  • config.apiKey (string, required): Your VerifyForge API key
  • config.baseUrl (string, optional): Base URL for the API. Defaults to "https://verifyforge.com"
  • config.timeout (number, optional): Request timeout in milliseconds. Defaults to 30000

Methods

validate(email: string): Promise<ValidationResponse>

Validate a single email address.

Parameters:

  • email (string): Email address to validate

Returns:

  • Promise<ValidationResponse>: Complete validation results

Throws:

  • ValidationError: If email format is invalid
  • InsufficientCreditsError: If account has insufficient credits
  • APIError: If validation fails
validateBulk(emails: string[]): Promise<BulkValidationResponse>

Validate multiple email addresses (up to 100).

Parameters:

  • emails (string[]): Array of email addresses to validate

Returns:

  • Promise<BulkValidationResponse>: Results for all emails with summary

Throws:

  • ValidationError: If email list is invalid or exceeds 100 emails
  • InsufficientCreditsError: If account has insufficient credits
  • APIError: If validation fails
getBaseUrl(): string

Get the configured base URL.

getTimeout(): number

Get the configured timeout in milliseconds.

Response Types

ValidationResponse

interface ValidationResponse {
  success: boolean;
  data: ValidationResult;
  creditsUsed: number;
  remainingCredits: number;
  validationDuration?: number;
  meta?: {
    apiVersion?: string;
  };
}

ValidationResult

interface ValidationResult {
  email: string;
  isValid: boolean;
  syntax: SyntaxValidation;
  mxRecordsList: MXRecord[];
  smtp: SMTPAnalysis;
  disposable: boolean;
  roleAccount: boolean;
  freeProvider: boolean;
  reachability: 'safe' | 'risky' | 'invalid' | 'unknown';
  suggestion?: string;
  gravatar?: Gravatar;
}

BulkValidationResponse

interface BulkValidationResponse {
  success: boolean;
  data: {
    results: BulkValidationResult[];
    summary: BulkValidationSummary;
  };
  creditsUsed: number;
  remainingCredits: number;
  duration?: number;
  meta?: {
    apiVersion?: string;
  };
}

Error Classes

All errors extend VerifyForgeError:

  • AuthenticationError: Invalid API key (401)
  • InsufficientCreditsError: Insufficient credits (402)
  • ValidationError: Request validation failed (400)
  • RateLimitError: Rate limit exceeded (429)
  • APIError: General API error (5xx)
  • NetworkError: Network request failed

Requirements

  • Node.js 16.0.0 or higher
  • Modern browser with fetch support

Development

# Clone the repository
git clone https://github.com/VerifyForge/typescript-sdk.git
cd typescript-sdk

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

# Run linter
npm run lint

# Format code
npm run format

# Type checking
npm run typecheck

# Watch mode for development
npm run dev

Support

  • 📧 Email: [email protected]
  • 📚 Documentation: https://verifyforge.com/api-docs
  • 🐛 Bug Reports: https://github.com/VerifyForge/typescript-sdk/issues

License

This project is licensed under the MIT License - see the LICENSE file for details.

Links