To solve reCAPTCHA v3 or reCAPTCHA Enterprise from Python, read the site key from the render= parameter and the action from the grecaptcha.execute call, send both with the page URL and a proxy to a solver API, and submit the returned token as g-recaptcha-response (or the site's own field) within two minutes. For Enterprise the request is identical except for one flag, because only the script and the server-side check differ.
This guide explains what the token actually proves, how v3 and Enterprise differ, how to find the inputs on a real page, and gives complete Python and Node.js code. It ends with the reasons a perfectly valid token still gets rejected, which is where most reCAPTCHA v3 automation breaks.
Looking for pricing, success rates and the request playground instead of a walkthrough? See the reCAPTCHA v3 solver API page.
Short version: POST type "recaptchav3" with site_key, url, action and proxy to https://api.nslsolver.com/solve, add "enterprise": true when the page loads enterprise.js, and use data["token"] within two minutes. Prefer a client library? The same call is one method in the official Python and Node.js SDKs.
How does reCAPTCHA v3 work?
reCAPTCHA v3 never shows a checkbox or an image grid. The page loads recaptcha/api.js?render=SITE_KEY, and when the user does something worth protecting (log in, sign up, check out) the site calls grecaptcha.execute(SITE_KEY, {action: 'login'}). That call returns a token, which the page sends to its own backend together with the form.
The backend forwards the token and its secret key to Google's siteverify endpoint and gets back success, a score, the action name, the hostname and a timestamp. Google describes the score as 1.0 for "very likely a good interaction" and 0.0 for "very likely a bot".
Google does not block anyone itself. The site decides what to do with the score: Google suggests starting with a threshold of 0.5 and tuning it from real traffic, so one site may accept 0.3 while another requires 0.7 or sends low scores to a second check.
Two rules matter for automation. Per Google, a token is valid for two minutes and can only be verified once. And actions may contain only alphanumeric characters, slashes and underscores, and must not be user-specific, so they are static strings you can read from the page.
reCAPTCHA Enterprise vs v3: what is the difference?
reCAPTCHA Enterprise is the Google Cloud edition. On the page it looks almost the same: the site key still usually starts with 6L, and the token is still generated in the browser. The difference is the script, the JavaScript namespace and, above all, how the backend checks the token.
| reCAPTCHA v3 | reCAPTCHA Enterprise | |
|---|---|---|
| Script | recaptcha/api.js?render=KEY | recaptcha/enterprise.js?render=KEY |
| Client call | grecaptcha.execute(key, {action}) | grecaptcha.enterprise.execute(key, {action}) |
| Backend check | siteverify (secret + response) | projects.assessments.create (Google Cloud API) |
| What the site gets | success, score, action, hostname, challenge_ts | tokenProperties (valid, invalidReason, action, hostname) + riskAnalysis (score, reasons) |
| Score | 0.0 to 1.0 | 0.0 to 1.0 (11 levels; 4 levels without a billing account) |
| Reason codes | none | AUTOMATION, UNEXPECTED_ENVIRONMENT, TOO_MUCH_TRAFFIC, ... |
| Token lifetime | 2 minutes, verify once | 2 minutes, use once |
| NSLSolver request | type: "recaptchav3" | type: "recaptchav3" + enterprise: true |
Sources: Google reCAPTCHA v3 and verify docs, Google Cloud reCAPTCHA assessment docs and REST reference.
How do you find the site key and action on a page?
You need three values from the target page: the site key, the action and the edition (v3 or Enterprise). Open DevTools on the page and look for them in this order:
- Site key: the render= parameter of the reCAPTCHA script (www.google.com/recaptcha/... or www.recaptcha.net/recaptcha/...). If it says render=explicit, the key is the first argument of grecaptcha.execute instead.
- Edition: enterprise.js and grecaptcha.enterprise.execute mean Enterprise. api.js and grecaptcha.execute mean standard v3.
- Action: the action value in the execute call, such as login, submit or checkout. It often lives in a JavaScript bundle, not the HTML, so search the Sources panel for "execute(" or "action:".
- Where the token goes: submit the form once in a real browser and check the Network tab. The request shows the exact field name (g-recaptcha-response, recaptchaToken, captcha...) and the endpoint.
import re
import requests
html = requests.get("https://example.com/login", timeout=30).text
# Site key + edition: the render= parameter of api.js (v3) or enterprise.js
m = re.search(r"recaptcha/(api|enterprise)\.js\?render=([\w-]+)", html)
if m:
enterprise = m.group(1) == "enterprise"
site_key = m.group(2)
print("site_key:", site_key, "| enterprise:", enterprise)
# Action: the value passed to grecaptcha.execute / grecaptcha.enterprise.execute
actions = re.findall(r"execute\([^)]*?action\s*:\s*['\"]([\w/]+)['\"]", html)
print("actions:", actions)Solve reCAPTCHA v3 in Python
With the three values in hand, one POST to the NSLSolver /solve endpoint returns a token. The proxy is required: reCAPTCHA scores partly on the exit IP, so the token is generated from the proxy you pass, and you should submit the form through the same one. An average solve takes about 13 seconds.
The example below solves, checks for an error envelope ({"success": false, "error": "..."}), and submits the token straight away to stay inside the two-minute window.
import os
import requests
API_KEY = os.environ["NSLSOLVER_API_KEY"]
PROXY = "http://user:pass@host:port" # same exit IP for solving and submitting
PAGE_URL = "https://example.com/login" # page where reCAPTCHA runs
SITE_KEY = "6Lc..." # the render= value
ACTION = "login" # the action passed to grecaptcha.execute
def solve_recaptcha_v3(enterprise: bool = False) -> str:
payload = {
"type": "recaptchav3",
"site_key": SITE_KEY,
"url": PAGE_URL,
"action": ACTION,
"proxy": PROXY,
}
if enterprise:
payload["enterprise"] = True # the page loads recaptcha/enterprise.js
resp = requests.post(
"https://api.nslsolver.com/solve",
headers={"X-API-Key": API_KEY},
json=payload,
timeout=120,
)
data = resp.json()
if resp.status_code != 200 or data.get("success") is False:
raise RuntimeError(f"Solve failed ({resp.status_code}): {data.get('error')}")
return data["token"]
token = solve_recaptcha_v3(enterprise=False)
# Submit right away: the token expires after two minutes and works only once.
session = requests.Session()
session.proxies = {"http": PROXY, "https": PROXY}
r = session.post(
"https://example.com/login",
data={
"email": "me@example.com",
"password": "...",
"g-recaptcha-response": token, # or the field name the site really uses
},
timeout=30,
)
print(r.status_code)Solve reCAPTCHA Enterprise in Python
For an Enterprise site, keep everything the same and set the enterprise flag: solve_recaptcha_v3(enterprise=True) in the script above. Sending a standard v3 request for an Enterprise key, or the reverse, is a common cause of tokens that the site rejects.
With the official Python SDK the same request is a single method call:
# pip install nslsolver
from nslsolver import NSLSolver
client = NSLSolver("nsl_...")
token = client.recaptcha_v3(
site_key="6Lc...",
url="https://example.com/login",
action="login",
enterprise=True, # reCAPTCHA Enterprise (enterprise.js)
proxy="http://user:pass@host:port",
)
print(token)Solve reCAPTCHA v3 in Node.js
The Node.js version uses the built-in fetch for the solve call and undici's ProxyAgent to submit the form through the same proxy. The optional user_agent field lets you align the solving browser with the User-Agent your own client sends.
// solve.mjs (Node.js 18+, ES module)
// npm install undici -> only needed to send the form through the proxy
import { fetch as proxiedFetch, ProxyAgent } from "undici";
const API_KEY = process.env.NSLSOLVER_API_KEY;
const PROXY = "http://user:pass@host:port";
const PAGE_URL = "https://example.com/login";
async function solveRecaptchaV3({ siteKey, action, enterprise = false, userAgent }) {
const body = {
type: "recaptchav3",
site_key: siteKey,
url: PAGE_URL,
action,
proxy: PROXY,
};
if (enterprise) body.enterprise = true; // page loads recaptcha/enterprise.js
if (userAgent) body.user_agent = userAgent; // optional, match your own client
const resp = await fetch("https://api.nslsolver.com/solve", {
method: "POST",
headers: { "Content-Type": "application/json", "X-API-Key": API_KEY },
body: JSON.stringify(body),
signal: AbortSignal.timeout(120_000),
});
const data = await resp.json();
if (!resp.ok || data.success === false) {
throw new Error("Solve failed (" + resp.status + "): " + data.error);
}
return data.token;
}
const token = await solveRecaptchaV3({ siteKey: "6Lc...", action: "login", enterprise: true });
// Use it within two minutes, once, through the same proxy.
const res = await proxiedFetch("https://example.com/api/login", {
method: "POST",
dispatcher: new ProxyAgent(PROXY),
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email: "me@example.com", password: "...", recaptchaToken: token }),
});
console.log(res.status);Where do you put the token?
There is no universal field. Classic form integrations post the token as g-recaptcha-response, which is also the POST parameter Google documents for Enterprise form submissions. Single-page apps usually send it in a JSON body or a header under their own name, which is why checking one real submission in the Network tab is worth the minute it takes.
- HTML form: add or fill a field named g-recaptcha-response, plus every other field the form normally sends (CSRF token, hidden inputs).
- JSON API: put the token in the key the frontend uses, for example {"recaptchaToken": "..."}, and keep the same headers and cookies.
- Browser automation (Playwright, Selenium): call the site's own submit handler with the token, or set the hidden input before submitting the form.
- One token per request. Solve again for the next login or form, since a used token is rejected.
Why is a valid reCAPTCHA token still rejected?
A token can be genuine and still fail the site's check. The backend sees more than "valid or not", and each of these fields can sink an otherwise good token:
- Wrong action. siteverify returns the action and Google tells site owners to check it. On Enterprise, a mismatch with expectedAction can produce the UNEXPECTED_ACTION invalid reason. Pass the exact action string from the execute call.
- Score below the site's threshold. The site picks the cut-off, not Google. No solver can promise a specific score; a clean proxy and the correct action give the best chance.
- Expired or reused. Tokens last two minutes and are single-use. Google returns timeout-or-duplicate on v3, and EXPIRED or DUPE on Enterprise.
- Different domain. The response carries the hostname where the token was made, and Enterprise returns DOMAIN_MISMATCH for domains not allowed for the key. Always send the real page URL, not a different subdomain.
- Wrong key or edition. A v3 token for an Enterprise key (or a token for another key) fails, with KEY_MISMATCH on Enterprise.
- IP or User-Agent mismatch. Sites may pass the visitor IP to Google (remoteip on siteverify, userIpAddress and userAgent on Enterprise) or compare it themselves. Submit through the same proxy you solved with to stay safe.
Troubleshooting reCAPTCHA v3 tokens
Match the symptom to the cause. The API errors below come from NSLSolver; the others come back from the target site or from Google via the site.
| Symptom | Likely cause | Fix |
|---|---|---|
| timeout-or-duplicate / EXPIRED / DUPE | Token older than 2 minutes, or used twice | Solve right before submitting; one token per request |
| Site says "captcha failed", API returned a token | Wrong action, or score under the site threshold | Copy the exact action; use a clean residential proxy |
| KEY_MISMATCH / invalid-input-response | Wrong site key, or v3 vs Enterprise mixed up | Re-read render=; set enterprise only for enterprise.js |
| DOMAIN_MISMATCH / wrong hostname | url points to another domain or subdomain | Pass the full URL of the page that runs reCAPTCHA |
| Works in a browser, fails from the script | Different IP or User-Agent, missing cookies or fields | Submit through the same proxy; replay all form fields |
| API 400 | Missing or invalid field (often the proxy format) | Use protocol://user:pass@host:port |
| API 402 | Balance too low | Top up; failed solves are never billed |
| API 429 / 503 | Per-minute limit reached, or solve not completed | Wait a few seconds and retry; neither is billed |
Only successful solves are billed at $1.00 per 1,000. Validation errors, 429 and 503 responses cost nothing.
Use it where you are allowed to
reCAPTCHA protects real accounts and real checkouts. Use automated solving on your own sites, in QA and load tests of your own forms, and on sites whose terms permit automation. For everything else, ask the site owner for API access first.