How to Query the Google Search Console API – Moz
Skip to content
Moz logo
Menu open
Menu close
Search
Products
Moz Pro
Moz Pro Home
Moz Local
Moz Local Home
STAT
Mozscape API
Free SEO Tools
Competitive Research
Link Explorer
Keyword Explorer
Domain Analysis
MozBar
More Free SEO Tools
Learn SEO
Beginner’s Guide to SEO
SEO Learning Center
Moz Academy
SEO Q&A
Webinars, Whitepapers, & Guides
Blog
Why Moz
Agency Solutions
Enterprise Solutions
Small Business Solutions
Case Studies
The Moz Story
New Releases
Log in
Log out
Products
Moz Pro
Your All-In-One Suite of SEO Tools
The essential SEO toolset: keyword research, link building, site audits, page optimization, rank tracking, reporting, and more.
Learn more
Try Moz Pro free
Moz Local
Complete Local SEO Management
Raise your local SEO visibility with easy directory distribution, review management, listing updates, and more.
Learn more
Check my presence
STAT
Enterprise Rank Tracking
SERP tracking and analytics for SEO experts, STAT helps you stay competitive and agile with fresh insights.
Learn more
Book a demo
Mozscape API
The Power of Moz Data via API
Power your SEO with the proven, most accurate link metrics in the industry, powered by our index of trillions of links.
Learn more
Get connected
Compare SEO Products
Free SEO Tools
Competitive Research
Competitive Intelligence to Fuel Your SEO Strategy
Gain intel on your top SERP competitors, keyword gaps, and content opportunities.
Find competitors
Link Explorer
Powerful Backlink Data for SEO
Explore our index of over 40 trillion links to find backlinks, anchor text, Domain Authority, spam score, and more.
Get link data
Keyword Explorer
The One Keyword Research Tool for SEO Success
Discover the best traffic-driving keywords for your site from our index of over 500 million real keywords.
Search keywords
Domain Analysis
Free Domain SEO Analysis Tool
Get top competitive SEO metrics like Domain Authority, top pages, ranking keywords, and more.
Analyze domain
MozBar
Free, Instant SEO Metrics As You Surf
Using Google Chrome, see top SEO metrics instantly for any website or search result as you browse the web.
Try MozBar
More Free SEO Tools
Learn SEO
Beginner’s Guide to SEO
The #1 most popular introduction to SEO, trusted by millions.
Read the Beginner’s Guide
How-To Guides
Step-by-step guides to search success from the authority on SEO.
See All SEO Guides
SEO Learning Center
Broaden your knowledge with SEO resources for all skill levels.
Visit the Learning Center
Moz Academy
Upskill and get certified with on-demand courses & certifications.
Explore the Catalog
On-Demand Webinars
Learn modern SEO best practices from industry experts.
View All Webinars
SEO Q&A
Insights & discussions from an SEO community of 500,000+.
Find SEO Answers
August 7-9, 2023
Lock in Super Early Bird savings for MozCon
Snag tickets
Blog
Why Moz
Small Business Solutions
Uncover insights to make smarter marketing decisions in less time.
Grow Your Business
The Moz Story
Moz was the first & remains the most trusted SEO company.
Read Our Story
Agency Solutions
Earn & keep valuable clients with unparalleled data & insights.
Drive Client Success
Case Studies
Explore how Moz drives ROI with a proven track record of success.
See What’s Possible
Enterprise Solutions
Gain a competitive edge in the ever-changing world of search.
Scale Your SEO
New Releases
Get the scoop on the latest and greatest from Moz.
See What’s New
New Feature: Moz Pro
Surface actionable competitive intel
Learn More
Log in
Moz Pro
Moz Local
Moz Local Dashboard
Mozscape API
Mozscape API Dashboard
Moz Academy
Avatar
Moz Home
Notifications
Account & Billing
Manage Users
Community Profile
My Q&A
My Videos
Log Out
By: Brian Gorman
March 18, 2020
How to Query the Google Search Console API
SEO Analytics
|
Advanced SEO
The author’s views are entirely his or her own (excluding the unlikely event of hypnosis) and may not always reflect the views of Moz.
If you’ve been an SEO for even a short time, you’re likely familiar with Google Search Console (GSC). It’s a valuable tool for getting information about your website and its performance in organic search. That said, it does have its limitations.
In this article, you’ll learn how to get better-connected data out of Google Search Console as well as increase the size of your exports by 400%.
Google Search Console limitations
While GSC has a number of sections, we’ll be focusing on the “Performance” report. From the GSC dashboard, there are two ways you can access this report:
Once inside the “Performance” report, data for queries and pages can be accessed:
This reveals one of the issues with GSC: Query and page data is separated.
In other words, if I want to see the queries a specific page is ranking for, I have to first click “Pages,” select the page, and then click “back” to “Queries.” It’s a very cumbersome experience.
The other (two-part) issue is with exporting:
Performance data for queries and pages must be exported separately.Exports are limited to 1,000 rows.
We’ll look to solve these issues by utilizing the GSC API.
What is the Google Search Console API?
Now we know the GSC user interface does have limitations: Connecting query data with page data is tricky, and exports are limited.
If the GSC UI represents the factory default, the GSC API represents our custom settings. It takes a bit more effort, but gives us more control and opens up more possibilities (at least in the realm of query and page data).
The GSC API is a way for us to connect to the data within our account, make more customized requests, and get more customized output. We can even bypass those factory default settings like exports limited to 1,000 rows, for instance.
Why use it?
Remember how I said earlier that query and page data is separated in the “vanilla” GSC UI? Well, with the API, we can connect query data with the page that query ranks for, so no more clicking back and forth and waiting for things to load.
Additionally, we saw that exports are limited to 1,000 rows. With the API, we can request up to 5,000 rows, an increase of 400%!
So let’s hook in, make our request, and get back a more robust and meaningful data set.
Setup
Log in to the appropriate GSC account on this page (upper right corner). For instance, if my website is example.com and I can view that Search Console account under admin@email.com, that’s the account I’ll sign into.
Enter the URL of the appropriate GSC account:
Set up your request:
Set startDate. This should be formatted as: YYYY-MM-DD.Set endDate.Set dimensions. A dimension can be:querypagedeviceand/or countrySet filters (optional). A filter must include:dimension (a dimension can be: query, page, device, or country)operator (an operator can be: contains, notContains, equals, notEquals)expression (an expression can be any value associated with the dimensions)Set the rowLimit. With the GSC API, you can request up to 5,000!
The page shared in step one makes all of this setup pretty easy, but it can be tedious and even confusing for some. I’ve done all the fussing for you and have created JSON you can edit quickly and easily to get the API return you’d like.
Unfiltered request
The following request will be unfiltered. We’ll set our preferred dates, dimensions, and a row limit, and then make our request.
The order in which you place your dimensions is the order in which they’ll be returned.
The API will return data for desktop, mobile, and tablet, separated out. The numbers you see in the GSC user interface — clicks, for instance — are an aggregate of all three (unless you apply device filtering).
Remember, your dimensions can also include “country” if you’d like.
{
“startDate”: “2019-11-01”,
“endDate”: “2020-01-31”,
“dimensions”:
[
“query”,
“page”,
“device”
],
“rowLimit”: 3000
}
Filtered request
This version of our request will include filters in order to be more specific about what is returned.
Filters are stated as dimension/operator/expression. Here are some examples to show what’s possible:
query contains go fish digitalpage equals https://gofishdigital.com/ device notContains tablet
It looks like you can only apply one filter per dimension, just like in the normal GSC user interface, but if you know differently, let us know in the comments!
{
“startDate”: “2019-11-01”,
“endDate”: “2020-01-31”,
“dimensions”:
[
“query”,
“page”,
“device”
],
“dimensionFilterGroups”:
[
{
“filters”:
[
{
“dimension”: “device”,
“operator”: “notContains”,
“expression”: “tablet”
}
]
}
],
“rowLimit”: 3000
}
Choose a template, unfiltered or filtered, and fill in your custom values (anything after a colon should be updated as your own value, unless you like my presets).
Execute the request
So there you have it! Two request templates for you to choose from and edit to your liking. Now it’s time to make the request. Click into the “Request body”, select all, and paste in your custom JSON:
This is where you could manually set up your request keys and values, but as I stated earlier, this can be tedious and a little confusing, so I’ve done that work for you.
Scroll down and click “Execute.” You may be prompted to sign-in here as well.
If everything was entered correctly and the request could be satisfied, the API will return your data. If you get an error, audit your request first, then any other steps and inputs if necessary.
Click into the box in the lower right (this is the response from the API), select all, and copy the information.
Convert from JSON to CSV
Excel or Sheets will be a much better way to work with the data, so let’s convert our JSON output to CSV.
Use a converter like this one and paste in your JSON output. You can now export a CSV. Update your column headers as desired.
Query your own data
Most SEOs are pretty comfortable in Excel, so you can now query your request output any way you’d like.
One of the most common tasks performed is looking for data associated with a specific set of pages. This is done by adding a sheet with your page set and using VLOOKUP to indicate a match.
The API output being in a spreadsheet also allows for the most common actions in Excel like sorting, filtering, and chart creation.
Get more out of Google Search Console
GSC offers important data for SEOs, and the GSC API output offers not only more of that data, but in a format that is far less cumbersome and more cohesive.
Today, we overcame two obstacles we often face in the standard GSC user interface: the query/page connection and limited exports. My hope is that utilizing the Google Search Console API will take your analyses and insights to the next level.
While my JSON templates will cover the most common scenarios in terms of what you’ll be interested in requesting, Google does offer documentation that covers a bit more ground if you’re interested.
Do you have another way of using the GSC API? Is there another API you commonly use as an SEO? Let me know in the comments!
With Moz Pro, you have the tools you need to get SEO right — all in one place.
Start your free trial!
Read Next
Top 4 Things to Know About GA4 — Whiteboard Friday
Read this post
5 Things I Learned About E-A-T by Analyzing 647 Search Results
Read this post
How to Measure Content Engagement — Whiteboard Friday
Read this post
Comments
Please keep your comments TAGFEE by following the community etiquette
Comments are closed. Got a burning question? Head to our Q&A section to start a new conversation.
Moz logo
Contact
Community
Free Trial
Terms & Privacy
Jobs
Help
News & Press
Copyright 2022 © Moz, Inc. All rights reserved.