Getting general statistics for all search queries

Allows you to get the history of changes in indicators for all search queries for a certain period of time.

  1. Request format
  2. Response format
  3. Response codes

Request format

GET https://api.webmaster.yandex.net/v4/user/{user-id}/hosts/{host-id}/search-queries/all/history
 ? [query_indicator=<string>]
 & [device_type_indicator=<string>]
 & [date_from=<datetime>]
 & [date_to=<datetime>]
user-idType: int64. User ID. Required when calling all Yandex.Webmaster API resources. To get it, use the GET /v4/user method.
host-idType: host id (string). The site ID. To get it, use the GET /v4/user/{user-id}/hosts method.
user-idType: int64. User ID. Required when calling all Yandex.Webmaster API resources. To get it, use the GET /v4/user method.
host-idType: host id (string). The site ID. To get it, use the GET /v4/user/{user-id}/hosts method.
query_indicatorIndicators for displaying requests (ApiQueryIndicator). You can specify multiple indicators. For example, query_indicator=TOTAL_SHOWS&query_indicator=TOTAL_CLICKS.
device_type_indicator

Device type (ApiDeviceTypeIndicator). Default value: ALL.

date_from

The start date of the range. If omitted, data is returned for the last week.

date_to

The end date of the range. If omitted, data is returned for the last week.

query_indicatorIndicators for displaying requests (ApiQueryIndicator). You can specify multiple indicators. For example, query_indicator=TOTAL_SHOWS&query_indicator=TOTAL_CLICKS.
device_type_indicator

Device type (ApiDeviceTypeIndicator). Default value: ALL.

date_from

The start date of the range. If omitted, data is returned for the last week.

date_to

The end date of the range. If omitted, data is returned for the last week.

Query indicators (ApiQueryIndicator)

Indicator Description
TOTAL_SHOWS The number of displays.
TOTAL_CLICKS The number of clicks.
AVG_SHOW_POSITION The average position of the display.
AVG_CLICK_POSITION Average click position.
Indicator Description
TOTAL_SHOWS The number of displays.
TOTAL_CLICKS The number of clicks.
AVG_SHOW_POSITION The average position of the display.
AVG_CLICK_POSITION Average click position.

Device type indicators (ApiDeviceTypeIndicator)

Indicator Description
ALL All device types.
DESKTOP Computers.
MOBILE_AND_TABLET Mobile phones and tablets.
MOBILE Mobile phones.
TABLET Tablets.
Indicator Description
ALL All device types.
DESKTOP Computers.
MOBILE_AND_TABLET Mobile phones and tablets.
MOBILE Mobile phones.
TABLET Tablets.

If the request does not specify a device type indicator, the default value is ALL.

Response format

Examples

{
    "indicators": {
        "TOTAL_SHOWS": [
            {
                "date": "2019-07-18T00:00:00.000+03:00",
                "value": 100.0
            },
            ...
            }
        ]
    }
}
Name Required Type Description Note
TOTAL_SHOWS Yes ApiQueryIndicator Search query indicator. May be omitted if its value is not defined.
Name Required Type Description Note
TOTAL_SHOWS Yes ApiQueryIndicator Search query indicator. May be omitted if its value is not defined.

Query indicators (ApiQueryIndicator)

Indicator Description
TOTAL_SHOWS The number of displays.
TOTAL_CLICKS The number of clicks.
AVG_SHOW_POSITION The average position of the display.
AVG_CLICK_POSITION Average click position.
Indicator Description
TOTAL_SHOWS The number of displays.
TOTAL_CLICKS The number of clicks.
AVG_SHOW_POSITION The average position of the display.
AVG_CLICK_POSITION Average click position.

Response codes

To view the response structure in detail, click the reason.

Code Reason Description
200 OK
403

INVALID_USER_ID

The ID of the user who issued the token differs from the one specified in the request. In the examples below, {user_id} shows the correct uid of the OAuth token owner.

{
  "error_code": "INVALID_USER_ID",
  "available_user_id": 1,
  "error_message": "Invalid user id. {user_id} should be used."
}
404 HOST_NOT_VERIFIED
Site management rights are not verified.
{
  "error_code": "HOST_NOT_VERIFIED",
  "host_id": "http:ya.ru:80",
  "error_message": "some string"
}
HOST_NOT_INDEXED
The Sitemap file is missing.
{
  "error_code": "HOST_NOT_INDEXED", //errorCode. 
  "host_id": "http:ya.ru:80", //id хоста. host id. 
  "error_message": "some string" //Error message. 
}
HOST_NOT_LOADED

The site data isn't uploaded to Yandex.Webmaster yet.

{
  "error_code": "HOST_NOT_LOADED",
  "host_id": "http:ya.ru:80",
  "error_message": "some string"
}
Code Reason Description
200 OK
403

INVALID_USER_ID

The ID of the user who issued the token differs from the one specified in the request. In the examples below, {user_id} shows the correct uid of the OAuth token owner.

{
  "error_code": "INVALID_USER_ID",
  "available_user_id": 1,
  "error_message": "Invalid user id. {user_id} should be used."
}
404 HOST_NOT_VERIFIED
Site management rights are not verified.
{
  "error_code": "HOST_NOT_VERIFIED",
  "host_id": "http:ya.ru:80",
  "error_message": "some string"
}
HOST_NOT_INDEXED
The Sitemap file is missing.
{
  "error_code": "HOST_NOT_INDEXED", //errorCode. 
  "host_id": "http:ya.ru:80", //id хоста. host id. 
  "error_message": "some string" //Error message. 
}
HOST_NOT_LOADED

The site data isn't uploaded to Yandex.Webmaster yet.

{
  "error_code": "HOST_NOT_LOADED",
  "host_id": "http:ya.ru:80",
  "error_message": "some string"
}