ReCaptchaV3: solving reCAPTCHA v3
TIP
Create the task with the createTask method and get the result with the getTaskResult method.
The task type types
that we support:
ReCaptchaV3Task
this task type require your own proxies.ReCaptchaV3EnterpriseTask
this task type require your own proxies.ReCaptchaV3TaskProxyLess
is using the server’s built-in proxy.ReCaptchaV3EnterpriseTaskProxyLess
is using the server’s built-in proxy.
Create Task
Create a recognition task with the createTask method.
Before creating a task, you can learn the following
If you got invalid response, you can learn the following
Task Object Structure
Properties | Type | Required | Description |
---|---|---|---|
type | String | Required | ReCaptchaV3Task ReCaptchaV3TaskProxyLess |
websiteURL | String | Required | The address of website with recaptcha |
websiteKey | String | Required | Recaptcha website key |
pageAction | String | Required | Widget action value. Website owner defines what user is doing on the page through this parameter. Example: grecaptcha.execute('site_key', {action:'login}) . |
proxy | String | Optional | Learn Using proxies |
enterprisePayload | Object | Optional | Enterprise payload |
apiDomain | String | Optional | Domain address from which to load reCAPTCHA Enterprise. For example: • http://www.google.com/ • http://www.recaptcha.net/ Don’t use a parameter if you don’t know why it’s needed. |
cookies | Array | Optional | Learn Using Cookies |
Example Request
POST https://api.capsolver.com/createTask
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "ReCaptchaV3TaskProxyLess",
"websiteURL": "https://www.google.com/recaptcha/api2/demo",
"websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
"pageAction": "login",
"enterprisePayload": {
"s": "SOME_ADDITIONAL_TOKEN" //Optional
},
//Optional
"cookies": [
{
"name": "__Secure-3PSID",
"value": "AIKkIs3ch7YsxxxxYIzRqNZPGm60cdHozgwfUW1o8MF3kRcf8clJscTI6OtCqVpqNF8I88pLBJkUgQ"
},
{
"name": "__Secure-3PAPISID",
"value": "TKS1iVpGxYbxxxk0n2o/AytXQTb6RUALqxSEL"
}
],
"proxy": "ip:port:user:pass" //Optional
}
}
After you submit the task to us, you should receive in the response a ‘taskId’ if it’s successful. Please read errorCode: full list of errors if you didn’t receive the task id.
Example Response
{
"errorId": 0,
"errorCode": "",
"errorDescription": "",
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}
Getting Results
After you have the taskId, you need to submit the taskId to retrieve the solution. Response structure is explained in getTaskResult.
Depending on the system load, you will get the results within the interval of 1s
to 10s
Example Request
POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}
Example Response
{
"errorId": 0,
"errorCode": null,
"errorDescription": null,
"solution": {
"expireTime": 1671615324290, //Expiration of the token
"gRecaptchaResponse": "3AHJ....." //solution token
},
"status": "ready"
}
Use SDK Request
# pip install --upgrade capsolver
# export CAPSOLVER_API_KEY='...'
import capsolver
# capsolver.api_key = "..."
solution = capsolver.solve({
"type": "ReCaptchaV3TaskProxyLess",
"websiteURL": "https://www.google.com",
"websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_kl-",
"pageAction": "login",
})
Sample Code
# pip install requests
import requests
import time
# TODO: set your config
api_key = "YOUR_API_KEY" # your api key of capsolver
site_key = "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_kl-" # site key of your target site
site_url = "https://www.google.com" # page url of your target site
def capsolver():
payload = {
"clientKey": api_key,
"task": {
"type": 'ReCaptchaV3TaskProxyLess',
"websiteKey": site_key,
"websiteURL": site_url,
"pageAction": "login",
}
}
res = requests.post("https://api.capsolver.com/createTask", json=payload)
resp = res.json()
task_id = resp.get("taskId")
if not task_id:
print("Failed to create task:", res.text)
return
print(f"Got taskId: {task_id} / Getting result...")
while True:
time.sleep(1) # delay
payload = {"clientKey": api_key, "taskId": task_id}
res = requests.post("https://api.capsolver.com/getTaskResult", json=payload)
resp = res.json()
status = resp.get("status")
if status == "ready":
return resp.get("solution", {}).get('gRecaptchaResponse')
if status == "failed" or resp.get("errorId"):
print("Solve failed! response:", res.text)
return
token = capsolver()
print(token)