The official LeadMagic SDK for JavaScript and TypeScript. Validate emails and look up companies from your server, and add email validation to a Next.js form in three files.
npm install leadmagicimport { validateEmail } from "leadmagic";
const { data, error } = await validateEmail("alex@example.com");
if (data) console.log(data.verdict); // "deliverable" | "undeliverable" | "unknown"Set LEADMAGIC_API_KEY on your server. No key yet? Create an API key.
| Import | Use it for |
|---|---|
leadmagic |
validateEmail, findCompany and getCredits from any server runtime |
leadmagic/next |
A Route Handler that validates emails for your forms |
leadmagic/react |
useEmailValidation, a headless hook for email fields |
It runs on Node.js 20+, Bun, Deno, Cloudflare Workers and Vercel Functions. Types are included, and the package has no runtime dependencies.
- Introduction
- Validate emails in Next.js forms
- Reference
- Errors
- Sandbox and testing
- Keeping your key safe
| Path | |
|---|---|
packages/leadmagic |
The SDK |
examples/next-signup |
A Next.js signup form built with shadcn/ui |
registry |
The email field you install with npx shadcn add |
See CONTRIBUTING.md to set up the repository and send a change. To report a security problem, follow SECURITY.md instead of opening an issue.