Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex SmartCaptcha
  • Getting started
    • All guides
    • Creating a CAPTCHA
    • Deleting a CAPTCHA
    • Getting keys
    • Adding a widget using the advanced method
    • Verifying a CAPTCHA response
    • Viewing operations with resources
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes

In this article:

  • Service response
  • Request errors
  1. Step-by-step guides
  2. Verifying a CAPTCHA response

Verifying a CAPTCHA response

Written by
Yandex Cloud
Updated at October 31, 2024
  • Service response
  • Request errors

After validating a request, SmartCaptcha assigns it an ID: a one-time token. You can use the token to retrieve the result of a user request validation from the service. The token is valid for five minutes. After this time expires, it becomes invalid and the user has to go through the validation process again.

After validation, the token is loaded into the <input type="hidden" name="smart-token" value="<token>" ...> element on the user page. Here is an example:

<div id="captcha-container" class="smart-captcha" ...>
    <input type="hidden" name="smart-token" value="dD0xNjYyNDU3NDMzO2k9MmEwMjo2Yjg6YjA4MTpiNTk3OjoxOjFiO0Q9MjVCREY1RDgzMDBERjQ3QjExNkUyMDJDNjJFNEI3Q0Y0QjYzRkRDNzJEMkV********DNjMxODgzMUM0REZBNzI1QUE1QzUwO3U9MTY2MjQ1NzQzMzk5MTEwNjQxNTtoPTg4MWRjMDc2YzE3MjkxNGUwNDgwMTVkYzhl********">
    ...
</div>

Where:

  • <div id="captcha-container" class="smart-captcha" ...>: div element with a widget.
  • value: Token value.

To find out the result of the validation, send a POST request to https://smartcaptcha.yandexcloud.net/validate providing parameters in x-www-form-urlencoded format:

secret=<server_key>&token=<token>&ip=<user_IP_address>

Where:

  • secret: Server key.
  • token: One-time token received after passing the check.
  • ip: IP address of the user that originated the request to validate the token. This is an optional parameter, but we ask you to provide the user IP when making requests. This helps improve SmartCaptcha performance.

Service responseService response

In its response, the service will return a JSON object containing the status and message fields. If the status field value is ok, the host field is added to the JSON object. It shows on what website the validation was passed. For example:

  1. It is a human. User validation was passed on the example.com website:

    {
        "status": "ok",
        "message": "",
        "host": "example.com"
    }
    
  2. It is a human. User validation was passed on the example.com website via port 8080:

    {
        "status": "ok",
        "message": "",
        "host": "example.com:8080"
    }
    
  3. Empty host field. This may indicate that the cloud is blocked or an internal service failure occurred:

    {
        "status": "ok",
        "message": "",
        "host": ""
    }
    
  4. It is a robot:

    {
        "status": "failed",
        "message": ""
    }
    
  5. Request with a fake or damaged token. It is a robot:

    {
        "status": "failed",
        "message": "Token invalid or expired."
    }
    

Request errorsRequest errors

If your request to https://smartcaptcha.yandexcloud.net/validate is incorrect, the service will return an error. Here is an example:

  1. Request missing the server key:

    {
        "status": "failed",
        "message": "Authentication failed. Secret has not provided."
    }
    
  2. Request with a missing or damaged token:

    {
        "status": "failed",
        "message": "Token invalid or expired."
    }
    

Note

To avoid delays in user request processing, we recommend processing HTTP errors (response codes other than 200) as the "status": "ok" service response.

Was the article helpful?

Previous
Adding a widget using the advanced method
Next
Getting a list of CAPTCHAs
© 2025 Direct Cursus Technology L.L.C.