How to connect Google Search Console via API: a complete step-by-step guide to automating site indexing and diagnostics
Next step
Open the bot or continue inside this section.
Article -> plan in AI
Paste this article URL into any AI and get an implementation plan for your project.
Read this article: https://vibecode.morecil.ru/en/seo/kak-podykychit-google-search-console-api/
Work in my current project context.
Create an implementation plan for this stack:
1) what to change
2) which files to edit
3) risks and typical mistakes
4) how to verify everything works
If there are options, provide "quick" and "production-ready". How to use
- Copy this prompt and send it to your AI chat.
- Attach your project or open the repository folder in the AI tool.
- Ask for file-level changes, risks, and a quick verification checklist.
Manual page checks in search.google.com no longer work for large sites. If new articles are not getting into Google’s index and the Coverage report shows “Discovered, currently not indexed,” it’s time to set up the Search Console API.
This unlocks several capabilities:
- Automatically submit sitemaps.
- Check the status of any page (indexing, canonical, crawl errors).
- Pull impressions, clicks, and query data.
- Delegate diagnostics to AI assistants (Grok, Claude, GPT, etc.).
Important warning upfront
The Search Console API does not force-index regular pages (articles, products, blog posts).
Google’s Indexing API works only for pages with JobPosting or BroadcastEvent markup. For all other sites, the API provides diagnostics, sitemap submission, and analytics only.
1. Add your site to Search Console
- Go to https://search.google.com/search-console.
- Click “Add property”.
- Choose:
- URL prefix:
https://example.com/(recommended, more precise). - Or Domain:
sc-domain:example.com.
- URL prefix:
- Verify ownership (HTML tag, DNS, Google Analytics 4, etc.).
2. Connect the API with a Service Account
Step 1. Create a project in Google Cloud
- Go to Google Cloud Console.
- Click “Select project” → “New project”.
- Name it, for example,
gsc-api-project. Save the Project ID.
Step 2. Enable the Search Console API
- In the menu: “APIs & Services” → “Library”.
- Find Google Search Console API.
- Click “Enable”.
Step 3. Create a Service Account and JSON key
- “APIs & Services” → “Credentials” → “Create credentials” → Service account.
- Name:
gsc-api-bot. - Roles can be skipped (or set Viewer).
- Click “Done”.
- Open the created account → “Keys” tab → “Add key” → Create new key → JSON.
- A file like
your-project-id-abcdef123456.jsonwill be downloaded.
Service account email (copy this):gsc-api-bot@your-project-id.iam.gserviceaccount.com
Step 4. Grant access in Search Console (most common mistake)
- In Search Console, make sure you selected the correct property in the top-left selector (
https://example.com/). - Settings (gear icon) → Users and permissions → Add user.
- Paste the service account email.
- Role: Owner (required).
- Wait 3-5 minutes.
- Repeat for
sc-domain:example.comif you use both property types.
3. Put the key on the server
- Store the JSON file outside the public directory (for example,
/etc/gsc/key.json). - Never commit it to Git.
Ready-to-copy prompts
Prompt #1. Check connection
“I have a file named gsc-key.json in the project root. This is a service key for the Google Search Console API. Check that the connection is fully working: list all available properties this key can access. If there are errors (403, NO_SITES_VISIBLE, insufficient permission, etc.), explain exactly what needs to be fixed in Search Console.”
Prompt #2. Submit sitemap
“Using the gsc-key.json key from the project, submit the current sitemap.xml (and sitemap_index.xml, if present) for property https://example.com/. After submission, show the result and status.”
Prompt #3. Inspect one page
“Inspect this page via the Search Console API using gsc-key.json:
https://example.com/new-article
Property: https://example.com/
Return a full report: indexing status, reason (if not indexed), canonical, last crawl date, issues, and recommendations.”
Prompt #4. Bulk page inspection
“Inspect these URLs via API for property https://example.com/ (gsc-key.json is in the project):
- https://example.com/article-1
- https://example.com/article-2
- https://example.com/article-3
For each page, output short status: Indexed / Not indexed + main reason.”
Prompt #5. Full diagnosis: why the site is not indexing
“Run a deep indexing diagnosis using gsc-key.json.
Property: https://example.com/
Check:
- status of all sitemaps
- recent Coverage errors
- 10-15 new or problematic pages
- common causes (noindex, thin content, canonical conflicts, crawl budget, etc.)
Return a structured report with priorities and exact fixes.”
Prompt #6. Universal prompt: “do everything at once”
“You are now my permanent Google Search Console API assistant.
The key is in gsc-key.json in the project root.
Main property: https://example.com/
Now do the following:
1. Check API availability
2. Submit the current sitemap
3. Inspect new pages
4. Return a full report: what blocks indexing, and what should be fixed in templates, robots.txt, or content.
Work step by step and show clear output.”
4. Notes for users in Russia
- Search Console API itself is not country-blocked.
- Issues may appear only during project creation (Google may ask for extra verification).
- Recommendations:
- Create project and key via VPN (Europe/US).
- Run scripts from a VPS outside Russia.
- After that, the service account works without manual sign-in.
A payment card is usually not required.
API limits (as of February 2026)
- URL Inspection: 2000 requests per day per property, 600 per minute
- Search Analytics: up to 50,000 rows per request
- Sitemap submit: no hard limits
How to use prompts most effectively
- Always specify the exact path to
gsc-key.jsonand the exact property. - Keep one long conversation with the AI so it remembers previous results.
- After each step, ask it to “save state” so the next run is faster.
Now you can fully automate site indexing and diagnostics without writing a single line of code.
Just drop in the key and run the prompts.