Automating Search Console reports with the API
Short answer: If you check Search Console by hand every week, copying numbers into reports, the Search Console API can do that for you. A small scheduled script can pull clicks, impressions, average position and click-through rate by page, query, country or device every day, store them in your own database, and send a short report or alert when something important changes. Request one day of data at a time, page through results, wait for data to finalise, and keep the history yourself.
Why automate Search Console
The Search Console web interface is excellent for quick checks, but it is awkward for routine reporting. You cannot easily combine its data with sales or enquiry figures, compare many pages at once over long periods, or set up your own alerts. Teams end up repeating the same manual exports.
The API's Search Analytics query method returns the same performance data as the web report, and its documentation describes grouping by dimensions such as country, device, page and query, filtering by search appearance and date range, and results sorted by click count in descending order.
What you need
- Access: a Google Cloud project with the Search Console API enabled, and either your own authorisation or a service account added as a user on the Search Console property.
- A place to store data: a database table is ideal, with one row per date, page, query and any other dimensions you choose.
- A scheduler: a cron job, a scheduled cloud function or a CI workflow on a timer.
- A small script in any language with a Google API client library; Google's documentation includes a Python sample.
The API itself is free to use within its quotas, so this does not require paying for a reporting tool.
Query sensibly: one day at a time
Google's guide to getting all your performance data recommends running a query each day for one day's worth of data, noting this should not exceed your daily quota. It also says data is typically available after two to three days, and suggests finding the most recent available date by running a simple query grouped by date for the past ten days.
So a typical daily job requests the data for three days ago, stores it and moves on. Running it daily for a single date keeps each request small and makes reruns easy if something fails.
Paging through results
The query method's reference sets rowLimit between 1 and 25,000 rows, with a default of 1,000, and says to page through larger result sets using the startRow offset. If startRow exceeds the number of results, you receive a successful response with zero rows, which is your signal to stop.
For a busy site, page-and-query combinations for one day can exceed 25,000 rows, so build the loop from the start.
Fresh versus final data
The reference describes a dataState parameter. If set to "all", results include fresh data; if set to "final" or left out, they include only finalised data. Fresh data is useful for spotting a sudden drop quickly, but numbers can still change, so store final data for your history and treat fresh figures as provisional.
Note too that dates in the API use Pacific Time, as the reference states, which matters if you line up daily figures with sales recorded in your own time zone.
Expect some missing detail
Google's guide notes that when you query by page or query string, some data may be dropped. Totals grouped only by date or property will be higher than the sum of individual query rows. Use property-level totals for headline figures and page or query rows for detail, and explain the difference in any report so nobody panics about mismatched numbers. A one-line note at the top of each report, saying which figures are totals and which are row-level, saves a lot of confused emails.
Reports and alerts worth building
Once data lands in your own table, simple queries give you useful views:
- Weekly summary: clicks and impressions versus the previous week and the same week last year, for the whole site and key sections.
- Pages losing clicks: pages whose clicks fell sharply compared with their recent average, so you can check for technical problems or competition.
- New queries: search terms appearing for the first time with meaningful impressions, which can suggest content ideas.
- Branded versus non-branded: separate queries containing your business name to see how discovery is doing.
- Join with business data: combine landing-page clicks with enquiries or orders from your own systems to see which pages bring customers, not just traffic.
Send the summary by email or chat on a schedule, and trigger alerts only for meaningful drops to avoid noise.
Keeping it secure and reliable
- Store credentials in your hosting platform's secret storage, never in code.
- Give the service account read-only access to the property.
- Monitor the job itself, so you notice if it stops running.
- Back up the data table, since it becomes your long-term record.
A worked example
Picture a hypothetical Dublin accountancy-software reseller whose marketing manager spent Monday mornings exporting Search Console data by hand. The developer built a daily job that requests one day of page-and-query data three days back, pages through results 25,000 rows at a time, stores final data in a database and sends a Monday summary with week-on-week changes and the ten pages that lost the most clicks.
The first summary flagged a support article whose clicks had halved; a check showed it had been accidentally noindexed during a redesign. It was fixed the same day, and the Monday exports stopped.
FAQ
Is there a cost to use the API?
The API is free within its usage quotas. Your own hosting and database costs still apply.
Can I pull data for several sites?
Yes. Loop over each property the account has access to.
Does the API include Discover or News data?
The query method supports different search types; check the reference for which dimensions each supports.
If you'd like Search Console reports that arrive on their own and flag real problems, tell us which numbers you check today.