indexnow key verify¶
Verify that the hosted IndexNow key file matches the expected key. Useful before the first submission, or as a smoke test in a deploy pipeline after rotating the key file.
The top-level
indexnow verifyform is kept as a backwards-compatibility alias for scripts written against v0.3.0–v0.6.x. Behavior is identical toindexnow key verify. New code should prefer the canonical form.
Synopsis¶
The command performs a single HTTP GET against the hosted key URL and compares the trimmed response body to --key. No retries — this is a one-shot diagnostic.
URL resolution¶
- If
--key-locationis provided, that absolute URL is fetched. - Otherwise, the conventional location
https://<host>/<key>.txtis derived from--hostand--key. Both are required in that case, and--keymust satisfy IndexNow's key format ([A-Za-z0-9-]{8,128}).
Flags¶
| Flag | Purpose |
|---|---|
--key |
IndexNow key (env: INDEXNOW_KEY) |
--host |
Site host, e.g. example.com (env: INDEXNOW_HOST) |
--key-location |
Absolute URL to the hosted key file (env: INDEXNOW_KEY_LOCATION) |
--config PATH |
Yaml config with host/key/key_location/user_agent defaults |
--user-agent STRING |
HTTP User-Agent header (env: INDEXNOW_USER_AGENT; default: indexnow/<version>) |
--timeout DURATION |
HTTP timeout for the key fetch (default 10s) |
--output text\|json |
Output format |
-q, --quiet |
Suppress stdout; rely on exit code |
-v, --verbose |
Log lifecycle events to stderr (slog text format) |
Examples¶
# Implicit URL: https://example.com/<KEY>.txt
indexnow verify --host example.com --key abcdef1234567890
# Custom hosting path
indexnow verify --key abcdef1234567890 \
--key-location https://static.example.com/indexnow/key.txt
# Scripted: silent on success, exit code is the truth
indexnow verify -q --host example.com --key abcdef1234567890 \
&& echo "key live" || echo "fix the key file"
Output¶
Text mode prints a single line:
OK: https://example.com/abcdef1234567890.txt
FAIL: https://example.com/abcdef1234567890.txt status=404 err=http 404
FAIL: https://example.com/abcdef1234567890.txt status=200 err=hosted key does not match expected
JSON mode emits a single object: { "url", "ok", "status", "hosted", "error" }. The hosted field is populated on mismatch (truncated to 80 chars) so you can eyeball what's actually being served.
Exit codes¶
0— hosted key matches1— mismatch, non-200, or network error2— usage error (missing key, malformed--key-location, etc.)