Getting a list of sitemap files

Description

Get a list of sitemap files detected by the Yandex robots.

Request format

Send a GET request to the operation address for the site's sitemaps resource:

GET https://api.webmaster.yandex.net/v3/user/{user-id}/hosts/{host-id}/sitemaps/[?parent_id={parent_id}&limit={limit}&from={from}]

Path parameters

NameRequiredTypeDefault valueDescription
user-idYesint64The user ID.
host-idYeshost idSite ID.

Query arguments

NameRequiredTypeDefault valueDescription
parent_idNositemap idID of the parent sitemap.
LimitNoint3210Page size (1-100).
fromNositemap idGet sitemaps, starting from the specified one (not including it).

Response format

If successful, the server returns 200 OK and a list of the site's sitemap files.

Samples

{
  "sitemaps": [
    {
      "sitemap_id": "c7-fe:80-c0",
      "sitemap_url": "explicit error message",
      "last_access_date": "2016-01-01T00:00:00,000+0300",
      "errors_count": 1,
      "urls_count": 1,
      "children_count": 1,
      "sources": [
        "ROBOTS_TXT"
      ], ...
      "sitemap_type": "SITEMAP"
    }, ...
  ]
}
NameRequiredTypeDescription
sitemap_idYesstringID of the sitemap file.
sitemap_urlYesstringURL of the sitemap file.
last_access_dateNoyyyy-MM-ddTHH:mm:ss,sssZThe date when the file was last visited.
errors_countYesint32The number of errors in the file.
urls_countYesint64The number of URLs in the file.
children_countYesint32The number of child sitemaps.
SourceYesApiSitemapSourceThe sources that led the robot to this file.
sitemap_typeYesApiExplicitVerificationTypeThe type of sitemap file.

Sitemap source (ApiSitemapSource)

SourceDescription
ROBOTS_TXTThe sitemap is specified in the robots.txt file on the site.
WEBMASTERThe user added the sitemap in Yandex.Webmaster.
INDEX_SITEMAPThe sitemap was found in another (indexed) sitemap file.

Type of sitemap file (ApiSitemapType)

TypeDescription
SITEMAPA normal sitemap file containing the URLs of site pages.
INDEX_SITEMAPA sitemap index containing the URLs of other sitemaps.

Errors

403 Forbidden

The user ID for the token doesn't match the one specified in the request. In the examples below, {user_id} is the correct uid for the owner of the OAuth token.

{
  "error_code": "INVALID_USER_ID",
  "available_user_id": 1,
  "error_message": "Invalid user id. {user_id} should be used."
}
ParameterDescription
error_codeError code.
available_user_idID of the user who allowed access.
error_messageError message.

404 Not Found

The site isn't in the list of the user's sites, or rights to the site haven't been verified.

{
  "error_code": "HOST_NOT_VERIFIED",
  "host_id": "http:ya.ru:80",
  "error_message": "explicit error message"
}
ParameterDescription
error_codeError code.
host_idThe ID of the requested site.
error_messageError message.