Google Search Console API: how to automate SEO data (2026)

October 2026 · GSC & automation

Versão em português

SEO reporting automation with the Google Search Console API
Manual CSV exports do not scale when you manage ten or twenty GSC properties. The Search Console API lets you pull clicks, impressions, and queries in code — as long as you accept OAuth, quotas, and the limits of what the API does not expose (Page indexing card totals, bulk indexing).

The Google Search Console API automates extraction of Search Analytics (queries, pages, device, country) and limited inspection endpoints. Use it for recurring reports and alerts; it does not replace SEO strategy or force indexing across dozens of URLs.

When to automate (and when to stay in the UI)

  • Automate when you need the same data slice every week (top queries, pages with impressions and low CTR, 28 vs 28 day compare) across many clients.
  • Stay in the UI for one-off checks, Rich Results, a single URL Inspection, or while you are still shaping the template from our Google Search Console reporting for agencies guide.
  • Hybrid: API feeds your datastore; analysts interpret — the same pattern as multi-client GSC reporting in the product.

GSC UI vs Search Console API

CapabilityGSC UISearch Console API
Search Analytics (queries / pages)Manual filters, CSV exportProgrammatic query, dimensions, aggregation
Period comparisonYes (Performance)Two calls or an ETL pipeline
«Page indexing» card totalsAggregates in the UINot replicated 1:1; use samples / URL Inspection
URL InspectionManual per URLAPI with a low daily quota
Bulk «Request indexing»Does not existNo — at most a point request after inspection
Multi-property (agency)Switch account / propertyOAuth per owner + sites.list

If the main issue is «Crawled – currently not indexed», the API helps cross-check URLs with zero impressions — but the fix stays editorial. See Crawled – currently not indexed.

Google Cloud prerequisites

  1. A Google Cloud project (billing enabled if you use other APIs; the Search Console API itself has no per-call fee).
  2. Enable the Google Search Console API (searchconsole.googleapis.com).
  3. OAuth 2.0 credentials as a Desktop app → download JSON (below: credentials.json).
  4. A Google user with owner or full-user access to the target GSC property.

Recommended Python dependencies:

pip install google-auth-oauthlib google-auth-httplib2 google-api-python-client

Optional with the gcloud CLI:

gcloud services enable searchconsole.googleapis.com

Python script: OAuth + Search Analytics

The sample uses a readonly scope, secrets file credentials.json, and stores token.json for refresh. Set PROPERTY to a URL prefix (https://www.example.com/) or domain (sc-domain:example.com).

from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from googleapiclient.discovery import build
import os.path

SCOPES = ['https://www.googleapis.com/auth/webmasters.readonly']
PROPERTY = 'https://www.example.com/'

def gsc_credentials():
    creds = None
    if os.path.exists('token.json'):
        creds = Credentials.from_authorized_user_file('token.json', SCOPES)
    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
            creds = flow.run_local_server(port=0)
        with open('token.json', 'w', encoding='utf-8') as token:
            token.write(creds.to_json())
    return creds

def list_properties():
    service = build('searchconsole', 'v1', credentials=gsc_credentials())
    response = service.sites().list().execute()
    for entry in response.get('siteEntry', []):
        print(entry['siteUrl'], entry.get('permissionLevel'))

def query_page_report():
    service = build('searchconsole', 'v1', credentials=gsc_credentials())
    body = {
        'startDate': '2026-09-01',
        'endDate': '2026-09-30',
        'dimensions': ['query', 'page'],
        'rowLimit': 1000,
    }
    response = service.searchanalytics().query(siteUrl=PROPERTY, body=body).execute()
    for row in response.get('rows', []):
        query, page = row['keys']
        print(
            query,
            page,
            row.get('clicks', 0),
            row.get('impressions', 0),
            round(row.get('ctr', 0) * 100, 2),
            round(row.get('position', 0), 1),
        )

if __name__ == '__main__':
    list_properties()
    query_page_report()

On first run a browser opens for OAuth consent. Keep token.json out of git — treat it like a password.

From raw JSON to SEO actions

Typical agency pipeline after the query:

  • Filter rows with impressions ≥ N and CTR below position benchmark → title/meta rewrite queue (see CTR in GSC: improve titles).
  • Aggregate by page to spot cannibalisation or orphan URLs.
  • Compare this week vs last in your warehouse — the API does not send email; that is your cron or SaaS layer.

Quotas, 403 errors, and URL Inspection

Search Analytics has per-request row limits and daily quotas per project. 403 quotaExceeded means backoff and cache — not scripts every minute. The URL Inspection API suits automated sampling (index status for priority URLs), not inspecting hundreds of legacy URLs in one day.

Indexing requests: after inspection the API may allow a one-off submission — there is no substitute for quality, sitemap, and internal links. Do not confuse data automation with «forcing» the index.

Multi-client: why local scripts break early

Each client needs OAuth consent, secure refresh token rotation, and data isolation per organisation — why tools like DENVORA SEO centralise GSC sync instead of sharing one token.json on Slack. For monthly delivery, pair API extraction with the GSC reporting for agencies workflow and Google Search Console reporting in the product.

Frequently asked questions

Is the Google Search Console API free?
Yes. There is no per-call fee for the Search Console API. Limits are daily quotas per Google Cloud project and per property (Search Analytics, URL Inspection, etc.). For agencies with dozens of domains, the real cost is engineering, storage, and secure OAuth token management — not Google licensing.
Can I request indexing for many URLs via the API?
Not in the way the UI implies. The URL Inspection API lets you inspect individual URLs (with a low quota) and, in limited cases, submit an indexing request per URL — there is no endpoint to «index everything» or bypass content quality and internal linking. For «Crawled – currently not indexed» states, fix the page before burning quota on inspections.
What is the difference between webmasters.readonly and full access?
The scope https://www.googleapis.com/auth/webmasters.readonly lets you read Search Analytics, list sites, and query coverage data exposed by the API — enough for automated reporting. Write scopes are rare in the Search Console API; most agency flows should use readonly plus OAuth per user, or service accounts only when Google documentation allows it for the property.
Service account or installed OAuth for agencies?
For a personal account or a single site, installed-app OAuth with credentials.json and token.json works in local scripts. For multi-client work you need consent from each GSC owner and encrypted refresh token storage — the pattern SaaS tools like DENVORA SEO implement so you do not share passwords or rely on manual CSV exports.

Next step: product or subscription

Audit your site with AI, connect Google Search Console and get agency-ready reports — 14-day trial, no card.

About DENVORA SEO← Blog index