A Python script that reads all URLs from your XML sitemap and submits them in bulk to IndexNow, allowing search engines (Bing, Yandex, and others) to immediately discover and re-crawl your updated pages.
How it works
- Fetches your sitemap from https://{HOST}/sitemap.xml
- Parses every URL, including recursing into sitemap index files
- Submits the full URL list to the IndexNow API in a single POST request
- Prints the HTTP response status with a human readable message
Requirements
- Python 3.6+
- No third-party dependencies — uses only the Python standard library
Usage
python3 submit_indexnow.py
Example output
Fetching sitemap: https://example.com/sitemap.xml
Found 142 URLs. Submitting to IndexNow...
IndexNow response: HTTP 200 - URL submitted successfully
Response codes
| Code | Meaning |
|---|---|
| 200 | URLs submitted successfully |
| 202 | Received — key validation pending |
| 400 | Invalid request format |
| 403 | Key not valid or key file not found |
| 422 | URLs don't belong to the host, or key schema mismatch |
| 429 | Too many requests |
The script exits with a non-zero status code on any error response, making it safe to use in CI/CD pipelines or cron jobs.
Clone or download this repository.