reCAPTCHAv2 Token API

Solve Google reCAPTCHAv2 token challenges with advanced image processing

Overview

The reCAPTCHAv2 Token API allows you to solve Google reCAPTCHA v2 token challenges by recognizing and selecting images based on specific categories automatically. Our advanced image processing technology can accurately analyze visual elements, helping you automate solutions for reCAPTCHAv2 challenges by providing the recaptchav2 website url and sitekey.

Endpoint

POST
/api/token/recaptcha

Request

Headers

Name Required Description
Content-Type Yes application/json
x-api-key Yes Your API key

Body Parameters

Parameter Type Required Description
websiteUrl string Yes URL of the website hosting the reCAPTCHA challenge
sitekey string Yes The reCAPTCHAv2 site key for the website

Example Request

{
  "websiteUrl": "https://www.google.com/recaptcha/api2/demo",
  "sitekey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
}

Response

Success Response (200 OK)

{
  "isSuccess": true,
  "statusCode": 200,
  "jobGuid": "e074b59b-f46d-4460-adf0-bba54eb08810"
}

Response Fields

Field Type Description
isSuccess boolean Indicates if the request was successful
statusCode number HTTP status code
jobGuid string Unique identifier for the job to check status

Check Job Status

To check the status of the job, use the following endpoint with the jobGuid from the response:

GET
/api/token/status?jobGuid={jobGuid}

Status Request Headers

Name Required Description
x-api-key Yes Your API key

Status Success Response (200 OK)

{
  "isSuccess": true,
  "statusCode": 200,
  "errorMessage": null,
  "data": {
    "status": "Completed",
    "solvingTime": 60.57,
    "token": "03AFcWeA5qOF6nOSFoLgCDRw0O9VWjZLQ...."
  }
}

Status Processing Response (200 OK)

{
  "isSuccess": true,
  "statusCode": 200,
  "errorMessage": null,
  "data": {
    "status": "Processing",
    "solvingTime": 0,
    "token": null
  }
}

Error Response

{
  "isSuccess": false,
  "statusCode": 400,
  "errorMessage": "Invalid website URL or sitekey.",
  "data": null
}

Error Codes

Status Code Message Description
400 Invalid website URL or sitekey The provided URL or sitekey is not valid
401 Unauthorized Invalid API key or not provided
403 Insufficient balance Your account has insufficient balance to process this request
500 Internal server error Something went wrong with our image processing service

Tips for Best Results

  • Website URL: Provide the exact URL of the page hosting the reCAPTCHA.
  • Sitekey: Ensure the sitekey matches the reCAPTCHAv2 instance on the website.
  • Reporting: Report any incorrect tokens to help improve our system.

How to Get reCAPTCHAv2 Sitekey

To use this API, you need to extract the sitekey from a Google reCAPTCHAv2 challenge. Here's how to do it:

  1. Locate the reCAPTCHAv2 widget: Find the reCAPTCHAv2 widget on the target website.
  2. Extract the sitekey: Using browser developer tools, inspect the reCAPTCHAv2 element and find the sitekey, typically located in a anchor attribute, like:
    anchor?ar=1&k=6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-&
    The sitekey located between "anchor?ar=1&k=" and "&"
  3. Send the URL and sitekey to our API: Use the extracted sitekey and website URL in your API request to get the token.
Ensure the website URL and sitekey are valid and correspond to the same reCAPTCHAv2 instance.

Code Examples

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

public class RecaptchaImageExample
{
    private static readonly HttpClient client = new HttpClient();
    private const string ApiUrl = "/api/token/recaptcha";
    private const string StatusUrl = "/api/token/status";
    private const string ApiKey = "YOUR_API_KEY";

    public static async Task SolveRecaptchaImage(string websiteUrl, string sitekey)
    {
        // Prepare request
        client.DefaultRequestHeaders.Add("x-api-key", ApiKey);

        var payload = new
        {
            websiteUrl = websiteUrl,
            sitekey = sitekey
        };

        var content = new StringContent(
            JsonConvert.SerializeObject(payload),
            Encoding.UTF8,
            "application/json"
        );

        // Send request
        var response = await client.PostAsync(ApiUrl, content);
        var responseString = await response.Content.ReadAsStringAsync();

        // Parse response
        dynamic result = JsonConvert.DeserializeObject(responseString);

        if (!result.isSuccess)
        {
            throw new Exception($"Error: {result.errorMessage}");
        }

        string jobGuid = result.jobGuid;

        // Poll for status
        while (true)
        {
            var statusResponse = await client.GetAsync($"{StatusUrl}?jobGuid={jobGuid}");
            var statusString = await statusResponse.Content.ReadAsStringAsync();
            dynamic statusResult = JsonConvert.DeserializeObject(statusString);

            if (!statusResult.isSuccess)
            {
                throw new Exception($"Error: {statusResult.errorMessage}");
            }

            if (statusResult.data.status == "Completed")
            {
                return statusResult.data.token;
            }

            await Task.Delay(5000); // Wait 5 seconds before polling again
        }
    }
}
import requests
import json
import time

API_URL = "/api/token/recaptcha"
STATUS_URL = "/api/token/status"
API_KEY = "YOUR_API_KEY"

def solve_recaptcha_image(website_url, sitekey):
    # Prepare headers and payload
    headers = {
        "Content-Type": "application/json",
        "x-api-key": API_KEY
    }

    payload = {
        "websiteUrl": website_url,
        "sitekey": sitekey
    }

    # Make request
    response = requests.post(API_URL, headers=headers, json=payload)
    result = response.json()

    if not result["isSuccess"]:
        raise Exception(f"Error: {result['errorMessage']}")

    job_guid = result["jobGuid"]

    # Poll for status
    while True:
        status_response = requests.get(f"{STATUS_URL}?jobGuid={job_guid}", headers={"x-api-key": API_KEY})
        status_result = status_response.json()

        if not status_result["isSuccess"]:
            raise Exception(f"Error: {status_result['errorMessage']}")

        if status_result["data"]["status"] == "Completed":
            return status_result["data"]["token"]

        time.sleep(5)  # Wait 5 seconds before polling again

# Example usage
try:
    website_url = "https://www.google.com/recaptcha/api2/demo"
    sitekey = "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
    token = solve_recaptcha_image(website_url, sitekey)
    print(f"reCAPTCHA solved: {token}")
except Exception as e:
    print(str(e))
// reCAPTCHA Image Solving Example

async function solveRecaptchaImage(websiteUrl, sitekey) {
  const API_URL = "/api/token/recaptcha";
  const STATUS_URL = "/api/token/status";
  const API_KEY = "YOUR_API_KEY";

  // Prepare request
  const payload = {
    websiteUrl: websiteUrl,
    sitekey: sitekey
  };

  // Send request
  const response = await fetch(API_URL, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': API_KEY
    },
    body: JSON.stringify(payload)
  });

  const result = await response.json();

  if (!result.isSuccess) {
    throw new Error(`Error: ${result.errorMessage}`);
  }

  const jobGuid = result.jobGuid;

  // Poll for status
  while (true) {
    const statusResponse = await fetch(`${STATUS_URL}?jobGuid=${jobGuid}`, {
      headers: {
        'x-api-key': API_KEY
      }
    });
    const statusResult = await statusResponse.json();

    if (!statusResult.isSuccess) {
      throw new Error(`Error: ${statusResult.errorMessage}`);
    }

    if (statusResult.data.status === 'Completed') {
      return statusResult.data.token;
    }

    await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds
  }
}

// Example of extracting sitekey from reCAPTCHA
function extractRecaptchaSitekey() {
  const recaptchaElement = document.querySelector('[data-sitekey]');
  if (recaptchaElement && recaptchaElement.dataset.sitekey) {
    return recaptchaElement.dataset.sitekey;
  }
  throw new Error('No reCAPTCHA sitekey found');
}

// Example usage
async function handleRecaptchaImage() {
  try {
    const websiteUrl = window.location.href;
    const sitekey = extractRecaptchaSitekey();
    const token = await solveRecaptchaImage(websiteUrl, sitekey);
    console.log(`reCAPTCHA solved: ${token}`);

    // Use the solved reCAPTCHA in your form
    document.getElementById('g-recaptcha-response').value = token;
  } catch (error) {
    console.error(error.message);
  }
}