Skip to content

Node.js SDK for Enrichr — micro-toll utility API warehouse. npm install enrichr

Notifications You must be signed in to change notification settings

crisjonblvx/enrichr-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

enrichr

Node.js SDK for Enrichr — a micro-toll utility API warehouse. One API key. 40 endpoints. Fractions of a cent per call.

Install

npm install enrichr

Requires Node 18+ (uses native fetch). For older Node, pass a custom fetch function.

Quick start

const { Enrichr } = require('enrichr');
// or: import { Enrichr } from 'enrichr';

const client = new Enrichr('enr_your_api_key');

// Validate an email
const email = await client.enrich.email('user@example.com');
console.log(email.data.valid);          // true
console.log(email.data.disposable);    // false
console.log(email.cost_usd);           // 0.0001

// Generate a slug
const slug = await client.generate.slug('Hello World! Café & More');
console.log(slug.data.slug);           // hello-world-cafe-more

// Validate a credit card (Luhn + network, number never stored)
const card = await client.validate.creditCard('4111 1111 1111 1111');
console.log(card.data.network);        // Visa

// Look up a MIME type
const mime = await client.lookup.mimeType('pdf');
console.log(mime.data.mime_type);      // application/pdf

All 40 endpoints

client.enrich

Method Description
.email(email) Validate email (format, MX, disposable)
.phone(phone, countryHint?) Parse phone to E.164, detect line type
.address(street, city, options?) Normalize postal address
.ip(ip) Geolocate IP (country, city, ISP, timezone)
.classify(text) Sentiment, toxicity, spam, language

client.convert

Method Description
.currency(amount, fromCurrency, toCurrency) ECB rates, updated daily
.timezone(datetime, fromTz, toTz) DST-aware IANA timezone conversion
.units(value, fromUnit, toUnit, category?) Length, weight, temperature, area, volume
.number(value, fromBase) decimal ↔ binary ↔ octal ↔ hex ↔ Roman
.case(text) camelCase, snake_case, PascalCase + 6 more
.htmlToText(html) Strip HTML tags
.markdown(markdown) Markdown → HTML
.encoding(text, codec?, operation?) base64, hex, url, html, rot13

client.validate

Method Description
.vat(vatNumber) EU VAT — format + VIES check
.password(password) HIBP breach check + strength score
.creditCard(number) Luhn + network (Visa, MC, Amex, …)
.iban(iban) MOD-97 checksum, 77 countries
.json(jsonString) Validate + format + analyze JSON
.color(color) hex/rgb/hsl conversion
.domain(domain) Format + DNS A + MX check
.regex(pattern, testString, options?) Test regex, return all matches
.uuid(uuid) Validate + detect version (v1–v5)

client.generate

Method Description
.qr(content, options?) QR code → base64 PNG + data URI
.uuid(version?, count?) UUID v1 or v4, up to 100
.hash(text, algorithm?, encoding?) MD5/SHA-1/SHA-256/SHA-512
.password(options?) Secure random password + entropy
.slug(text, options?) URL-safe slug (Unicode-aware)
.avatar(name, options?) SVG initials avatar
.lorem(options?) Lorem ipsum text
.token(options?) hex / url_safe / alphanumeric / api_key

client.analyze

Method Description
.text(text) Word count, reading time, Flesch readability

client.filter

Method Description
.profanity(text) Detect + censor profanity

client.lookup

Method Description
.postal(postalCode, country?) City, state, coords (60+ countries)
.country(query) Country by ISO code or name
.timezone(timezone) IANA timezone info (offset, DST, abbr)
.mimeType(query) Extension → MIME or MIME → extensions

client.parse

Method Description
.url(url) Scheme, host, path, params, UTM tags
.userAgent(userAgent) Browser, OS, device, bot detection
.csv(csvString, hasHeaders?) CSV string → structured rows
.date(dateString) Parse any date string

client.account

Method Description
.signup(email) Create an API key
.usage() Monthly call count + estimated charge

Error handling

const { Enrichr, EnrichrError } = require('enrichr');

const client = new Enrichr('enr_your_key');
try {
  const result = await client.enrich.email('user@example.com');
} catch (err) {
  if (err instanceof EnrichrError) {
    console.error(err.status, err.message);
  }
}

Older Node.js / custom fetch

const nodeFetch = require('node-fetch');
const client = new Enrichr('enr_...', { fetch: nodeFetch });

Pricing

First 1,000 calls/month are free. After that:

  • Most utility endpoints: $0.00001/call (one-hundredth of a cent)
  • Enrichment endpoints: $0.0001/call
  • VAT, address: $0.0005/call

Full pricing at enrichrapi.dev.

License

MIT

About

Node.js SDK for Enrichr — micro-toll utility API warehouse. npm install enrichr

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages