Google Search Console API
  1. searchanalytics
Google Search Console API
  • urlInspection
    • /v1/urlInspection/index:inspect
      POST
  • urlTestingTools
    • /v1/urlTestingTools/mobileFriendlyTest:run
      POST
  • sites
    • /webmasters/v3/sites
      GET
    • /sites
      GET
    • /webmasters/v3/sites/{siteUrl}
      DELETE
    • /sites/{siteUrl}
      DELETE
    • /webmasters/v3/sites/{siteUrl}
      GET
    • /sites/{siteUrl}
      GET
    • /webmasters/v3/sites/{siteUrl}
      PUT
    • /sites/{siteUrl}
      PUT
  • searchanalytics
    • /webmasters/v3/sites/{siteUrl}/searchAnalytics/query
      POST
    • /sites/{siteUrl}/searchAnalytics/query
      POST
  • sitemaps
    • /webmasters/v3/sites/{siteUrl}/sitemaps
      GET
    • /sites/{siteUrl}/sitemaps
      GET
    • /webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}
      DELETE
    • /sites/{siteUrl}/sitemaps/{feedpath}
      DELETE
    • /webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}
      GET
    • /sites/{siteUrl}/sitemaps/{feedpath}
      GET
    • /webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}
      PUT
    • /sites/{siteUrl}/sitemaps/{feedpath}
      PUT
  1. searchanalytics

/webmasters/v3/sites/{siteUrl}/searchAnalytics/query

POST
/webmasters/v3/sites/{siteUrl}/searchAnalytics/query
searchanalytics
Query your data with filters and parameters that you define. Returns zero or more rows grouped by the row keys that you define. You must define a date range of one or more days. When date is one of the group by values, any days without data are omitted from the result list. If you need to know which days have data, issue a broad date range query grouped by date for any metric, and see which day rows are returned.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://searchconsole.googleapis.com//webmasters/v3/sites//searchAnalytics/query' \
--header 'Content-Type: application/json' \
--data-raw '{
    "aggregationType": "AUTO",
    "dataState": "DATA_STATE_UNSPECIFIED",
    "dimensionFilterGroups": [
        {
            "filters": [
                {
                    "dimension": "QUERY",
                    "expression": "string",
                    "operator": "EQUALS"
                }
            ],
            "groupType": "AND"
        }
    ],
    "dimensions": [
        "DATE"
    ],
    "endDate": "string",
    "rowLimit": 0,
    "searchType": "WEB",
    "startDate": "string",
    "startRow": 0,
    "type": "WEB"
}'
Response Response Example
{
  "responseAggregationType": "AUTO",
  "rows": [
    {
      "clicks": 0,
      "ctr": 0,
      "impressions": 0,
      "keys": [
        "string"
      ],
      "position": 0
    }
  ]
}

Request

Path Params
siteUrl
string 
required
The site's URL, including protocol. For example: http://www.example.com/.
Body Params application/json
aggregationType
enum<string> 
optional
[Optional; Default is "auto"] How data is aggregated. If aggregated by property, all data for the same property is aggregated; if aggregated by page, all data is aggregated by canonical URI. If you filter or group by page, choose AUTO; otherwise you can aggregate either by property or by page, depending on how you want your data calculated; see the help documentation to learn how data is calculated differently by site versus by page. Note: If you group or filter by page, you cannot aggregate by property. If you specify any value other than AUTO, the aggregation type in the result will match the requested type, or if you request an invalid type, you will get an error. The API will never change your aggregation type if the requested type is invalid.
Allowed values:
AUTOBY_PROPERTYBY_PAGE
dataState
enum<string> 
optional
The data state to be fetched, can be full or all, the latter including full and partial data.
Allowed values:
DATA_STATE_UNSPECIFIEDFINALALL
dimensionFilterGroups
array[object (ApiDimensionFilterGroup) {2}] 
optional
[Optional] Zero or more filters to apply to the dimension grouping values; for example, 'query contains "buy"' to see only data where the query string contains the substring "buy" (not case-sensitive). You can filter by a dimension without grouping by it.
filters
array[object (ApiDimensionFilter) {3}] 
optional
groupType
enum<string> 
optional
Allowed value:
AND
dimensions
array[string]
optional
[Optional] Zero or more dimensions to group results by. Dimensions are the group-by values in the Search Analytics page. Dimensions are combined to create a unique row key for each row. Results are grouped in the order that you supply these dimensions.
Allowed values:
DATEQUERYPAGECOUNTRYDEVICESEARCH_APPEARANCE
endDate
string 
optional
[Required] End date of the requested date range, in YYYY-MM-DD format, in PST (UTC - 8:00). Must be greater than or equal to the start date. This value is included in the range.
rowLimit
integer <int32>
optional
[Optional; Default is 1000] The maximum number of rows to return. Must be a number from 1 to 25,000 (inclusive).
searchType
enum<string> 
optional
[Optional; Default is "web"] The search type to filter for.
Allowed values:
WEBIMAGEVIDEONEWSDISCOVERGOOGLE_NEWS
startDate
string 
optional
[Required] Start date of the requested date range, in YYYY-MM-DD format, in PST time (UTC - 8:00). Must be less than or equal to the end date. This value is included in the range.
startRow
integer <int32>
optional
[Optional; Default is 0] Zero-based index of the first row in the response. Must be a non-negative number.
type
enum<string> 
optional
Optional. [Optional; Default is "web"] Type of report: search type, or either Discover or Gnews.
Allowed values:
WEBIMAGEVIDEONEWSDISCOVERGOOGLE_NEWS
Examples

Responses

🟢200Successful response
application/json
Body
A list of rows, one per result, grouped by key. Metrics in each row are aggregated for all data grouped by that key either by page or property, as specified by the aggregation type parameter.
responseAggregationType
enum<string> 
optional
How the results were aggregated.
Allowed values:
AUTOBY_PROPERTYBY_PAGE
rows
array[object (ApiDataRow) {5}] 
optional
A list of rows grouped by the key values in the order given in the query.
clicks
number <double>
optional
ctr
number <double>
optional
impressions
number <double>
optional
keys
array[string]
optional
position
number <double>
optional
Modified at 2023-08-15 09:03:48
Previous
/sites/{siteUrl}
Next
/sites/{siteUrl}/searchAnalytics/query
Built with