
Rajinder Singh
Deep Learning Researcher

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.
CapSolver provides a simple API-based approach to solve reCAPTCHA v2 challenges by:
gRecaptchaResponse tokenThis token can then be injected into your target request or browser automation flow.
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:
{
"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:
{
"errorId": 0,
"errorCode": "",
"errorDescription": "",
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}
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:
{
"clientKey": "YOUR_API_KEY",
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}
The response will include the solution token:
{
"errorId": 0,
"errorCode": null,
"errorDescription": null,
"solution": {
"userAgent": "xxx",
"expireTime": 1671615324290,
"gRecaptchaResponse": "3AHJ....." // This is the solution token
},
"status": "ready"
}
# 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",
})
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
For detailed pricing information, please visit the official CapSolver pricing page:
https://www.capsolver.com/#pricing
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
.
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.
ReCaptchaV2Task and ReCaptchaV2TaskProxyLess?ReCaptchaV2Task requires you to provide your own proxy, while ReCaptchaV2TaskProxyLess uses CapSolver’s built-in proxy, making setup faster and simpler.
Most tasks are completed within 1 to 10 seconds, depending on challenge complexity and system load.
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.
No. CapSolver works entirely via API and can be integrated into backend services, scripts, or automation frameworks without launching a browser.
Understand reCAPTCHA v3 score range (0.0 to 1.0), its meaning, and how to improve your score. Learn how to handle low scores and optimize user experience.

Facing "reCAPTCHA Invalid Site Key" or "invalid reCAPTCHA token" errors? Discover common causes, step-by-step fixes, and troubleshooting tips to resolve reCAPTCHA verification failed issues. Learn how to fix reCAPTCHA verification failed please try again.
