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
1

Create a Google Cloud Project

If you already have a GCP project, skip to Step 2.

  1. Go to console.cloud.google.com/projectcreate
  2. Name it something like my-seo-tools
  3. Click Create
2

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.com

Web Search Indexing API (submit URLs for indexing)

console.cloud.google.com/apis/library/indexing.googleapis.com

Click "Enable" on each. Make sure your project is selected in the dropdown at the top.

3

Create a Service Account

  1. Go to IAM & Admin → Service Accounts
  2. Click Create Service Account
  3. Name it something like claude-seo
  4. Skip the optional permissions steps, click Done
  5. Click into the new service account → Keys tab → Add Key → Create new key → JSON
  6. Save the JSON file somewhere safe on your machine

Recommended location:

~/.config/gsc/service-account.json

Important: Never commit this JSON file to git. Add it to your .gitignore.

4

Add Service Account to Search Console

  1. Open Google Search Console
  2. Go to Settings Users and permissions
  3. Click Add User
  4. Paste your service account email (find it in the JSON file under client_email)
  5. Set permission to Owner
  6. Click Add
5

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',
  ],
});
```
6

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?"

WANT MORE LIKE THIS?

Learn to build with Claude Code

6 hours of hands-on training. Build real projects. Ship without waiting on engineering.

View Class Details