IndexNow is a protocol that lets websites notify search engines about new, updated, or deleted URLs in real time. Instead of waiting for crawlers, you push URLs directly to api.indexnow.org, and participating search engines (Bing, Yandex, Seznam, Naver) pick them up.
Generate a random 32-character hex key:
bash
node -e "console.log(require('crypto').randomBytes(16).toString('hex'))"
Place a .txt file named <key>.txt containing only the key string into the site's public root:
public/<key>.txtpublic/<key>.txtdist/ or public/)public/<key>.txtpublic/<key>.txtAfter deploy, the file must be accessible at https://<domain>/<key>.txt with a 200 response containing only the key string.
Copy scripts/submit-indexnow.mjs from this skill into the project (e.g., scripts/submit-indexnow.mjs).
If the project already has package.json, add an npm script:
json
"indexnow": "node scripts/submit-indexnow.mjs"
Or add a site_url and key pair inline:
json
"indexnow": "node scripts/submit-indexnow.mjs https://example.com abcd1234..."
The script reads URLs from /sitemap.xml. Ensure the site generates a valid sitemap at that path. For Next.js App Router, this is typically app/sitemap.ts.
Run after every deploy or content update:
bash
npm run indexnow
The script:
sitemap.xml from the site<loc> URLshttps://api.indexnow.org/IndexNowFor non-Node projects, invoke the script directly:
bash
node scripts/submit-indexnow.mjs https://example.com <key>
Use Bing Webmaster Tools to confirm URLs are being received. Check the URL inspection tool for submission history.
The script accepts arguments or environment variables:
PrioritySource1stCLI args: node submit-indexnow.mjs <url> <key>2ndSITE_URL + INDEXNOW_KEY env vars
StatusMeaning200URLs submitted successfully400Invalid request format403Key not found or invalid422URLs don't belong to the host429Rate limited (spam protection)