GUIDE
Give Claude Code Access to Google Search Console
Set up programmatic access so Claude Code can submit pages for indexing, check search performance, and manage your sitemaps.
Time: ~10 minutes
Why do this?
Once connected, Claude Code can:
- →Submit new URLs for indexing the moment you deploy a page
- →Submit sitemaps after programmatic SEO runs
- →Query search performance data (clicks, impressions, position) to inform content strategy
- →Inspect URLs to check indexing status and troubleshoot issues
Prerequisites
- •A verified property in Google Search Console
- •A Google Cloud project (free tier works fine)
- •Claude Code installed
Create a Google Cloud Project
If you already have a GCP project, skip to Step 2.
- Go to console.cloud.google.com/projectcreate
- Name it something like
my-seo-tools - Click Create
Enable the APIs
You need two APIs enabled on your project:
Search Console API (read data, submit sitemaps)
console.cloud.google.com/apis/library/searchconsole.googleapis.comWeb Search Indexing API (submit URLs for indexing)
console.cloud.google.com/apis/library/indexing.googleapis.comClick "Enable" on each. Make sure your project is selected in the dropdown at the top.
Create a Service Account
- Go to IAM & Admin → Service Accounts
- Click Create Service Account
- Name it something like
claude-seo - Skip the optional permissions steps, click Done
- Click into the new service account → Keys tab → Add Key → Create new key → JSON
- Save the JSON file somewhere safe on your machine
Recommended location:
~/.config/gsc/service-account.jsonImportant: Never commit this JSON file to git. Add it to your .gitignore.
Add Service Account to Search Console
- Open Google Search Console
- Go to Settings → Users and permissions
- Click Add User
- Paste your service account email (find it in the JSON file under
client_email) - Set permission to Owner
- Click Add
Tell Claude Code About It
Add this to your project's CLAUDE.md so Claude knows how to authenticate:
## Google Search Console Access
- **Service Account Key:** ~/.config/gsc/service-account.json
- **APIs enabled:** Search Console API, Web Search Indexing API
- **Property:** https://yourdomain.com
### Usage
Use the googleapis npm package to authenticate:
```typescript
import { google } from 'googleapis';
import * as fs from 'fs';
const credentials = JSON.parse(
fs.readFileSync(
process.env.HOME + '/.config/gsc/service-account.json',
'utf8'
)
);
const auth = new google.auth.JWT({
email: credentials.client_email,
key: credentials.private_key,
scopes: [
'https://www.googleapis.com/auth/webmasters',
'https://www.googleapis.com/auth/indexing',
],
});
```Test It
Ask Claude Code to run a quick test:
"Query my Google Search Console for the top 10 pages by clicks in the last 28 days"If the service account is set up correctly, Claude will authenticate using the JSON key, call the Search Console API, and return your data.
What you can do now
Submit URLs for indexing
"Submit these 50 new blog pages to Google for indexing"
Submit sitemaps
"Generate a sitemap and submit it to Search Console"
Analyze performance
"Which pages lost the most traffic in the last 7 days?"
Check index coverage
"How many of my pages are indexed vs excluded?"