Check whether Google has indexed a page, from your terminal
By Flavio
Check whether Google has indexed a URL with searchglass inspect. The command reads the stored copy and does not request indexing.
You want to check if a page is indexed by Google, from the terminal, instead of clicking through the Search Console website.
Searchglass does that with searchglass inspect. The command reads the copy Google has already indexed, including the crawl details and canonical URLs it has stored. It does not fetch the live page, request indexing, or submit a sitemap.
When you do want Google to crawl the URL, that step is the Request indexing button in the dashboard. Asking Google to index your page walks through it. Run the inspect first, so you know whether the page is already in the index. SEO for developers writing blogs is the other job, writing the page so the visit is worth having once Google has a copy.
What you need
Searchglass runs on macOS or Linux. You install Node.js 22 or later yourself. The CLI has no npm dependencies, and the installer does not use npm link.
You also need a Google account that can already open the Search Console property, and a Google Cloud project where you can create an OAuth client. The CLI talks to Google’s API directly. There is no hosted service to connect. Credentials stay on your machine, and the commands need internet.
After purchasing, connect your GitHub account in Polar and accept the invitation to the private repository. Download the ZIP and the checksum file from Releases. On macOS, verify the download with:
shasum -a 256 -c SHA256SUMS
On Linux, use sha256sum -c SHA256SUMS. Unzip the archive, open Terminal in that folder, and run:
./install.sh
The installer copies the command into ~/.local/share/searchglass/releases/ and links ~/.local/bin/searchglass. You can delete the downloaded folder after that. If the shell can’t find searchglass, add this line to your shell configuration and open a new terminal:
export PATH="$HOME/.local/bin:$PATH"
searchglass --version should print a version. For a later release, download the new ZIP and run its installer again. The saved Google login stays where it is.
Connect Google and list the property
The first query needs a one-time sign-in. In your Google Cloud project:
- Enable the Search Console API.
- Configure the OAuth consent screen. If the app is in Testing, add the Google account you will use as a test user.
- Create an OAuth client with application type Desktop app, and download its client JSON.
- Confirm that same Google account can open the Search Console properties you want to query.
Sign in with the file you downloaded. This path is the one from the docs. Yours is wherever the browser saved the JSON:
searchglass login --client ~/Downloads/google-desktop-client.json
Finish the consent in the browser on the same computer. The CLI requests read-only access and stores its own connection. It does not reuse a login from another app. Run searchglass guide for the full setup. If the Cloud console labels have moved, Google’s desktop OAuth guide is the reference for those screens.
OAuth apps left in Testing can get refresh tokens that expire after seven days. When that happens, run searchglass login again.
Check the connection, then list the properties this account can access:
searchglass auth status --check
searchglass sites
Copy the siteUrl exactly. A URL-prefix property includes the protocol and a trailing slash, such as https://flaviocopes.com/. A domain property starts with sc-domain: and then the bare domain. The commands below use https://flaviocopes.com/ because that is the sample in the docs. Replace it with a property your account owns.
Inspect one URL
Pick a page on that property. The docs use the JavaScript guide on this site:
searchglass inspect --site https://flaviocopes.com/ --url https://flaviocopes.com/javascript/
The command prints JSON. You are reading the index status Google has stored for that URL, plus any crawl details and canonical URLs included in the report. That is the indexed copy. A page you just deployed is included only after Google has stored it.
Use the URL you care about in --url, and keep --site as the property you copied. A domain property and a URL-prefix property are not interchangeable strings. If you are unsure which one you copied, run searchglass sites again and paste that value.
searchglass inspect will not ask Google to index the page, and it will not run a live crawl. The CLI has no write commands for sitemap submission or for changing a property. searchglass sitemaps --site https://flaviocopes.com/ only lists sitemaps already submitted, with their warning and error counts. It does not upload one.
Read the fields that explain the result
Save a response so you can compare it with a later inspection:
searchglass inspect \
--site https://flaviocopes.com/ \
--url https://flaviocopes.com/javascript/ > inspection.json
Replace both URLs with your own. The CLI returns Google’s response directly. With jq installed, pull out the index section:
jq '.inspectionResult.indexStatusResult | {
verdict,
coverageState,
indexingState,
robotsTxtState,
pageFetchState,
lastCrawlTime,
userCanonical,
googleCanonical
}' inspection.json
Here is a shortened, fictional result for a different page:
{
"verdict": "PASS",
"coverageState": "Submitted and indexed",
"indexingState": "INDEXING_ALLOWED",
"robotsTxtState": "ALLOWED",
"pageFetchState": "SUCCESSFUL",
"lastCrawlTime": "2026-11-02T09:15:00Z",
"userCanonical": "https://garden.northstar.example/guide/",
"googleCanonical": "https://garden.northstar.example/guide/"
}
The overall verdict and the details answer different questions. Google documents these in its inspection response schema.
| Field | What to read it for |
|---|---|
verdict and coverageState | Google’s overall result and its explanation |
indexingState | Whether a noindex rule prevented indexing |
robotsTxtState | Whether robots.txt permitted crawling |
pageFetchState | Whether Google could fetch the page |
lastCrawlTime | How old the recorded crawl is |
userCanonical and googleCanonical | Your preferred URL and Google’s selected URL |
Missing fields appear as null in this jq output. That means the response omitted them; do not read it as a successful check.
Suppose you removed a noindex tag this morning but lastCrawlTime is from two days ago. Inspect the deployed page and its headers first. The API result may still describe the old page. Google’s inspection API reads stored information and cannot test the live URL.
If the canonical URLs differ, inspect the Google-selected URL too. Check your redirects, canonical tag and internal links before requesting another crawl. Repeated indexing requests will not repair a conflicting canonical tag. Likewise, an allowed crawl and a successful fetch do not guarantee that Google will index a page.
Ask for a crawl in Search Console
If that status says the URL is not in the index, the terminal command has finished its job. The next step is the dashboard.
Open Search Console, use URL inspection, enter the same URL, and click Request indexing. Asking Google to index your page is that flow. The button puts the URL in a crawl queue, and Google still decides whether to keep the page.
Running searchglass inspect again reads the record Google has without submitting another crawl request. Check later to see whether the indexed copy changed.
An indexed page can still get few visits. SEO for developers writing blogs is about the page itself, and about waiting for search to pick it up.
If something looks wrong
If you get a permission error, the Google account can’t access that property, or the Search Console API is disabled on the Cloud project. Fix that, then run searchglass login again if the consent was revoked or the Testing refresh token expired.
If searchglass sites lists properties and inspect still fails, compare --site with the copied siteUrl character by character. A missing trailing slash on a URL-prefix property is a different property string. Inspect a URL that belongs to the property you passed.
If the shell says searchglass: command not found, ~/.local/bin is not on PATH. Add the export line from the install section and open a new terminal. searchglass --version is the check.
If you need to disconnect, searchglass logout removes the local refresh token. Revoking the app inside your Google account is a separate step. Credentials live in ~/.config/searchglass/credentials.json. Keep that folder out of Git and out of screenshots.
If you wanted this command to submit the site’s sitemap, or to press Request indexing for you, it doesn’t. Those writes are outside this CLI. List sitemaps with searchglass sitemaps, read one URL with searchglass inspect, and request the crawl in Search Console.
Get Searchglass
Query Google Search Console performance, sitemaps and URL index status from your terminal or coding agent. Includes an installer, agent skill and full MIT source.
See Searchglass → · Read the docs · $20 including tax, with full source code.
Want me to talk about your product? You can sponsor this site.