CAPSOLVER
Blog
Solve reCaptcha v2

Solving reCaptcha v2 with CapSolver API

Logo of CapSolver

Rajinder Singh

Deep Learning Researcher

18-May-2023

Introduction

reCAPTCHA v2 is widely used to protect websites from automated abuse, but it often becomes a major obstacle for legitimate automation, testing, and data collection workflows. If you are struggling to solve reCAPTCHA v2 programmatically, this guide will walk you through a reliable and efficient solution using the CapSolver API.

In this tutorial, you will learn how to create and submit a reCAPTCHA v2 solving task, retrieve the solution token, and integrate CapSolver into your workflow using both Python and Go. You can choose between using your own proxies with ReCaptchaV2Task or relying on CapSolver’s built-in proxy via ReCaptchaV2TaskProxyLess.


Overview: Solving reCAPTCHA v2 with CapSolver

CapSolver provides a simple API-based approach to solve reCAPTCHA v2 challenges by:

  1. Creating a task with the required website parameters
  2. Submitting the task to CapSolver
  3. Polling for the result
  4. Receiving a valid gRecaptchaResponse token

This token can then be injected into your target request or browser automation flow.


Creating a Task

To solve reCaptcha v2, you first need to create a task using the createTask method.

Here's the structure of the task object:

  • type: Required. This should be ReCaptchaV2Task or ReCaptchaV2TaskProxyLess.
  • websiteURL: Required. This is the web address of the website using reCaptcha v2.
  • websiteKey: Required. This is the domain's public key.
  • proxy: Optional. If you're using a proxy, you can include it here.
  • isInvisible: Optional. If the reCaptcha doesn't have pageAction, set this to true.
  • userAgent: Optional. If you're emulating a browser, include its User-Agent here.
  • cookies: Optional. If you need to use cookies, include them here.

Here's an example request:

json Copy
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "ReCaptchaV2Task",
    "websiteURL": "site",
    "websiteKey": "site key",
    "isInvisible": false,
    "userAgent": "",
    "cookies": [
      {
        "name": "__Secure-3PSID",
        "value": "sdadasdasdsda"
      },
      {
        "name": "__Secure-3PAPISID",
        "value": "sd/AytXQTb6RUALqxSEL"
      }
    ],
    "proxy": ""
  }
}

Once the task is successfully submitted, you'll receive a Task ID in the response:

JSON Copy
{
    "errorId": 0,
    "errorCode": "",
    "errorDescription": "",
    "taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}

Getting Results

Once you have the Task ID, you can use it to retrieve the solution. Submit the Task ID with the getTaskResult method. The results should be ready within an interval of 1s to 10s.

Here's an example request:

json Copy
{
    "clientKey": "YOUR_API_KEY",
    "taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}

The response will include the solution token:

json Copy
{
    "errorId": 0,
    "errorCode": null,
    "errorDescription": null,
    "solution": {
        "userAgent": "xxx", 
        "expireTime": 1671615324290, 
        "gRecaptchaResponse": "3AHJ....." // This is the solution token
    },
    "status": "ready"
}

Solve reCaptcha v2 with Python:

python Copy
# Install the CapSolver SDK
# pip install --upgrade capsolver

# Set the CapSolver API key
# export CAPSOLVER_API_KEY='YOUR_API_KEY'

import capsolver
# capsolver.api_key = 'YOUR_API_KEY'

# Solve a reCAPTCHA v2 challenge
solution = capsolver.solve({
    "type": "ReCaptchaV2TaskProxyLess",
    "websiteURL": "site url",
    "websiteKey": "site key",
})

Solve reCaptcha v2 with GO:

GO Copy
package main

import (
    "fmt"
    capsolver_go "github.com/capsolver/capsolver-go"
    "log"
)

func main() {
    // Install the CapSolver SDK
    // go get github.com/capsolver/capsolver-go

    // Set the CapSolver API key
    // export CAPSOLVER_API_KEY='YOUR_API_KEY'
    // or
    // capSolver := CapSolver{apiKey:"YOUR_API_KEY"}

    capSolver := capsolver_go.CapSolver{}
    solution, err := capSolver.Solve(map[string]any{
        "type": "ReCaptchaV2TaskProxyLess",
        "websiteURL": "https://www.google.com/recaptcha/api2/demo",
        "websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
    })
    if err != nil {
        log.Fatal(err)
        return
    }
    fmt.Println(solution)
}

Please replace YOUR_API_KEY with your actual CapSolver API key, and replace the websiteURL and websiteKey with the actual website URL and website key for the reCAPTCHA challenge you are trying to solve

Pricing

For detailed pricing information, please visit the official CapSolver pricing page:
https://www.capsolver.com/#pricing


Additional Resources

For more in-depth documentation on solving reCAPTCHA v2, refer to:
https://docs.capsolver.com/en/guide/recognition/ReCaptchaClassification/

Redeem Your CapSolver Bonus Code

Boost your automation budget instantly!
Use bonus code CAPN when topping up your CapSolver account to get an extra 5% bonus on every recharge — with no limits.
Redeem it now in your CapSolver Dashboard
.


Conclusion

Solving reCAPTCHA v2 does not have to be complex or unreliable. With CapSolver, you can automate the entire process using a straightforward API that supports both proxy-based and proxyless solutions. By following the steps outlined in this guide—creating a task, retrieving the result, and integrating the solution token—you can efficiently bypass reCAPTCHA v2 in automation, testing, and data extraction scenarios.


FAQs

1. What is the difference between ReCaptchaV2Task and ReCaptchaV2TaskProxyLess?

ReCaptchaV2Task requires you to provide your own proxy, while ReCaptchaV2TaskProxyLess uses CapSolver’s built-in proxy, making setup faster and simpler.

2. How long does it take to solve a reCAPTCHA v2 challenge?

Most tasks are completed within 1 to 10 seconds, depending on challenge complexity and system load.

3. Is the gRecaptchaResponse token reusable?

No. The token is time-limited and typically valid for a single verification attempt. Always request a new token for each reCAPTCHA challenge.

4. Do I need a browser to use CapSolver?

No. CapSolver works entirely via API and can be integrated into backend services, scripts, or automation frameworks without launching a browser.

Compliance Disclaimer: The information provided on this blog is for informational purposes only. CapSolver is committed to compliance with all applicable laws and regulations. The use of the CapSolver network for illegal, fraudulent, or abusive activities is strictly prohibited and will be investigated. Our captcha-solving solutions enhance user experience while ensuring 100% compliance in helping solve captcha difficulties during public data crawling. We encourage responsible use of our services. For more information, please visit our Terms of Service and Privacy Policy.

More