CaptchaNo
Back to blog
tutorials20 Nov 2026·13 min read

Yandex SmartCaptcha Solver in Python and Node.js

DDishant Singh
tutorials

Solve Yandex SmartCaptcha in Python and Node.js: find the sitekey, get a smart-token from an API, inject it, and fix expired or rejected tokens.

A Yandex SmartCaptcha solver needs two inputs, the page URL and the widget's public sitekey, and returns one thing: the token the widget would have written into its hidden smart-token field. Your code puts that token in the form (or hands it to the page's callback) and submits it within five minutes, from the same IP the token was solved for. This guide shows where to find the sitekey, how to get a token from the CaptchaNo Yandex SmartCaptcha solver in Python and Node.js, and why a token that looks fine still gets rejected.

What is Yandex SmartCaptcha?

SmartCaptcha is the captcha service of Yandex Cloud, which site owners embed in their own forms. Most visitors see an "I'm not a robot" checkbox; when the risk check wants more, the widget adds a second task such as typing distorted text, and an invisible mode skips the checkbox entirely.

The flow is the same shape as reCAPTCHA and Turnstile:

  1. The page loads captcha.js and renders a widget with a client key (the sitekey).
  2. When the visitor passes, the widget writes a token into <input type="hidden" name="smart-token"> and fires the page's callback, if there is one.
  3. The site's server POSTs that token to Yandex with its secret server key and, optionally, the visitor's IP, and gets back status: "ok" or status: "failed".

Yandex's user validation documentation (updated 27 August 2026) sets three rules that shape everything below: the endpoint is https://smartcaptcha.cloud.yandex.ru/validate, a token is valid for five minutes, and a token can be validated only once. Older integrations still reference the smartcaptcha.yandexcloud.net host; on 20 November 2026 both hosts served captcha.js.

One thing SmartCaptcha is not: the captcha Yandex Search itself shows when it sees too many automated queries. That is Yandex's own anti-abuse page, and Yandex's help pages point automated search users to its Yandex XML search service instead. This guide is about the SmartCaptcha widget embedded on other sites.

What we tested

On 20 November 2026 we ran the page-side code from this guide with Playwright 1.62.1 and headless Chromium 151, against Yandex's public demo page (captcha-api.yandex.ru/demo) and a local page that renders an invisible widget. We did not call a solving API in this run, so nothing here is a claim about solve speed or success rates. What the run showed:

  • After render, the container holds an empty input[name="smart-token"] (also tagged data-testid="smart-token") and two iframes whose src includes sitekey=.
  • The demo page's sitekey has no ysc1_ prefix, even though Yandex's CAPTCHA keys documentation says client keys start with ysc1_. Don't reject a key because of its prefix.
  • An invisible widget still creates the hidden smart-token input, and a hook on window.smartCaptcha.render captured its sitekey, the invisible flag and the callback.
  • On localhost the widget refused to load with "Widget with this key cannot be used in the host". Sitekeys are tied to the hosts the owner allowed, so always send the real page URL.

How to find the Yandex SmartCaptcha sitekey

The sitekey is in the page, and it is public by design, the same as a reCAPTCHA site key. You never need the server key; only the site's backend has it. Check these three places in order:

  1. The widget container. A widget rendered from HTML is a div with class smart-captcha and a data-sitekey attribute, for example <div id="captcha-container" class="smart-captcha" data-sitekey="ysc1_...">.
  2. The render call. Pages that load captcha.js?render=onload&onload=fn call window.smartCaptcha.render(container, { sitekey, ... }) from JavaScript, so there is no attribute to read. Hook render (code below) or search the page's scripts for sitekey.
  3. The iframe URL. Once the widget is on screen, its checkbox-iframe carries sitekey=... in its src.

If you only have a URL, the captcha detector reports the captcha type and the data-sitekey when the widget is in the HTML. To check a sitekey and URL pair before writing any code, paste them into the solver playground.

The CaptchaNo request for Yandex SmartCaptcha

One POST with type: "yandex_smartcaptcha", the page URL and the sitekey returns the token. Add ?wait=60 and the call blocks until the token is ready, so most clients need no polling loop.

curl -X POST "https://api.captchano.com/v1/solve?wait=60" \
  -H "Authorization: Bearer $CAPTCHANO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "yandex_smartcaptcha",
    "url": "https://example.com/signup",
    "sitekey": "ysc1_...",
    "proxy": "http://user:pass@host:port"
  }'

A finished solve comes back as:

{
  "id": "slv_...",
  "status": "ready",
  "type": "yandex_smartcaptcha",
  "solution": { "token": "dD0xNzky..." },
  "cost": "0.00598"
}
  • proxy and userAgent are optional. Send the proxy your client will submit through (http, socks4 or socks5, as scheme://user:pass@host:port).
  • If the solve is still running when wait runs out, you get HTTP 202 with an id; poll GET https://api.captchano.com/v1/task/{id} every few seconds until status is ready or failed.
  • A missing sitekey returns 400 invalid_sitekey before anything is solved.
  • The price is $0.00598 per successful solve, and failed solves are not billed (see current rates). The full field reference for every type is on the captcha solver API page.

Solve Yandex SmartCaptcha in Python

Use one small helper for the API call, then either post the token directly with requests or inject it into a Playwright page. Keep the key in an environment variable, never in the script.

import os, time, requests

API = "https://api.captchano.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['CAPTCHANO_API_KEY']}"}

def solve_smartcaptcha(page_url, sitekey, proxy=None, user_agent=None):
    payload = {"type": "yandex_smartcaptcha", "url": page_url, "sitekey": sitekey}
    if proxy:
        payload["proxy"] = proxy
    if user_agent:
        payload["userAgent"] = user_agent
    r = requests.post(f"{API}/solve", params={"wait": 60}, json=payload,
                      headers=HEADERS, timeout=130)
    task = r.json()
    while r.status_code == 202 or task.get("status") in ("queued", "solving"):
        time.sleep(5)
        r = requests.get(f"{API}/task/{task['id']}", headers=HEADERS, timeout=30)
        task = r.json()
    if task.get("status") != "ready":
        code = task.get("error", {}).get("code", f"HTTP {r.status_code}")
        raise RuntimeError(f"SmartCaptcha not solved: {code}")
    return task["solution"]["token"]

Plain HTTP with requests

When the form is a normal HTML POST, you don't need a browser: read the sitekey from the HTML, solve, and send the token as the smart-token field. Use the same proxy for the page fetch, the solve and the submit.

import re

PAGE = "https://example.com/signup"
PROXY = os.environ.get("PROXY_URL")  # e.g. http://user:pass@host:port
UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36"

s = requests.Session()
s.headers["User-Agent"] = UA
if PROXY:
    s.proxies = {"http": PROXY, "https": PROXY}

html = s.get(PAGE, timeout=30).text
tag = re.search(r'<[^>]*\bsmart-captcha\b[^>]*>', html)
if not tag:
    raise SystemExit("No .smart-captcha element: the widget is rendered from JavaScript, use the browser flow")
sitekey = re.search(r'data-sitekey="([^"]+)"', tag.group(0)).group(1)

token = solve_smartcaptcha(PAGE, sitekey, proxy=PROXY, user_agent=UA)
resp = s.post(PAGE, data={"name": "user", "smart-token": token}, timeout=30)
print(resp.status_code)

Copy the form's other fields and its real action URL from the HTML; the example posts back to the page itself, as Yandex's demo form does.

Playwright for Python, including JavaScript-rendered and invisible widgets

In a browser, install a hook before the page loads so you capture the sitekey and callback even when there is no .smart-captcha attribute to read. This is the same idea as the render hook in our Turnstile solver for Python, adapted to window.smartCaptcha.

from playwright.sync_api import sync_playwright

HOOK = """(() => {
  let real;
  Object.defineProperty(window, 'smartCaptcha', {
    configurable: true,
    get() { return real; },
    set(v) {
      if (v && typeof v.render === 'function' && !v.__cn) {
        const render = v.render.bind(v);
        v.render = (container, params) => {
          window.__smart = { sitekey: params.sitekey, invisible: !!params.invisible };
          window.__smartCallback = params.callback;
          return render(container, params);
        };
        v.__cn = true;
      }
      real = v;
    },
  });
})();"""

READ_SITEKEY = """() => {
  const el = document.querySelector('.smart-captcha[data-sitekey]');
  if (el) return el.dataset.sitekey;
  if (window.__smart) return window.__smart.sitekey;
  const f = document.querySelector('iframe[data-testid="checkbox-iframe"]');
  return f ? new URL(f.src).searchParams.get('sitekey') : null;
}"""

INJECT = """(token) => {
  document.querySelectorAll('input[name="smart-token"]').forEach(i => { i.value = token; });
  if (typeof window.__smartCallback === 'function') window.__smartCallback(token);
}"""

with sync_playwright() as p:
    browser = p.chromium.launch(proxy={"server": "http://host:port",
                                       "username": "user", "password": "pass"})
    ctx = browser.new_context(user_agent=UA)
    page = ctx.new_page()
    page.add_init_script(HOOK)
    page.goto(PAGE, wait_until="networkidle")

    sitekey = page.evaluate(READ_SITEKEY)
    token = solve_smartcaptcha(page.url, sitekey,
                               proxy="http://user:pass@host:port", user_agent=UA)
    page.evaluate(INJECT, token)
    page.click("form [type=submit]")

Two details matter. Set the user agent on the context, not as a header, so the page's JavaScript sees the same browser string the token was requested with. And if the page uses invisible mode with a callback, the callback usually submits the form itself, so check whether the click is still needed.

Solve Yandex SmartCaptcha in Node.js

Node 18+ has fetch built in, so the helper needs no dependencies. With Playwright for Node, reuse the same HOOK, READ_SITEKEY and INJECT strings from the Python example.

const API = "https://api.captchano.com/v1";
const headers = {
  Authorization: `Bearer ${process.env.CAPTCHANO_API_KEY}`,
  "Content-Type": "application/json",
};

export async function solveSmartCaptcha({ url, sitekey, proxy, userAgent }) {
  const body = JSON.stringify({ type: "yandex_smartcaptcha", url, sitekey, proxy, userAgent });
  let res = await fetch(`${API}/solve?wait=60`, { method: "POST", headers, body });
  let task = await res.json();
  while (res.status === 202 || task.status === "queued" || task.status === "solving") {
    await new Promise((r) => setTimeout(r, 5000));
    res = await fetch(`${API}/task/${task.id}`, { headers });
    task = await res.json();
  }
  if (task.status !== "ready") throw new Error(`SmartCaptcha not solved: ${task.error?.code ?? res.status}`);
  return task.solution.token;
}

// Playwright (Node): same hook, read and inject steps as the Python example
await page.addInitScript(HOOK);
await page.goto(PAGE, { waitUntil: "networkidle" });
const sitekey = await page.evaluate(READ_SITEKEY);
const token = await solveSmartCaptcha({ url: page.url(), sitekey, proxy: PROXY, userAgent: UA });
await page.evaluate(INJECT, token);

Puppeteer works the same way: page.evaluateOnNewDocument(HOOK) instead of addInitScript, and page.setUserAgent(UA) before navigation.

Why a Yandex SmartCaptcha token gets rejected

Almost every rejection is one of five causes: the token is too old, it was used twice, it was earned from a different IP, it went into the wrong place, or the widget never accepted the sitekey on that host. Yandex's validate response separates the first two from the third: a token problem returns failed with a message such as "Invalid or expired Token", while a visitor judged to be a bot returns failed with an empty message. You won't see that response, since the site's server makes the call, but the site's error usually follows the same split.

SymptomLikely causeFix
Rejected after a slow step or a retryToken older than five minutes, or already validated onceSolve right before submitting; get a new token for every attempt
Rejected straight away, no messageValidation included the visitor's IP and it differs from where the token was solvedSend your proxy with the task and submit through the same proxy
Field is filled but the form stays lockedThe page waits for its callback or the success event, not the fieldCall the captured callback with the token, as in INJECT
No .smart-captcha element foundWidget rendered from JavaScript or in invisible modeUse the render hook or read sitekey= from the iframe URL
Widget errors with "cannot be used in the host"Sitekey is bound to the owner's allowed hostsSend the exact page URL the form lives on
Page resets the widget before submitThe widget fired token-expiredRe-solve and re-inject; don't reuse the old token

Yandex also tells site owners to treat a non-200 reply from the validate endpoint as passed, so a site that seems to accept anything during a Yandex outage tells you nothing about your token. For a longer walk through these patterns across captcha types, see why valid captcha tokens get rejected.

Invisible SmartCaptcha and the callback

Invisible mode changes how the widget starts, not what it produces: the site still validates a smart-token, so the request to CaptchaNo is identical. Per Yandex's widget methods reference (updated 15 May 2026), an invisible widget is rendered with invisible: true and a callback, and the page calls window.smartCaptcha.execute() when the visitor clicks submit.

That means the page's submit handler typically calls execute() and waits for the callback before posting. If you click submit without the callback ever firing, nothing happens. Capture the callback with the hook, call it with your token, and let the page's own code finish the submit. window.smartCaptcha.getResponse() is a quick way to confirm what the page will read.

How CaptchaNo handles Yandex SmartCaptcha

CaptchaNo solves SmartCaptcha on our own solving infrastructure and returns the token in solution.token, with the same request shape we use for reCAPTCHA, Turnstile and GeeTest v3, so adding a new type to existing code is a one-line change. You pay $0.00598 for a solve that returns a token, failed solves are never billed, and credit does not expire. If a site needs something our docs don't cover, write to support@captchano.com; the people who reply are the engineers who run the service. If you also run into GeeTest's newer widget, the GeeTest v4 solver guide covers its five-field result.

Use it on sites you own, test, or are allowed to automate. Our acceptable use policy lists what we don't support, such as mass account creation and fraud.

Frequently Asked Questions

What is Yandex SmartCaptcha?

Yandex SmartCaptcha is the captcha service of Yandex Cloud that websites embed to tell people from bots. It shows an "I'm not a robot" checkbox, adds a harder task such as distorted text when the request looks suspicious, and can also run invisibly. The browser gets a one-time token, and the site's server checks it with Yandex using a secret server key.

How long is a Yandex SmartCaptcha token valid?

Yandex documents five minutes, and each token can be validated only once. A second check of the same token fails with an invalid or expired token message. In practice, request the token just before you submit the form, and get a fresh one for every retry instead of reusing a token that the site already rejected.

Do I need a proxy to solve Yandex SmartCaptcha?

Not always, but it is safer to send one. The site's validation call can include the visitor's IP address, and if the token was earned from one network and the form arrives from another, the check can fail. Passing the proxy your client submits through keeps both on the same exit IP, which removes that cause of rejection.

Is the sitekey the same as the server key?

No. The sitekey, or client key, is public and sits in the page so the widget can load; newer ones start with ysc1_. The server key starts with ysc2_ and stays on the site's backend, where it is used to validate tokens. A solver only ever needs the sitekey and the page URL, never the server key.

Is the captcha on Yandex Search the same as SmartCaptcha?

No. The check Yandex Search shows after many automated queries is Yandex's own protection for its search pages, while SmartCaptcha is a Yandex Cloud product that other sites embed in their forms. For programmatic access to search results, Yandex's help pages point to its Yandex XML service rather than to solving that page.

Start solving Yandex SmartCaptcha

You now have the sitekey lookup, the request, the injection code and the reasons tokens fail. Create a CaptchaNo account, create an API key, and run the helper above against a form you are allowed to automate. Request fields and examples are on the Yandex SmartCaptcha solver page.