1. Generate and host a compliant IndexNow key file

IndexNow proves you own a hostname through a simple key-file handshake. Choose a random string between 8 and 128 characters containing only lowercase letters, uppercase letters, numbers, and hyphens. A 32-character hexadecimal string (16 random bytes) is the cleanest standard.

Host a UTF-8 plain text file containing only that key—with no HTML wrapper, no extra labels, and no redirects—at the root of your canonical hostname: https://yourdomain.com/<your-key>.txt. Hosting the key at the root authorizes submissions for every path on that exact host. If you instead host the key inside a subdirectory such as /blog/<key>.txt, IndexNow only authorizes URLs under /blog/.

Never serve different keys on www and apex without matching the host field in your payload. Always standardize on one canonical hostname and redirect the alternate host permanently.

Generate a 32-character key and verify it in one terminal command
# Generate a 32-character hex key
openssl rand -hex 16

# After deploying the file, verify HTTP 200, text/plain, and exact body
curl -i https://yourdomain.com/34047348bb29376864bbc64509bfce16.txt

2. Host the key file in Express, Next.js, or Caddy

You do not need a separate build step to serve a static key file if your web server or framework already handles routes cleanly. Serving the key from an environment variable keeps it reproducible across Docker builds and preview environments.

Express (Node.js) route for IndexNow key verification
// routes/indexnow.js
const INDEXNOW_KEY = process.env.INDEXNOW_KEY; // 32-char hex string

if (INDEXNOW_KEY && /^[a-zA-Z0-9-]{8,128}$/.test(INDEXNOW_KEY)) {
  app.get(`/${INDEXNOW_KEY}.txt`, (_req, res) => {
    res
      .type("text/plain; charset=utf-8")
      .set("Cache-Control", "public, max-age=3600")
      .send(INDEXNOW_KEY);
  });
}

Next.js App Router and Caddy key hosting

In Next.js, the simplest zero-runtime option is placing <key>.txt directly in public/<key>.txt. If you prefer keeping the key in an environment variable across environments, expose a Route Handler or rewrite. If Caddy terminates TLS in front of your app, Caddy can serve the key file directly at the edge without touching your backend process.

Next.js (public file or Route Handler) & Caddyfile edge response
// Next.js App Router: app/indexnow-key/route.ts (paired with rewrite in next.config.ts)
export async function GET() {
  const key = process.env.INDEXNOW_KEY || "";
  return new Response(key, {
    status: 200,
    headers: { "Content-Type": "text/plain; charset=utf-8", "Cache-Control": "public, max-age=3600" },
  });
}

# Caddyfile — serve the key directly at the edge with zero backend load
yourdomain.com {
  handle /34047348bb29376864bbc64509bfce16.txt {
    header Content-Type "text/plain; charset=utf-8"
    respond "34047348bb29376864bbc64509bfce16" 200
  }
  reverse_proxy 127.0.0.1:3000
}

3. Submit URLs in batches from Node.js or GitHub Actions

Submitting to the shared endpoint https://api.indexnow.org/indexnow automatically fans out your notification to every participating search engine (Bing, Yandex, Naver, Seznam, and Yep)—you do not need to call Bing and Yandex separately. Each POST request supports up to 10,000 same-host URLs.

One subtle deployment bug trips up many teams: firing IndexNow immediately after a container restart before the new key file is reachable. Always poll your keyLocation first, confirm HTTP 200 with the matching body, and only then POST your changed URLs.

Node.js 20+ batch submission helper (zero dependencies)
export async function submitToIndexNow({ host, key, urls }) {
  const keyLocation = `https://${host}/${key}.txt`;
  const keyRes = await fetch(keyLocation, { signal: AbortSignal.timeout(10_000) });
  if (!keyRes.ok || (await keyRes.text()).trim() !== key) {
    throw new Error(`Key file verification failed at ${keyLocation} (HTTP ${keyRes.status})`);
  }

  const res = await fetch("https://api.indexnow.org/indexnow", {
    method: "POST",
    signal: AbortSignal.timeout(20_000),
    headers: { "Content-Type": "application/json; charset=utf-8" },
    body: JSON.stringify({ host, key, keyLocation, urlList: urls.slice(0, 10_000) }),
  });

  if (![200, 202].includes(res.status)) {
    throw new Error(`IndexNow rejected batch: HTTP ${res.status} ${await res.text()}`);
  }
  return { status: res.status, submitted: Math.min(urls.length, 10_000) };
}

Automate post-deploy submissions in GitHub Actions

Add a non-blocking step at the end of your production deploy workflow so newly shipped documentation pages, blog posts, and updated landing pages notify Bing automatically right after the rollout completes.

.github/workflows/deploy.yml — post-deploy IndexNow step
- name: Notify IndexNow after production rollout
  if: success()
  continue-on-error: true
  env:
    INDEXNOW_KEY: ${{ secrets.INDEXNOW_KEY }}
    SITE_ORIGIN: https://yourdomain.com
  run: |
    node -e '
      const origin = process.env.SITE_ORIGIN;
      const key = process.env.INDEXNOW_KEY;
      const host = new URL(origin).host;
      const xml = await (await fetch(origin + "/sitemap.xml")).text();
      const urls = [...new Set([...xml.matchAll(/<loc>([^<]+)<\/loc>/g)].map(m => m[1].trim()))]
        .filter(u => new URL(u).origin === origin);
      const res = await fetch("https://api.indexnow.org/indexnow", {
        method: "POST",
        headers: { "Content-Type": "application/json; charset=utf-8" },
        body: JSON.stringify({ host, key, keyLocation: origin + "/" + key + ".txt", urlList: urls })
      });
      if (![200, 202].includes(res.status)) process.exit(1);
      console.log("IndexNow accepted", urls.length, "URLs with HTTP", res.status);
    '

4. IndexNow HTTP status codes and troubleshooting

Treat HTTP 200 and HTTP 202 as accepted notifications—not proof of indexing. Log the status code and timestamp so you can distinguish key-file failures from temporary throttling.

HTTP StatusMeaningWhat to do next
200 OKURLs accepted and key already verifiedRecord attempt as accepted. Do not resubmit unless page content materially changes.
202 AcceptedURLs received; key validation is pending asynchronouslyNormal on first submission or after key rotation. Verify your key file stays publicly reachable at 200 OK.
400 Bad RequestMalformed JSON, invalid URL format, or empty urlListValidate absolute https:// URLs and JSON encoding before retrying.
403 ForbiddenKey file missing, mismatched body, or blocked by WAF/CloudflareFetch keyLocation with curl using a non-browser user-agent and remove bot challenges on the .txt file.
422 Unprocessable EntityURLs in urlList do not belong to host or keyLocation scopeEnsure every URL shares the exact canonical hostname (apex vs. www) and falls under the key directory.
429 Too Many RequestsRate limit exceeded (potential spam threshold)Back off exponentially, batch URLs into one request instead of per-URL pings, and stop resubmitting unchanged URLs.

Common IndexNow pitfalls to avoid

Most IndexNow issues come from subtle operational mismatches rather than the protocol itself. Audit these five rules before automating submissions in production:

  • Do not submit redirecting, 404, or noindex URLs unless you are specifically notifying Bing that a previously indexed page was intentionally deleted (410/404).
  • Do not ping IndexNow on every page view or background cron job when nothing changed; excessive unchanged submissions waste crawl trust and trigger 429 limits.
  • Exclude legal boilerplate, auth endpoints, and parameter-heavy filter URLs from your submission batches.
  • Make sure CDN caching or edge bot-protection rules do not serve a JavaScript challenge page on /<key>.txt.
  • If you manage multiple sites or AI-built projects, use an operational queue like IndexMyWebsite (via Dashboard, MCP server, CLI, or REST API) to handle key verification, deduplication, retries, and attempt history across every domain.
Common questions

Frequently asked questions

Which search engines receive IndexNow submissions?

Submitting to api.indexnow.org shares the notification across participating engines including Microsoft Bing, Yandex, Naver, Seznam.cz, and Yep. Google does not currently participate in IndexNow.

Can I submit deleted pages (404 or 410) through IndexNow?

Yes. IndexNow explicitly supports notifying search engines about removed URLs so Bingbot re-crawls the URL, observes the 404 or 410 status, and removes it from search results faster.

How many URLs can I include in a single IndexNow POST request?

Up to 10,000 URLs per POST request, provided every URL belongs to the same canonical host authorized by your keyLocation file.

Why does IndexNow return 202 Accepted instead of 200 OK?

HTTP 202 means IndexNow received your batch and queued key verification. It is normal on a new site or immediately after deploying a new key file. Confirm your key file serves plain text with HTTP 200.

Should I still maintain an XML sitemap if I use IndexNow?

Yes. IndexNow covers real-time change notifications, while XML sitemaps provide the full canonical URL inventory and last-modified history for both Bing and Google.