Example of rights verification
To verify site management rights, you need to obtain a unique code and choose the verification method:
To get the verification code, send a GET request with user-id and host-id.
GET https://api.webmaster.yandex.net/v4/user/{user-id}/hosts/{host-id}/verification
user-id
Type: int64. User ID. Required when calling all Yandex.Webmaster API resources. To get it, use the GET /v4/user method. host-id
Type: host id (string). The site ID. To get it, use the GET /v4/user/{user-id}/hosts method. user-id
Type: int64. User ID. Required when calling all Yandex.Webmaster API resources. To get it, use the GET /v4/user method. host-id
Type: host id (string). The site ID. To get it, use the GET /v4/user/{user-id}/hosts method. The response contains the verification code in the verification_uin parameter. More information about requesting the verification code.
Choose the rights verification method:
Meta tag on the home pageAdd a meta tag in the HTML code of the site's home page (in the
head
element).<meta name="yandex-verification" content="<код подтверждения>" />
HTML file in the root directoryCreate an HTML file with a unique name in the format yandex_<confirmation code.>html and place it in the site's root directory. The file should contain the following:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body>Verification: <код подтверждения></body> </html>
DNS recordAdd a TXT record with the specified unique value in the site's DNS record.
yandex-verification: <код подтверждения>
Email address from the WHOIS dataConfirm the email address listed in WHOIS on the Email addresses page.
This method may be unavailable for some top-level domains (for example, RU or RF domains).
Start the rights verification procedure with a POST request that contains the chosen verification method.
POST https://api.webmaster.yandex.net/v4/user/{user-id}/hosts/{host-id}/verification ? verification_type=<string>
user-id
Type: int64. User ID. Required when calling all Yandex.Webmaster API resources. To get it, use the GET /v4/user method. host-id
Type: host id (string). The site ID. To get it, use the GET /v4/user/{user-id}/hosts method. user-id
Type: int64. User ID. Required when calling all Yandex.Webmaster API resources. To get it, use the GET /v4/user method. host-id
Type: host id (string). The site ID. To get it, use the GET /v4/user/{user-id}/hosts method. verification_type
*Rights verification method (ApiExplicitVerificationType) verification_type
*Rights verification method (ApiExplicitVerificationType) * Required