Logo of «GitHub»
  • 我们支持 «PHP» 语言的API
  • 我们支持 «Python» 语言的API
  • 我们支持 «Go» 语言的API
  • 我们支持 «Ruby» 语言的API
  • 我们支持 «C#» 语言的API
  • 我们支持 «Java» 语言的API
  • 我们支持 «JavaScript» 语言的API

reCAPTCHA V3 / reCAPTCHA V3 Enterprise

reCAPTCHA V3 widget

Token-based method for automated solving of reCAPTCHA V3.

The token recived then can be sent to the target website inside g-recaptcha-response form field or passed to a callback function.

Task type: RecaptchaV3TaskProxyless

RecaptchaV3TaskProxyless task type specification

Property Type Required Description
type String Yes Task type:
RecaptchaV3TaskProxyless
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
minScore Float Yes Required score value:
0.3
0.7
0.9
pageAction String No Action parameter value. The value is set by website owner inside data-action property of the reCAPTCHA div element or passed inside options object of execute method call, like grecaptcha.execute('websiteKey'{ action: 'myAction' })
isEnterprise Boolean No Pass true for Enterprise version of reCAPTCHA. You can identify it by enterprise.js script used instead of api.js or by grecaptcha.enterprise.execute call used instead of grecaptcha.execute
apiDomain String No Domain used to load the captcha: google.com or recaptcha.net. Default value: google.com

Request example

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

{
    "clientKey":"YOUR_API_KEY",
    "task": {
        "type": "RecaptchaV3TaskProxyless",
        "websiteURL": "https://2captcha.cn/demo/recaptcha-v3",
        "websiteKey": "6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu",
        "minScore": 0.9,
        "pageAction": "test",
        "isEnterprise": false,
        "apiDomain": "www.recaptcha.net"
    }
}

Response example

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

{
    "errorId": 0,
    "status": "ready",
    "solution": {
        "gRecaptchaResponse": "03ADUVZwB7eLoqnBxvi5H...kA4Si3qH0rR0g",
        "token": "03ADUVZwB7eLoqnBxvi5H...kA4Si3qH0rR0g"
    },
    "cost": "0.00299",
    "ip": "1.2.3.4",
    "createTime": 1692863536,
    "endTime": 1692863556,
    "solveCount": 1
}

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' => '6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu',
        'url'     => 'https://2captcha.cn/demo/recaptcha-v3',
        'version' => 'v3',
        'action'  => 'test',
    ]);
} 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='6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu',
        url='https://2captcha.cn/demo/recaptcha-v3',
        version='v3',
        action='test')

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 reCAPTCHAV3Example
    {
        public void Main()
        {
            TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
            ReCaptcha captcha = new ReCaptcha();
            captcha.SetSiteKey("6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu");
            captcha.SetUrl("https://2captcha.cn/demo/recaptcha-v3");
            captcha.SetVersion("v3");
            captcha.SetAction("test");
            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 reCAPTCHAV3Example {
    public static void main(String[] args) {
        TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
        ReCaptcha captcha = new ReCaptcha();
        captcha.setSiteKey("6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu");
        captcha.setUrl("https://2captcha.cn/demo/recaptcha-v3");
        captcha.setVersion("v3");
        captcha.setAction("test");
        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")
    captcha := api2captcha.ReCaptcha{
        SiteKey: "6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu",
        Url: "https://2captcha.cn/demo/recaptcha-v3",
        Version: "v3",
        Action: "verify"
    } 
    code, err := client.Solve(captcha.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_v3({
  googlekey: '6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu',
  pageurl: 'https://2captcha.cn/demo/recaptcha-v3',
  version: 'v3',
  score: 0.9
})