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

spamuraiz-sdk

v1.0.3

Published

Official SDK for Spamuraiz email validation service

Readme

Spamuraiz SDK

Official Node.js SDK for the Spamuraiz email validation service.

Visit https://tempmailblocker.com/ to purchase credits and get started.

Installation

npm install spamuraiz-sdk

Quick Start

const { Spamuraiz } = require('spamuraiz-sdk');

// Initialize the SDK
const spamuraiz = new Spamuraiz({
  apiKey: "your-api-key",
  baseUrl: "https://tempmailblocker.com"
});

// Validate a single email
async function validateEmail() {
  try {
    const result = await spamuraiz.singleValidation({
      email: "[email protected]"
    });
    console.log(result);
  } catch (error) {
    console.error('Validation failed:', error.message);
  }
}

TypeScript Support

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

import { Spamuraiz, SingleValidationResponse } from 'spamuraiz-sdk';

const spamuraiz = new Spamuraiz({
  apiKey: "your-api-key",
  baseUrl: "https://tempmailblocker.com"
});

const result: SingleValidationResponse = await spamuraiz.singleValidation({
  email: "[email protected]"
});

API Reference

Constructor

new Spamuraiz(config: SpamuraizConfig)

Parameters:

  • config.apiKey (string): Your Spamuraiz API key
  • config.baseUrl (string): The base URL of the Spamuraiz API

Single Email Validation

singleValidation(request: SingleValidationRequest): Promise<SingleValidationResponse>

Validates a single email address and returns detailed validation results.

Example:

const result = await spamuraiz.singleValidation({
  email: "[email protected]"
});

console.log(result);
// {
//   email: "[email protected]",
//   valid: true,
//   score: 95,
//   details: {
//     syntax: true,
//     domain: true,
//     mx: true,
//     disposable: false,
//     role: false,
//     free: false
//   }
// }

Bulk Email Validation

Create Bulk Job

createBulkJob(request: BulkValidationRequest): Promise<BulkValidationJob>

Creates a bulk validation job for multiple emails.

Example:

const job = await spamuraiz.createBulkJob({
  emails: [
    "[email protected]",
    "[email protected]",
    "[email protected]"
  ],
  name: "My Email List" // optional
});

console.log(job.jobId); // Use this to check status and get results

Check Job Status

getJobStatus(jobId: string): Promise<BulkValidationJob>

Example:

const status = await spamuraiz.getJobStatus(job.jobId);
console.log(status.status); // 'pending', 'processing', 'completed', or 'failed'
console.log(`${status.processedEmails}/${status.totalEmails} processed`);

Get Job Results

getJobResults(jobId: string): Promise<BulkValidationResult>

Example:

// Only call this when job status is 'completed'
const results = await spamuraiz.getJobResults(job.jobId);

console.log(results.summary);
// {
//   total: 3,
//   valid: 2,
//   invalid: 1,
//   processed: 3
// }

results.results.forEach(result => {
  console.log(`${result.email}: ${result.valid ? 'Valid' : 'Invalid'}`);
});

Wait for Job Completion

waitForJobCompletion(jobId: string, pollIntervalMs?: number, timeoutMs?: number): Promise<BulkValidationResult>

Convenience method that polls for job completion and returns results automatically.

Example:

// Create job and wait for completion
const job = await spamuraiz.createBulkJob({
  emails: ["[email protected]", "[email protected]"]
});

try {
  const results = await spamuraiz.waitForJobCompletion(
    job.jobId,
    5000,  // Poll every 5 seconds
    300000 // Timeout after 5 minutes
  );

  console.log('Job completed:', results.summary);
} catch (error) {
  console.error('Job failed or timed out:', error.message);
}

Job Management

List Jobs

listJobs(limit?: number, offset?: number): Promise<BulkValidationJob[]>

Example:

const jobs = await spamuraiz.listJobs(10, 0); // Get first 10 jobs
jobs.forEach(job => {
  console.log(`Job ${job.jobId}: ${job.status}`);
});

Delete Job

deleteJob(jobId: string): Promise<void>

Example:

await spamuraiz.deleteJob(job.jobId);
console.log('Job deleted successfully');

Error Handling

The SDK throws descriptive errors that you can catch and handle:

try {
  const result = await spamuraiz.singleValidation({
    email: "invalid-email"
  });
} catch (error) {
  if (error.statusCode) {
    // API error
    console.error(`API Error ${error.statusCode}: ${error.message}`);
    console.error('Error Code:', error.code);
  } else {
    // Network or other error
    console.error('Error:', error.message);
  }
}

Response Types

SingleValidationResponse

interface SingleValidationResponse {
  email: string;
  valid: boolean;
  score: number;          // 0-100 validation score
  reason?: string;        // Reason if invalid
  details?: {
    syntax: boolean;      // Email syntax is valid
    domain: boolean;      // Domain exists
    mx: boolean;          // MX record exists
    disposable: boolean;  // Is disposable email
    role: boolean;        // Is role-based email
    free: boolean;        // Is free email provider
  };
}

BulkValidationJob

interface BulkValidationJob {
  jobId: string;
  status: 'pending' | 'processing' | 'completed' | 'failed';
  totalEmails: number;
  processedEmails: number;
  createdAt: string;
  completedAt?: string;
}

BulkValidationResult

interface BulkValidationResult {
  jobId: string;
  status: 'pending' | 'processing' | 'completed' | 'failed';
  results: SingleValidationResponse[];
  summary: {
    total: number;
    valid: number;
    invalid: number;
    processed: number;
  };
}

Complete Example

const { Spamuraiz } = require('spamuraiz-sdk');

async function main() {
  const spamuraiz = new Spamuraiz({
    apiKey: process.env.SPAMURAIZ_API_KEY,
    baseUrl: "https://tempmailblocker.com"
  });

  try {
    // Single validation
    console.log('=== Single Validation ===');
    const singleResult = await spamuraiz.singleValidation({
      email: "[email protected]"
    });
    console.log('Single validation result:', singleResult);

    // Bulk validation
    console.log('\n=== Bulk Validation ===');
    const bulkJob = await spamuraiz.createBulkJob({
      emails: [
        "[email protected]",
        "[email protected]",
        "invalid@email"
      ],
      name: "Test Validation"
    });

    console.log('Bulk job created:', bulkJob.jobId);

    // Wait for completion
    const bulkResults = await spamuraiz.waitForJobCompletion(bulkJob.jobId);
    console.log('Bulk validation completed:', bulkResults.summary);

    // Print individual results
    bulkResults.results.forEach(result => {
      console.log(`${result.email}: ${result.valid ? '✓' : '✗'} (Score: ${result.score})`);
    });

  } catch (error) {
    console.error('Error:', error.message);
  }
}

main();

License

MIT

Support

For questions and support, please visit our documentation or contact [email protected].