reCAPTCHA v2 Enterprise uses Google's enterprise-grade risk scoring on top of the standard "I'm not a robot" checkbox. It looks identical to standard v2, but token verification goes through recaptchaenterprise.googleapis.com and enforces stricter validation. CaptchaAI solves it by adding enterprise=1 to a standard v2 request.
This guide walks through the full Python implementation — from extracting the sitekey to injecting the solved token.
What you need
| Requirement | Details |
|---|---|
| CaptchaAI API key | captchaai.com |
| Python 3.7+ | With requests installed |
| Sitekey | From the Enterprise anchor URL (k= parameter) |
| Page URL | Full URL where the CAPTCHA appears |
| Action (optional) | From the sa= parameter in the anchor URL |
Install the dependency:
pip install requests
Step 1: Identify reCAPTCHA v2 Enterprise
Open browser DevTools on the target page and look for the Enterprise anchor request:
https://www.google.com/recaptcha/enterprise/anchor?ar=1&k=6LdxxXXxAAAAAAcX...&sa=LOGIN&...
Key indicators:
- The script loads from
/recaptcha/enterprise.jsor the anchor URL contains/enterprise/anchor - The
k=parameter is the sitekey - The
sa=parameter (if present) is the action
If you see /recaptcha/api2/anchor instead, it is standard v2, not Enterprise.
Step 2: Submit the task to CaptchaAI
import requests
import time
API_KEY = "YOUR_API_KEY"
# Step 1: Submit the captcha task
submit_response = requests.post("https://ocr.captchaai.com/in.php", data={
"key": API_KEY,
"method": "userrecaptcha",
"googlekey": "6LdxxXXxAAAAAAcXxxXxxX91xxxxxxxx8xxOx7A",
"pageurl": "https://example.com/login",
"enterprise": 1,
"action": "LOGIN", # optional — from sa= in anchor URL
"json": 1
})
submit_data = submit_response.json()
if submit_data.get("status") != 1:
raise RuntimeError(f"Submit failed: {submit_data.get('request')}")
task_id = submit_data["request"]
print(f"Task submitted. ID: {task_id}")
Step 3: Poll for the result
Wait 15–20 seconds before the first poll, then check every 5 seconds:
# Step 2: Poll for the result
time.sleep(20)
for attempt in range(30):
result = requests.get("https://ocr.captchaai.com/res.php", params={
"key": API_KEY,
"action": "get",
"id": task_id,
"json": 1
}).json()
if result.get("status") == 1:
token = result["request"]
user_agent = result.get("user_agent", "")
print(f"Solved. Token: {token[:60]}...")
if user_agent:
print(f"User-Agent: {user_agent}")
break
if result.get("request") != "CAPCHA_NOT_READY":
raise RuntimeError(f"Solve failed: {result['request']}")
print(f"Attempt {attempt + 1}: not ready, waiting 5s...")
time.sleep(5)
else:
raise TimeoutError("Captcha was not solved within the timeout period")
Step 4: Inject the token
Submit the solved token as g-recaptcha-response in your form POST. If the API returned a user_agent, use it in your request headers:
# Step 3: Submit the token to the target site
session = requests.Session()
if user_agent:
session.headers.update({"User-Agent": user_agent})
response = session.post("https://example.com/api/login", data={
"username": "user",
"password": "pass",
"g-recaptcha-response": token
})
print(f"Response status: {response.status_code}")
Complete working script
import requests
import time
API_KEY = "YOUR_API_KEY"
SITE_KEY = "6LdxxXXxAAAAAAcXxxXxxX91xxxxxxxx8xxOx7A"
PAGE_URL = "https://example.com/login"
ACTION = "LOGIN" # optional — omit if not present in anchor URL
def solve_recaptcha_v2_enterprise():
"""Solve reCAPTCHA v2 Enterprise and return the token."""
# Submit task
submit = requests.post("https://ocr.captchaai.com/in.php", data={
"key": API_KEY,
"method": "userrecaptcha",
"googlekey": SITE_KEY,
"pageurl": PAGE_URL,
"enterprise": 1,
"action": ACTION,
"json": 1
}).json()
if submit.get("status") != 1:
raise RuntimeError(f"Submit error: {submit.get('request')}")
task_id = submit["request"]
print(f"Task ID: {task_id}")
# Poll for result
time.sleep(20)
for _ in range(30):
result = requests.get("https://ocr.captchaai.com/res.php", params={
"key": API_KEY, "action": "get", "id": task_id, "json": 1
}).json()
if result.get("status") == 1:
return result["request"], result.get("user_agent", "")
if result.get("request") != "CAPCHA_NOT_READY":
raise RuntimeError(f"Solve error: {result['request']}")
time.sleep(5)
raise TimeoutError("Solve timed out")
if __name__ == "__main__":
token, ua = solve_recaptcha_v2_enterprise()
print(f"Token: {token[:60]}...")
if ua:
print(f"User-Agent: {ua}")
Expected output:
Task ID: 73849562810
Token: 03AGdBq24PBCqLmOx2V4...
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)...
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
ERROR_WRONG_USER_KEY |
Invalid API key format | Check key is 32 characters from your dashboard |
ERROR_KEY_DOES_NOT_EXIST |
Key not found | Verify key at captchaai.com |
ERROR_ZERO_BALANCE |
Insufficient balance | Top up your account |
ERROR_BAD_TOKEN_OR_PAGEURL |
Wrong sitekey or URL | Extract correct k= and page URL from the Enterprise anchor |
ERROR_CAPTCHA_UNSOLVABLE |
Could not solve | Verify sitekey, try again, check if truly Enterprise |
| Token rejected by site | User-Agent mismatch | Use the user_agent from the solve response in your requests |
FAQ
How do I tell if a site uses v2 Enterprise vs standard v2?
Look for /recaptcha/enterprise/ in the script URL or anchor request. Standard v2 uses /recaptcha/api2/.
Do I need the action parameter?
Only if the anchor URL includes sa=. If not present, omit it from your request.
Why should I use the solver's User-Agent?
Enterprise v2 tokens are often bound to the User-Agent used during solving. Submitting with a different User-Agent can cause the token to fail verification.
What is the typical solve time?
15–30 seconds depending on server load and challenge complexity.
Can I use a proxy for Enterprise v2?
Yes. Add proxy=user:pass@host:port and proxytype=HTTP to your submit request for better success rates on geo-restricted sites.
Start solving reCAPTCHA v2 Enterprise
Get your API key at captchaai.com and add enterprise=1 to your v2 requests.
Discussions (0)
Join the conversation
Sign in to share your opinion.
Sign InNo comments yet.