Skip to Content
AnySolver logo
AnySolver
Token

ReCaptchaV2Token

Solve a Google reCAPTCHA V2 checkbox or invisible widget through your own proxy and receive the g-recaptcha-response token.

ReCaptchaV2Token solves a Google reCAPTCHA V2 widget through your proxy and returns the g-recaptcha-response token that you submit with the form. V2 is Google's checkbox widget ("I'm not a robot"), which can escalate to an image challenge. The invisible variant has no checkbox and starts from a button click or a grecaptcha.execute() call.

If the target does not compare the provider's IP with the IP that submits the form, use ReCaptchaV2TokenProxyLess. For pages that load enterprise.js, use ReCaptchaV2EnterpriseToken.

The reCAPTCHA V2 checkbox widget on Google's demo page

Use your proxy

task.proxy is required on this task type, and the provider solves from that address. The proxy must keep one IP for the whole solve: see Keep the same IP for the whole solve. Submit the form from the same address.

Find the sitekey

The sitekey is the public identifier of the widget, and it goes into websiteKey. On Google's reCAPTCHA demo it is the data-sitekey of the widget container:

<div class="g-recaptcha" data-sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-" data-callback="onSuccess"></div>

Elements tab

  1. Open DevTools and go to the Elements tab.
  2. Search (Ctrl + F) for data-sitekey or g-recaptcha.
  3. Copy the data-sitekey value of the container.

Finding the sitekey in the Elements tab

Network tab

If the widget is rendered with grecaptcha.render(), there is no data-sitekey attribute. Open the Network tab, filter for recaptcha, and find the request to google.com/recaptcha/api2/anchor. The sitekey is its k query parameter.

Console

(() => {
    const el = document.querySelector('.g-recaptcha[data-sitekey], [data-sitekey]');
    const iframe = document.querySelector('iframe[src*="recaptcha"]');
    const key = el?.dataset.sitekey ?? (iframe && new URL(iframe.src).searchParams.get('k'));
    console.log('sitekey:', key ?? 'Not found');
})();

Optional parameters

  • isInvisible: set to true when the container has data-size="invisible", or when the anchor iframe URL contains size=invisible.
  • apiDomain: set to recaptcha.net when the page loads its script from recaptcha.net instead of google.com.
  • userAgent and cookies: send them when the page ties the widget to a browser session. cookies uses the key1=val1; key2=val2 format.
  • isSession: also returns the recaptcha-ca-t session cookie in solution.cookies. Only providers that expose session cookies honor it.

Submit the token

Per Google's verification guide, a response token must be verified within two minutes, so submit the token as soon as you receive it. If the site rejects it, check that the proxy kept one IP for the whole solve, then that websiteKey and websiteURL come from the page that shows the widget.

Set the value of the g-recaptcha-response textarea, then submit the form:

document.getElementById('g-recaptcha-response').value = 'TOKEN_HERE';

If the widget has a data-callback (the demo uses onSuccess), call that function with the token instead. Pages that use grecaptcha.render() keep the callback inside window.___grecaptcha_cfg.clients; the exact path differs between pages.

Check Provider stats for live success rates and solve times before you pick a provider.

Supported Providers

ProviderPrice per 1,000Routing
CapSolver
$0.80
2Captcha
$1.00–$2.99
Anti-Captcha
$0.95–$2.00
CapMonster
$0.60
EZCaptcha
$0.60
SolveCaptcha
$0.55
Iso
$1.00
SCTG
$0.08
VoidCaptcha
$0.50

Request Schema

FieldTypeRequiredDescription
clientKey*
stringYes

Your API key. Create one in a workspace of the AnySolver dashboard.

Example: your-api-key-from-dashboard

task*
objectYes

The task body. Required fields depend on the task type. See Tasks for per-task schemas.

View task properties
settings
objectNo

Per-request settings for routing, Auto Retry, Auto Fallback, proxy reuse, response statistics and detailed analytics. Each field overrides the API key's value. See Routing modes.

View settings reference

Task Object Properties

The task field accepts an object with the following properties:

FieldTypeRequiredDescription
type*
Yes
websiteURL*
URLYes

Full URL of the page where the CAPTCHA is displayed.

Example: https://www.google.com/recaptcha/api2/demo

websiteKey*
stringYes

The sitekey found in the CAPTCHA HTML element on the target page.

Example: 6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-

pageTitle*
stringYes

Title of the target page (document.title). Send it on every task, although only a few providers read it, as an additional hint.

Example: ReCAPTCHA demo

proxy*
string | objectYes

Proxy the provider solves through, as a string or an object. See Proxy configuration.

View proxy configuration

Example: http://user:pass@1.2.3.4:8080

isInvisible
booleanNo

Set to true when the widget is invisible: the container has data-size="invisible" (or the anchor iframe URL contains size=invisible) and the challenge starts from a button click or a grecaptcha.execute() call instead of a checkbox.

Example: false

userAgent
stringNo

Browser User-Agent string. Must match the browser used on the target page. Not all providers properly support this parameter. Verify the compatibility with the provider you are using.

Example: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36

cookies
stringNo

Cookies from the target page session, if required for solving.

Example: foo=bar; baz=1

pageAction
stringNo

Action the page passes to the widget (data-action attribute or the action in grecaptcha.enterprise.execute()), such as verify or submit. Mainly relevant on enterprise flows; it must match the page exactly.

Example: verify

apiDomain
stringNo

Domain the page loads reCAPTCHA from: google.com (the default) or recaptcha.net. Set recaptcha.net when the api.js or enterprise.js script URL uses it.

Example: www.recaptcha.net

isSession
booleanNo

Session mode: also return the recaptcha-ca-t session cookie in the solution cookies, for sites that read it with the token. Only providers that expose session cookies honor it; the rest ignore it.

Example: false

{
    "clientKey": "YOUR_API_KEY",
    "task": {
        "type": "ReCaptchaV2Token",
        "websiteURL": "https://www.google.com/recaptcha/api2/demo",
        "websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
        "pageTitle": "ReCAPTCHA demo",
        "proxy": "http://user:pass@1.2.3.4:8080"
    }
}

Optional fields are not guaranteed across providers

Required fields are guaranteed across every provider that supports this task. Optional fields may be honored by some providers and silently ignored by others. AnySolver does not document per-provider parameter support, so before relying on an optional field, check that provider's own docs for the task you are using.

Response Schema

FieldTypeRequiredDescription
status*
Yes

Task status: "processing", "ready", or "failed".

Example: ready

errorId*
Yes

0 on success; 1 or 2 on an error. Branch on errorCode: Error IDs explains the two error groups.

Example: 0

taskId
stringNo

Unique identifier returned when the task was created.

Example: 01KFNDF328KAN2AJ3BNHCQYE88

errorCode
No

Machine-readable error code.

Example: CAPTCHA_UNSOLVABLE

errorDescription
stringNo

Human-readable error message with resolution hints.

Example: The captcha could not be solved.

cost
numberNo

Actual cost charged for this task in USD.

Example: 0.002

taskType
No

The type of CAPTCHA task to solve.

Example: ReCaptchaV2TokenProxyLess

provider
No

Provider that handled this task. While processing, the provider currently solving it.

Example: Multibot

solution
objectNo

Solution Object Properties

The solution field contains an object with the following properties:

FieldTypeRequiredDescription
token*
stringYes

The solved CAPTCHA token to submit with your form.

Example: 03ADUVZw...UWxTAe6ncIa

raw*
Record<string, unknown>Yes

Raw provider response data for advanced use cases.

userAgent
stringNo

User-Agent string used during solving.

cookies
Record<string, unknown>No

Session cookies obtained during solving.