Example of rights verification

To verify site management rights, you need to obtain a unique code and choose the verification method:

  1. 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.

    The response contains the verification code in the verification_uin parameter. More information about requesting the verification code.

  2. 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: <код подтверждения>
    
  3. 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