IndexNow for Express and Node sites, in about 40 lines.
Copilot answers come from Bing's index, so getting new pages into Bing quickly is now part of AI visibility. IndexNow is the fastest way to do it.
Bing matters more than its search share suggests. Microsoft Copilot grounds its answers in Bing's index, so getting new pages into Bing quickly is part of AI visibility, not just classic SEO. On an Express site, IndexNow takes very little code.
1. Pick a key and serve it
The key is a random string of 8 to 128 characters (letters, numbers and dashes). It is public by design: engines fetch it from your site to confirm you own the domain. Keep it in an environment variable and serve it at the root.
// server.js
const INDEXNOW_KEY = process.env.INDEXNOW_KEY;
app.get('/' + INDEXNOW_KEY + '.txt', (req, res) => {
res.type('text/plain').send(INDEXNOW_KEY);
});
2. Send the URLs
One POST to the shared endpoint reaches every participating engine. Build the URL list from the same function that builds your sitemap, so the two can never disagree.
// indexnow.js (Node 18+ has fetch built in)
const SITE_URL = 'https://www.example.com';
const ENDPOINT = 'https://api.indexnow.org/indexnow';
async function pingIndexNow(urlList) {
const res = await fetch(ENDPOINT, {
method: 'POST',
headers: { 'Content-Type': 'application/json; charset=utf-8' },
body: JSON.stringify({
host: new URL(SITE_URL).host,
key: process.env.INDEXNOW_KEY,
keyLocation: `${SITE_URL}/${process.env.INDEXNOW_KEY}.txt`,
urlList: urlList.slice(0, 10000)
})
});
// 200 = accepted, 202 = accepted while the key is being validated
return res.status;
}
Use your canonical host in every field. If your sitemap says www and your ping says the bare domain, you are submitting URLs that redirect.
3. Ping on deploy
Run a small script after every build, and never let a failed ping fail the deploy:
// package.json
"scripts": { "indexnow": "node scripts/indexnow.js" }
# build command on your host
npm install && (npm run indexnow || true)
Let the script accept paths too, so you can ping a few new pages by hand: npm run indexnow -- /blog/new-post.
What the responses mean
| Status | Meaning |
|---|---|
| 200 | URLs received |
| 202 | URLs received; the key is still being validated |
| 400 | Malformed request |
| 403 | Key not valid, or the key file couldn't be fetched |
| 422 | URLs don't belong to the host, or the key doesn't match the schema |
| 429 | Too many requests: you are pinging too often |
What IndexNow won't do
- Google doesn't participate. Submit your sitemap in Search Console and request indexing there for your most important new pages.
- It doesn't guarantee indexing. It tells engines a URL changed. Whether they index it still depends on the page.
- Don't spam it. Ping when content actually changes. Re-submitting unchanged URLs teaches engines to ignore you.
For a small site, pinging every URL on each deploy is fine. Larger sites should send only changed URLs, which is easy when sitemap entries carry an honest lastmod date. And make sure crawlers can actually read what you submit: check with the free AI crawler checker.
Questions people ask
Which search engines support IndexNow?
Bing and several others, including Yandex, Seznam and Naver. Google does not.
Is the IndexNow key a secret?
No. It is meant to be public; engines fetch the key file from your site to verify ownership.
How many URLs can I submit at once?
Up to 10,000 per request.
Want this mapped onto your product?
See how our SEO work runs, or send your store link and a founder will reply personally.