Cookie usage notification

This site uses cookies. Cookies remember you, so we can provide you with personalized services. Read our privacy policy.

Logo of «GitHub»
  • We support API for «PHP» language
  • We support API for «Python» language
  • We support API for «Go» language
  • We support API for «Ruby» language
  • We support API for «C#» language
  • We support API for «Java» language
  • We support API for «JavaScript» language

reCAPTCHA V2 Enterprise

reCAPTCHA V2 Enterprise widget

Token-based method for automated solving of reCAPTCHA V2 Enterprise.

The token recived then can be sent to the target website inside g-recaptcha-response form field or passed to a callback function. The method is the same as reCAPTCHA V2, but reCAPTCHA Enterprise API is used to load the captchas.

Task types

  • RecaptchaV2EnterpriseTaskProxyless - suitable for most cases. We use our own pool of proxies to solve the captchas
  • RecaptchaV2EnterpriseTask - used for cases when IP matching is requied on Google service like Google Search, YouTube, etc. Bad proxies will drastically decrease the success rate and increase the solving time.

RecaptchaV2EnterpriseTaskProxyless task type specification

Property Type Required Description
type String Yes Task type:
RecaptchaV2EnterpriseTaskProxyless
RecaptchaV2EnterpriseTask
websiteURL String Yes The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users
websiteKey String Yes reCAPTCHA sitekey. Can be found inside data-sitekey property of the reCAPTCHA div element or inside k parameter of the requests to reCAPTHCHA API. You can also use the script to find the value
enterprisePayload Object No Additional parameters passed to grecaptcha.enterprise.render call. For example, there can be an object containing s value
isInvisible Boolean No Pass true for Invisible version of reCAPTCHA - a case when you don't see the checkbox, but the challenge appears. Mostly used with a callback function
userAgent String No User-Agent of your browser will be used to load the captcha. Use only modern browser's User-Agents
cookies String No Your cookies will be set in a browser of our worker. Suitable for captcha on Google services. The format is: key1=val1; key2=val2
apiDomain String No Domain used to load the captcha: google.com or recaptcha.net. Default value: google.com

RecaptchaV2EnterpriseTask task type specification

RecaptchaV2EnterpriseTask extends RecaptchaV2EnterpriseTaskProxyless adding a set of proxy-related parameters listed below

Property Type Required Description
proxyType String Yes Proxy type:
http
socks4
socks5
proxyAddress String Yes Proxy IP address or hostname
proxyPort Integer Yes Proxy port
proxyLogin String No Login for basic authentication on the proxy
proxyPassword String No Password for basic authentication on the proxy

Request examples

Method: createTask
API endpoint: https://api.2captcha.com/createTask

RecaptchaV2EnterpriseTaskProxyless

{
    "clientKey":"YOUR_API_KEY",
    "task": {
        "type":"RecaptchaV2EnterpriseTaskProxyless",
        "websiteURL":"https://2captcha.com/demo/recaptcha-v2-enterprise",
        "websiteKey":"6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u",
        "isInvisible":false
    }
}

RecaptchaV2Task

{
    "clientKey":"YOUR_API_KEY",
    "task": {
        "type":"RecaptchaV2EnterpriseTask",
        "websiteURL":"https://2captcha.com/demo/recaptcha-v2-enterprise",
        "websiteKey":"6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u",
        "isInvisible":false,
        "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",
        "cookies":"foo=bar; baz=1",
        "proxyType":"http",
        "proxyAddress":"1.2.3.4",
        "proxyPort":"8080",
        "proxyLogin":"user23",
        "proxyPassword":"p4$w0rd"
    }
}

Response example

{
    "errorId": 0,
    "status": "ready",
    "solution": {
        "gRecaptchaResponse": "03ADUVZw...UWxTAe6ncIa",
        "token": "03ADUVZw...UWxTAe6ncIa"
    },
    "cost": "0.00299",
    "ip": "1.2.3.4",
    "createTime": 1692863536,
    "endTime": 1692863556
}

Code examples

// https://github.com/2captcha/2captcha-php

require(__DIR__ . '/../src/autoloader.php');

$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');

try {
    $result = $solver->recaptcha([
        'sitekey' => '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u',
        'url'     => 'https://2captcha.com/demo/recaptcha-v2-enterprise-enterprise',
        'enterprise' => 1,
    ]);
} catch (\Exception $e) {
    die($e->getMessage());
}

die('Captcha solved: ' . $result->code);
# https://github.com/2captcha/2captcha-python

import sys
import os

sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

from twocaptcha import TwoCaptcha

api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')

solver = TwoCaptcha(api_key)

try:
    result = solver.recaptcha(
        sitekey='6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u',
        url='https://2captcha.com/demo/recaptcha-v2-enterprise',
        enterprise=1)

except Exception as e:
    sys.exit(e)

else:
    sys.exit('solved: ' + str(result))
// https://github.com/2captcha/2captcha-csharp

using System;
using System.Linq;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Examples
{
    public class reCAPTCHAV2EnterpriseExample
    {
        public void Main()
        {
            TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
            ReCaptcha captcha = new ReCaptcha();
            captcha.SetSiteKey("6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u");
            captcha.SetUrl("https://2captcha.com/demo/recaptcha-v2-enterprise");
            captcha.setEnterprise(true);
            try
            {
                solver.Solve(captcha).Wait();
                Console.WriteLine("Captcha solved: " + captcha.Code);
            }
            catch (AggregateException e)
            {
                Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
            }
        }
    }
}
// https://github.com/2captcha/2captcha-java

package examples;

import com.twocaptcha.TwoCaptcha;
import com.twocaptcha.captcha.reCAPTCHA;

public class reCAPTCHAV2EnterpriseExample {
    public static void main(String[] args) {
        TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
        ReCaptcha captcha = new ReCaptcha();
        captcha.setSiteKey("6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u");
        captcha.setUrl("https://2captcha.com/demo/recaptcha-v2-enterprise");
        captcha.setEnterprise(true);
        try {
            solver.solve(captcha);
            System.out.println("Captcha solved: " + captcha.getCode());
        } catch (Exception e) {
            System.out.println("Error occurred: " + e.getMessage());
        }
    }

}
// https://github.com/2captcha/2captcha-go

package main

import (
    "fmt"
    "log"
    "github.com/2captcha/2captcha-go"
)

func main() {
    client := api2captcha.NewClient("API_KEY")
    cap := api2captcha.ReCaptcha{
        SiteKey: "6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u",
        Url: "https://2captcha.com/demo/recaptcha-v2-enterprise",
        Enterprise: true,
    } 
    code, err := client.Solve(cap.ToRequest())
    if err != nil {
        log.Fatal(err);
    }
    fmt.Println("code "+code)
}
# https://github.com/2captcha/2captcha-ruby

require 'api_2captcha'

client =  Api2Captcha.new("YOUR_API_KEY")

result = client.recaptcha_v2({
  googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u',
  pageurl: 'https://2captcha.com/demo/recaptcha-v2-enterprise',
  enterprise: 1
})