How to Use the Search Console API for SEO Reporting

Contents+
- 01What can the Search Console API do?
- 02Should you use the API, Data Studio, bulk export or an MCP?
- 03Step 1. Enable the Search Console API
- 04Step 2. Choose OAuth or a service account
- 05Step 3. Add the service account to Search Console
- 06How does searchAnalytics.query work?
- 07What are the Search Console API data limits?
- 08What are the Search Console API quotas?
- 09A minimal Search Console API example in Python
- 10How to use the URL Inspection API
- 11How to use the sitemaps endpoint
- 12Troubleshooting Search Console API errors
- 13When the Search Console MCP or Data Studio is simpler
The Search Console API gives code access to your Google Search Console data. It returns Performance report rows, URL Inspection results and sitemap status for any property your account can open. Google describes the API as free. Usage quotas apply.
This guide sets it up for SEO reporting as of December 2026. It covers enabling the API, choosing between OAuth and a service account, the query parameters and data limits that shape every report, and a working Python script. It ends with the cases where the Search Console MCP or a Data Studio dashboard does the job with less effort.
What can the Search Console API do?
Four API resources matter for SEO reporting. The method list below comes from Google's API discovery document. The permission column comes from Search Console's users and permissions help page.
| Resource | Methods | What you get | Permission to grant |
|---|---|---|---|
searchanalytics | query | Clicks, impressions, CTR and position by query, page, country, device, date and more | Restricted user (read access) |
urlInspection.index | inspect | Index status, canonical choice, last crawl and robots.txt state for one URL | Restricted users get fetch-only access in Google's table. We grant Full. |
sitemaps | list, get, submit, delete | Submitted sitemaps with errors, warnings and URL counts | Restricted user to read. Full user to submit. |
sites | list, get, add, delete | The properties the account can reach and its permission level on each | Any user to list |
Two OAuth scopes control access. webmasters.readonly covers every read method. webmasters adds write actions such as sitemap submission. Ask for read-only unless the script submits sitemaps.
Should you use the API, Data Studio, bulk export or an MCP?
Google offers four routes to the same performance data. Each one fits a different job.
| Route | Best for | Limit to know |
|---|---|---|
| Search Console interface | Ad hoc checks and one-off exports | Exports stop at 1,000 rows |
| Data Studio connector | A shared dashboard with no code | Same 50,000-row daily ceiling as the API |
| Search Console API | Scheduled pulls into a sheet, a database or your own tool | 50,000 rows per day per search type, plus quotas |
| Bulk data export to BigQuery | Large sites that need every stored row | Needs a billed Google Cloud project |
| Search Console MCP | Asking questions of the data in a chat | Inherits the API limits |
Google's performance data deep dive confirms the 1,000-row interface cap. It also says the API and the Looker Studio connector share the 50,000-row daily ceiling. Google renamed Looker Studio to Data Studio in April 2026. The bulk export help page says it includes all performance data available to Search Console except anonymized queries. BigQuery storage and query costs apply above the free usage level.
Pick the API when you need data on a schedule in a place you control. Our guide to an SEO dashboard worth opening covers the Data Studio route.
Step 1. Enable the Search Console API
- Open the Google Cloud console and create a project, or pick an existing one.
- Go to APIs & Services, then Library, and search for Google Search Console API.
- Click Enable.
Quotas attach to this project. Google calls it the Developer Console key in the quota tables.
Step 2. Choose OAuth or a service account
Google's authorization guide says requests for private user data must carry an OAuth 2.0 token. Search Console property data falls in that group. No other authorization protocol is supported. Two credential types produce that token.
| OAuth client (user sign-in) | Service account | |
|---|---|---|
| Who the requests run as | You, after a browser consent screen | A robot account with its own email address |
| Property access | Every property your Google account can open | Only properties where you add its email as a user |
| Fits | A script you run by hand on your laptop | Scheduled jobs on a server or in the cloud |
| Credential to protect | Client secret file and the cached refresh token | The JSON private key |
For scheduled reporting we'd use a service account. It keeps the job running when the person who set it up leaves.
Create one in the Cloud console under IAM & Admin, then Service Accounts. Add a key of type JSON and download it. Store the file outside your code repository. Anyone holding the key can read every property the account can reach.
Step 3. Add the service account to Search Console
A new service account can't see any property yet. Open the JSON key and copy the client_email value. It ends in iam.gserviceaccount.com.
- Open the property in Search Console.
- Go to Settings, then Users and permissions. Only property owners see this page.
- Click Add user, paste the email and choose a permission level.
Choose Restricted for a reporting job that only reads performance data. Google's prerequisites page says searchAnalytics.query needs read permission. Choose Full if the script submits sitemaps. For URL Inspection, the help page's permission table gives Restricted users fetch-only access. The API reference doesn't state which level index.inspect needs. Try Restricted first and switch to Full if inspection calls are refused. The help page also notes that an email group can't be added as a user.
How does searchAnalytics.query work?
Every performance request is a POST to searchAnalytics.query with a date range and optional grouping. The parameters below come from the method reference.
| Parameter | Values | Notes |
|---|---|---|
startDate, endDate | YYYY-MM-DD | Required. Dates are in Pacific Time and both ends are included. |
dimensions | query, page, country, device, searchAppearance, brandedClassification, date, hour | Rows group in the order you list them. searchAppearance can't share a request with other dimensions. |
type | web (default), image, video, news, googleNews, discover, webMultimodal | One search type per request |
dimensionFilterGroups | Operators equals, notEquals, contains, notContains, includingRegex, excludingRegex | Regex uses RE2 syntax. Filters can target a dimension you don't group by. |
aggregationType | auto (default), byPage, byProperty, byNewsShowcasePanel | Grouping or filtering by page rules out byProperty |
dataState | final (default), all, hourly_all | all adds fresh data that may still change |
rowLimit, startRow | 1 to 25,000 (default 1,000), zero-based offset | Page by raising startRow until a response returns no rows |
Results come back sorted by clicks, highest first. Group by date and they sort by date instead. Each row carries keys, clicks, impressions, ctr and position. CTR is a fraction between 0 and 1.
The dataState default catches people out. Leave it off and you get finalized data only. The most recent days can come back empty. Set all to include fresh data. When you request all grouped by date, the response metadata names the first incomplete date.
What are the Search Console API data limits?
The API returns top rows. Google's reference says it doesn't guarantee to return every row. Four limits shape what you see.
- 50,000 rows per day per search type. Google's data limits page sets this ceiling, sorted by clicks. A site with a long tail hits it fast once you group by page and query.
- Anonymized queries. Queries that aren't issued by more than a few dozen users over two to three months never appear as rows. Their clicks still count in totals that don't group by query. Sum your query rows and you'll land below the site total.
- Dropped detail. Grouping by page or query can drop some data. For accurate totals, Google says to omit the page and query dimensions.
- 16 months of history. Google's Analytics help states that Search Console keeps data for the last 16 months. Store what you pull if you want year-over-year trends that last.
Google recommends one query per day for one day of data. That stays inside the daily quota and gets the most rows out of the 50,000 ceiling. Data typically lands two to three days after the date it describes.
What are the Search Console API quotas?
Quota figures come from Google's usage limits page, last updated August 28, 2025 and still current as of December 2026.
| Resource | Per site | Per user | Per project |
|---|---|---|---|
| Search Analytics | 1,200 queries per minute | 1,200 queries per minute | 40,000 per minute and 30,000,000 per day |
| URL Inspection | 600 per minute and 2,000 per day | No separate limit listed | 15,000 per minute and 10,000,000 per day |
| Sitemaps and sites | No separate limit listed | 20 per second and 200 per minute | 100,000,000 per day |
Load is metered separately for Search Analytics. It's measured in 10-minute and one-day windows. Queries that group or filter by both page and query cost the most. Long date ranges cost more than short ones. If you hit a short-term limit, Google says to wait 15 minutes and spread queries across the day. Every quota error returns the same "quota exceeded" message.
A minimal Search Console API example in Python
This script authenticates with a service account and pulls one day of page and query rows. It pages through results 25,000 rows at a time. It uses Google's API client library for Python and the google-auth package.
pip install google-api-python-client google-auth
from google.oauth2 import service_account
from googleapiclient.discovery import build
KEY_FILE = "/secure/path/service-account.json"
SITE = "sc-domain:example.com" # or "https://www.example.com/" with the trailing slash
SCOPES = ["https://www.googleapis.com/auth/webmasters.readonly"]
creds = service_account.Credentials.from_service_account_file(KEY_FILE, scopes=SCOPES)
service = build("searchconsole", "v1", credentials=creds)
def query_day(day, dimensions):
rows, start_row = [], 0
while True:
body = {
"startDate": day,
"endDate": day,
"dimensions": dimensions,
"type": "web",
"rowLimit": 25000,
"startRow": start_row,
}
resp = service.searchanalytics().query(siteUrl=SITE, body=body).execute()
batch = resp.get("rows", [])
if not batch:
return rows
rows.extend(batch)
start_row += len(batch)
rows = query_day("2026-11-30", ["page", "query"])
print(len(rows), "rows")
for r in rows[:10]:
page, query = r["keys"]
print(page, query, r["clicks"], r["impressions"], round(r["ctr"], 3), round(r["position"], 1))
The siteUrl must match the property string in Search Console. A Domain property uses sc-domain:example.com. A URL-prefix property uses the full URL with its trailing slash. Run service.sites().list().execute() first if you're unsure. It returns every property the account can see along with its permission level.
Write the rows to a table keyed by date and you have a history that outlives the 16-month window. Add a second daily query without page and query dimensions. That one gives the accurate totals to report against.
How to use the URL Inspection API
The index.inspect method returns what Google has stored for one URL. Pass the URL and the property it sits under.
result = service.urlInspection().index().inspect(
body={"inspectionUrl": "https://example.com/blog/post", "siteUrl": SITE}
).execute()
status = result["inspectionResult"]["indexStatusResult"]
print(status.get("verdict"), status.get("coverageState"), status.get("googleCanonical"))
The index status block includes the verdict, coverage state, last crawl time, robots.txt state, the canonical you declared and the one Google chose. Google's reference says only the indexed version is available. The API can't run a live test.
Quota matters more here than anywhere else. At 2,000 inspections per site per day, a 50,000-URL site needs 25 days to check every URL once. Spend the quota on pages that matter, such as new posts, revenue pages and URLs that dropped out of the performance data. Coverage states map to the reasons in the Page indexing report.
How to use the sitemaps endpoint
The sitemaps resource lists submitted sitemaps and returns each one's last download time, error count, warning count and the number of URLs submitted per content type. The indexed count in that response is deprecated. Use URL Inspection or the Page indexing report for index status.
Submitting a sitemap needs the read-write webmasters scope and Full permission. A check that only reads sitemap errors works with the read-only scope.
Troubleshooting Search Console API errors
| Symptom | Likely cause | Fix |
|---|---|---|
| 403 saying the user lacks permission for the site | The service account isn't a user on the property, or siteUrl doesn't match the property string | Add the client_email in Users and permissions. Copy the exact string from sites.list. |
| 403 saying the API is disabled or not used in the project | The Search Console API isn't enabled in the Cloud project that owns the credentials | Enable it in APIs & Services, then retry after a few minutes |
| Search Console rejects the email in Add user | A typo, or a group address | Paste client_email straight from the JSON key |
| The last two or three days are missing | dataState defaults to final data | Set "dataState": "all" |
| Query rows sum to less than the site total | Anonymized queries and dropped detail | Report totals from a query without page and query dimensions |
| Rows stop at 50,000 for a day | The daily data ceiling | Move to bulk export, which exports every row except anonymized queries |
| "Quota exceeded" | Load or rate quota | Wait 15 minutes, query one day at a time and drop page-plus-query grouping where you can |
| 403 on sitemap submit | Read-only scope or Restricted permission | Use the webmasters scope and Full permission |
When the Search Console MCP or Data Studio is simpler
A script pays off when the same pull runs every day into storage you own. For exploratory questions, the Search Console MCP calls the same API from a chat window. Our six GSC MCP workflows show the prompts we use. For a dashboard that clients open, the Data Studio connector needs no code. Both inherit the row limits above.
The API is plumbing. What you report on top of it decides whether anyone reads the numbers. Our measurement team builds that layer for clients.
See where your brand stands in AI answers today, benchmarked against your competitors, no pitch required.
Related reading
All posts →
Google Indexing API Guide to Setup, Quotas and Allowed Pages
Google documents the Indexing API for job posting and livestream pages only. Here is how to set it up, what the quotas are and what to use for every other page.
Read post →
Google Search Console MCP: Setup, Limits, and What Breaks
Connecting Search Console to an AI assistant takes about ten minutes. Knowing which of its answers to trust takes longer. Here is both.
Read post →
How to Read the Search Console Generative AI Report
Search Console's generative AI report now shows clicks, impressions and CTR from AI Overviews and AI Mode. Here is what it counts, what it still hides, and how to analyze it with an AI assistant.
Read post →