Extract Query by Page Using the Searchconsole API wrapper (Python) - JC Chouinard
- November 18, 2021
- General

AI Summary
The searchconsole Python wrapper by Josh Carty lets you pull Google Search Console performance data, including query by page breakdowns, with a few readable lines instead of raw API calls. You authenticate once, select a verified property, build a query with a date range and the page and query dimensions, then export the results to a pandas DataFrame for analysis.
- The searchconsole library wraps the Search Analytics API with a fluent query builder.
- Combine the page and query dimensions to see which queries drive each URL.
- The API returns up to 25,000 rows per request; paginate with startRow for more.
- Data covers about 16 months and can lag two to three days; plan reporting around that.

Why query by page is worth automating
The Search Console interface is fine for spot checks, but when you need the queries driving every important URL across hundreds of pages, the UI is slow and export limited. The Search Analytics API returns the same data programmatically, and the searchconsole Python wrapper makes it approachable. Pulling query by page lets you find pages ranking for queries their content never mentions, spot cannibalization where two URLs compete for one query, and build content briefs from real demand rather than guesses.
Authenticating and selecting a property
The wrapper handles OAuth using a client configuration you download from a Google Cloud project with the Search Console API enabled, plus a saved credentials file so you do not re authenticate every run. Once authenticated you select one of your verified properties, for example your domain property, and you are ready to query. Keep the client and credential files out of version control, since they grant access to your Search Console data.
Building the query by page report
The core pattern is a fluent chain: start from the property, set a date range, add the dimensions you want, then call get. To break queries down by page, request both the page and query dimensions together. Convert the result to a pandas DataFrame and you can filter, group and export it like any other dataset.
import searchconsole
account = searchconsole.authenticate(
client_config='client_secrets.json',
credentials='credentials.json')
webproperty = account['https://example.com/']
report = (webproperty.query
.range('2026-01-01', '2026-03-31')
.dimension('page', 'query')
.get())
df = report.to_dataframe()
top = df.sort_values('clicks', ascending=False)
print(top.head(20))From that DataFrame you can group by page to count how many distinct queries each URL earns, or group by query to detect two URLs splitting the same demand. For programmatic indexing checks alongside this, pair it with the GSC URL Inspection API.
Limits and gotchas that bite people
Three constraints matter. First, row limits: a single request returns at most 25,000 rows, so for large sites you paginate using the startRow parameter and stitch the pages together. Second, data window: Search Console retains roughly 16 months of data and the most recent two to three days are usually incomplete, so avoid reporting on yesterday. Third, sampling and anonymized queries: rare queries are omitted for privacy, so summed clicks by query will not perfectly equal the property total. Also mind the daily quota on API requests and add simple retry handling for transient errors.
For a fuller pipeline and storage patterns, see our guide to Search Console API data extraction and the Google Search Console glossary entry for definitions.
| Concern | Detail | Handling |
|---|---|---|
| Rows per request | Maximum 25,000 rows | Paginate with the startRow parameter and concatenate |
| Data window | About 16 months retained | Do not query beyond the window; expect older data to fall off |
| Freshness | Last two to three days incomplete | Report on data at least three days old |
| Anonymized queries | Rare queries omitted for privacy | Expect query sums below the property total |
| API quota | Daily request limits apply | Batch requests and add retry with backoff |
Frequently asked questions
What is the searchconsole Python library?
It is an open source wrapper by Josh Carty around the Google Search Console Search Analytics API. It provides a fluent query builder and a to_dataframe method so you can pull performance data in a few readable lines of Python.
How do I get query by page data from Search Console?
Request the page and query dimensions together in one query. With the searchconsole wrapper you chain a date range and both dimensions, call get, and convert the result to a DataFrame to see which queries each URL earns.
How many rows can the Search Console API return?
A single request returns at most 25,000 rows. For larger sites you paginate using the startRow parameter and combine the pages, since one call will not return every row.
How far back does Search Console data go?
Search Console retains about 16 months of performance data. The most recent two to three days are typically incomplete, so report on data that is at least three days old for stable numbers.
Why do my query clicks not add up to the total?
Google omits rare queries to protect user privacy, so the sum of clicks broken down by query is usually lower than the property total. This anonymization is expected and cannot be removed.
Source: https://www.jcchouinard.com/searchconsole-api-wrapper-python/
Claude Vincent is a technical SEO consultant focused on crawlability, rendering, and AI-search visibility. He writes the field guides and case studies at SEO ProCheck, with a bias toward the durable, unglamorous work that decides whether search engines and AI answer engines can actually read and cite a site.
About SEO ProCheck
Technical SEO consulting and GEO strategy with 20 years of enterprise experience. Case studies, resources, and tools for search and AI visibility.
Work With Me
Technical SEO audits, GEO strategy, site migrations, and international SEO. Hourly consulting for teams who need hands-on support, not just reports.
Subscribe to our newsletter!
Recent Posts
- Can AI Crawlers Actually Read Your Site? I Measured 400 of the Biggest September 5, 2026
- The Pre-Publish Quality Gate for AI-Assisted Content August 6, 2026
- AGENTS.md vs llms.txt vs llms-full.txt: Which Agent File Does What July 18, 2026







