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
andhost-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.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 page
Add 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 directory
Create 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 record
Add a TXT record with the specified unique value in the site's DNS record.
yandex-verification: <код подтверждения>
-
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.verification_type
*Rights verification method (ApiExplicitVerificationType)
* Required
*Required
Type: int64
. User ID. Required when calling all Yandex.Webmaster API resources. To get it, use the GET /v4/user method.
Type: host id (string)
. The site ID. To get it, use the GET /v4/user/{user-id}/hosts method.
Required
Yes
Type
string
Description
Unique authorization code.
Rights verification method (ApiExplicitVerificationType)
Explicit methods of rights verification (ApiExplicitVerificationType)
Verification method |
Whether a verification check can be requested |
Description |
|
Yes |
Verifying rights with the DNS record. |
|
Yes |
Placing an HTML file in the site's root directory. |
|
Yes |
Adding a meta tag to the site's home page header. |