Checking one domain name is easy. Checking 80 of them for a naming brainstorm or a client is not, and opening a registrar tab per name gets old fast.
So I built a small bulk domain availability checker in Next.js. You paste a list and click a button. A table shows which names are free, and you can download the results as a CSV.
It's about 260 lines of JavaScript across four files, plus a small stylesheet. Here's how it works.
Full code: https://github.com/Adeen1/Bulk-domain-availability-checker
What we're building
The flow:
- The user pastes domains into a textarea.
- The page POSTs that text to our own API route,
/api/check. - The API route cleans up the list and sends it in batches of 100 to the bulk endpoint of the WhoisFreaks Domain Availability API.
- The route sends back one result per domain:
AVAILABLE,UNAVAILABLEorUNKNOWN. - The page shows a table and offers a CSV download.
The important part is step 2. The browser never talks to the domain availability API directly. The API key lives in an environment variable on the server, and the client only ever calls /api/check.
Setup
You need Node.js 20.9+ and an API key. New WhoisFreaks accounts get 500 free credits, and each domain you check costs 1 credit.
npx create-next-app@latest dev-to-blog-app --js --app --no-tailwind --no-src-dir --yes cd dev-to-blog-app (Or clone the repo above and run npm install.)
Put your key in .env.local in the project root:
WHOISFREAKS_API_KEY=your_api_key_here The .gitignore that create-next-app generates already ignores .env files, but check yours anyway before you push. Also, the variable name has no NEXT_PUBLIC_ prefix. That's deliberate: without the prefix, Next.js keeps the value on the server and never bundles it into client code.
The project ends up looking like this:
app/ api/check/route.js POST /api/check page.js the UI layout.js globals.css lib/ checkDomains.js talks to the API (server only) A quick look at the API
Before writing any code, I hit the endpoint with curl to see what it actually returns. To check several domains at once, you POST a JSON body to /v2.0/domain/availability:
curl -X POST "https://api.whoisfreaks.com/v2.0/domain/availability?apiKey=$WHOISFREAKS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"domainNames": ["openai.com", "bluecactusbakery.com", "not a domain"]}' Response:
{ "bulk_domain_availability_response": [ { "domain": "not a domain", "availability": "UNKNOWN", "status": false }, { "domain": "bluecactusbakery.com", "availability": "AVAILABLE", "status": true }, { "domain": "openai.com", "availability": "UNAVAILABLE", "status": true } ] } Three things in there shaped the code:
- The order is not the order I sent.
openai.comwent in first and came back last. So results have to be matched by thedomainfield, never by array index. - The HTTP status was
206 Partial Content, not200. That happens when at least one name comes backUNKNOWN. It's still a successful response with usable data, so the code has to accept it. - The limit is 100 names per request. Send 101 and you get a
413. Longer lists have to be split into batches.
Rate limits matter too. The free tier allows 5 bulk requests per minute. Go over that and you get a 429, with an x-ratelimit-remaining-time header telling you how long to wait (in nanoseconds, oddly).
If you want the basics of the single-domain call, suggestions and TLD checks, the WhoisFreaks tutorial How to Check if a Domain Name is Available to Register covers them. This post stays on the bulk side.
Step 1: The server-side helper
All the API logic lives in lib/checkDomains.js. It's only ever imported by the API route, so it runs on the server.
// lib/checkDomains.js // Server-only code. It reads the API key from the environment, // so never import this file into a client component. const API_URL = "https://api.whoisfreaks.com/v2.0/domain/availability"; const BATCH_SIZE = 100; // the bulk endpoint accepts at most 100 names per request const MAX_RETRIES = 3; const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); // Split ["a", "b", "c", "d"] into [["a", "b"], ["c", "d"]] function chunk(list, size) { const chunks = []; for (let i = 0; i < list.length; i += size) { chunks.push(list.slice(i, i + size)); } return chunks; } Nothing fancy: a sleep helper for waiting between retries, and chunk to cut a long list into groups of 100.
Sending one batch, with retries on 429
// Send one batch (up to 100 names) to the bulk endpoint. // Retries when we hit the rate limit (HTTP 429). async function checkBatch(domains) { const url = `${API_URL}?apiKey=${process.env.WHOISFREAKS_API_KEY}`; for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) { const res = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ domainNames: domains }), // a full batch can take up to a minute, so give it room signal: AbortSignal.timeout(90_000), }); if (res.status === 429 && attempt < MAX_RETRIES) { // The API tells us how long until the limit resets, in nanoseconds. const resetNs = Number(res.headers.get("x-ratelimit-remaining-time")); const waitMs = resetNs > 0 ? resetNs / 1_000_000 : 2 ** attempt * 5000; console.log(`Rate limited, waiting ${Math.round(waitMs / 1000)}s before retrying`); await sleep(waitMs); continue; } // 200 = every name was checked, 206 = some came back UNKNOWN. // Both are fine for us. if (!res.ok) { throw new Error(`API returned ${res.status}: ${await res.text()}`); } const data = await res.json(); return data.bulk_domain_availability_response || []; } throw new Error("Still rate limited after several retries"); } A few notes:
- The key is read from
process.env. It's never hardcoded, and it never leaves the server. - The timeout is 90 seconds. The docs say a full batch of 100 can take anywhere from 16 seconds to a minute. A typical 10-second client timeout would kill healthy requests.
- On a 429 we wait, then try again. If the API tells us how long to wait, we use that. Otherwise we fall back to 5s, 10s, 20s. After three retries we give up on that batch.
-
res.okcovers both 200 and 206, sinceokis true for any 2xx status.
Checking the whole list
// Check any number of domains and return one result per name, // in the same order the user typed them. export async function checkDomains(domains) { const found = new Map(); const errors = []; for (const batch of chunk(domains, BATCH_SIZE)) { try { const results = await checkBatch(batch); // The API does not keep our order, so match on the domain name. for (const item of results) { found.set(item.domain.toLowerCase(), item.availability); } } catch (err) { // Don't throw away the batches that already worked. // The names in this batch will show up as UNKNOWN. console.error(err); errors.push(err.message); } } const results = domains.map((domain) => ({ domain, status: found.get(domain) || "UNKNOWN", })); return { results, errors }; } This is where the three statuses come together. Every result goes into a Map keyed by domain name. At the end, we walk the user's original list and look each name up. That gives us:
- the user's order back, whatever order the API used
-
UNKNOWNfor anything missing, whether the API said so or the whole batch failed
The batches run one after another, not in parallel. With 5 bulk requests a minute on the free tier, firing them all at once would only earn us more 429s.
The try/catch around each batch is the part I like most. Say you paste 400 names and batch 3 fails. You still get real results for the other 300, plus a message saying what went wrong. Partial results beat an error screen.
Step 2: The API route
The route at app/api/check/route.js is the only thing the browser talks to.
// app/api/check/route.js import { checkDomains } from "@/lib/checkDomains"; const MAX_DOMAINS = 500; // Turn "https://www.Example.com/about" into "example.com" function cleanDomain(input) { return input .trim() .toLowerCase() .replace(/^https?:\/\//, "") .replace(/^www\./, "") .split("/")[0]; } export async function POST(request) { if (!process.env.WHOISFREAKS_API_KEY) { return Response.json( { error: "WHOISFREAKS_API_KEY is missing. Add it to .env.local" }, { status: 500 } ); } const { text } = await request.json(); // Accept one domain per line, or separated by commas/spaces. // A Set removes duplicates. const domains = [ ...new Set( String(text || "") .split(/[\s,]+/) .map(cleanDomain) .filter(Boolean) ), ]; if (domains.length === 0) { return Response.json({ error: "Paste at least one domain" }, { status: 400 }); } if (domains.length > MAX_DOMAINS) { return Response.json( { error: `Please check ${MAX_DOMAINS} domains or fewer at a time` }, { status: 400 } ); } const { results, errors } = await checkDomains(domains); return Response.json({ results, errors }); } People paste messy lists: full URLs, www. prefixes, trailing slashes, the same name twice. cleanDomain strips that down to a bare domain, and the Set removes duplicates so you don't pay twice for one name.
Why cap it at 500? That's 5 batches of 100, which matches the free tier's 5 bulk requests per minute. If you're on a bigger plan, raise it.
Step 3: The page
app/page.js is a client component with four pieces of state: the textarea text, the results, any errors, and a loading flag.
"use client"; import { useState } from "react"; // ...SAMPLE text and downloadCsv() (shown below) export default function Home() { const [text, setText] = useState(SAMPLE); const [results, setResults] = useState([]); const [errors, setErrors] = useState([]); const [loading, setLoading] = useState(false); async function handleCheck() { setLoading(true); setErrors([]); setResults([]); try { // Our own API route. The browser never sees the API key. const res = await fetch("/api/check", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ text }), }); const data = await res.json(); if (!res.ok) { setErrors([data.error]); } else { setResults(data.results); setErrors(data.errors); } } catch (err) { setErrors(["Could not reach the server. Is it running?"]); } finally { setLoading(false); } } // ... } The page sends the raw textarea text and lets the server do the parsing. That keeps the cleanup rules in one place.
The results table
Each status gets a colored badge. The CSS class is just the status in lowercase:
<p className="summary"> {results.length} checked: {count("AVAILABLE")} available,{" "} {count("UNAVAILABLE")} taken, {count("UNKNOWN")} unknown </p> <table> <thead> <tr> <th>Domain</th> <th>Status</th> </tr> </thead> <tbody> {results.map((r) => ( <tr key={r.domain}> <td>{r.domain}</td> <td> <span className={`badge ${r.status.toLowerCase()}`}>{r.status}</span> </td> </tr> ))} </tbody> </table> .badge.available { background: #dcfce7; color: #166534; } .badge.unavailable { background: #fee2e2; color: #991b1b; } .badge.unknown { background: #fef9c3; color: #854d0e; } count is a one-liner in the component:
const count = (status) => results.filter((r) => r.status === status).length; CSV export
No library needed. Build the rows, join them, wrap them in a Blob, and click a temporary link:
// Build a CSV string and let the browser download it function downloadCsv(results) { const rows = [["domain", "status"], ...results.map((r) => [r.domain, r.status])]; const csv = rows.map((row) => row.map((cell) => `"${cell}"`).join(",")).join("\n"); const blob = new Blob([csv], { type: "text/csv" }); const link = document.createElement("a"); link.href = URL.createObjectURL(blob); link.download = "domain-availability.csv"; link.click(); URL.revokeObjectURL(link.href); } Every cell is wrapped in quotes so Excel and Google Sheets open the file cleanly. The CSV from the screenshot above looks like this:
"domain","status" "whoisfreaks.com","UNAVAILABLE" "google.com","UNAVAILABLE" "bluecactusbakery.com","AVAILABLE" "my-tiny-startup-idea.io","AVAILABLE" "quietorbit.dev","AVAILABLE" "pixelharbor.app","UNAVAILABLE" "github.com","UNAVAILABLE" "hello.notarealtld","UNKNOWN" Running it
npm run dev Open http://localhost:3000, paste some names, and click Check domains.
For a bigger test I pasted 105 names: 10 well-known taken domains, 93 random combinations like velvetnimbus347.io, and two junk names. The route split them into a batch of 100 and a batch of 5. Here's what came back:
| Status | Count |
|---|---|
| AVAILABLE | 91 |
| UNAVAILABLE | 10 |
| UNKNOWN | 4 |
All 10 famous domains came back UNAVAILABLE, as expected. The two junk names (hello.notarealtld, test.zzzzz) came back UNKNOWN. The other two UNKNOWNs were more interesting: maplesolar181.dev and tinyriver638.app. Both are perfectly valid names, but the API couldn't give a definite answer for them on that run.
That's why the third status matters.
What to do with UNKNOWN
It's tempting to treat UNKNOWN as "probably available". Don't. It means the API couldn't confirm either way: an invalid name, a TLD it couldn't check, or (in our app) a batch that failed after retries.
Treat it as "check again". In practice:
- Re-run the
UNKNOWNnames a bit later. Paste them back in; it's cheap. - Never show
UNKNOWNas available in anything user-facing. Selling someone a domain you can't deliver is worse than saying "try again". - Also,
UNAVAILABLEisn't always "someone owns it". Names in redemption, pending delete, or reserved/premium names also come backUNAVAILABLE. If you need to know which, run a WHOIS lookup on those specific names.
Things I'd add next
- A retry button for
UNKNOWNrows that re-checks just those names. - A file upload for
.txtor.csvlists, so you don't have to paste. - Streaming progress for long lists ("batch 2 of 5"), since a 500-name run can take a few minutes.
- A TLD multiplier: type
bluecactusonce, check it across.com,.io,.devand.app.
Wrapping up
The whole bulk domain availability checker comes down to a few decisions:
- Keep the API key on the server, behind your own API route.
- Batch requests to the API's limit (100), and run them one at a time.
- Retry on 429 using the wait time the API gives you.
- Match results by domain name, not by position.
- Treat
UNKNOWNas its own state, and keep partial results when one batch fails.
The full project is on GitHub: https://github.com/Adeen1/Bulk-domain-availability-checker. Clone it, add your key to .env.local, and run npm run dev.
To check domain availability through the API in your own project, the Domain Availability API page has the full parame...



