API Tutorials

How to Solve reCAPTCHA v2 Enterprise with Python

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.js or 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)

No comments yet.

Related Posts

Reference CAPTCHA Token Injection Methods Reference
Complete reference for injecting solved CAPTCHA tokens into web pages.

Complete reference for injecting solved CAPTCHA tokens into web pages. Covers re CAPTCHA, Turnstile, and Cloud...

Python Automation Cloudflare Turnstile
Apr 08, 2026
Explainers reCAPTCHA v2 Invisible: Trigger Detection and Solving
Detect and solve re CAPTCHA v 2 Invisible challenges with Captcha AI — identify triggers, extract parameters, and handle auto-invoked CAPTCHAs.

Detect and solve re CAPTCHA v 2 Invisible challenges with Captcha AI — identify triggers, extract parameters,...

Python Automation reCAPTCHA v2
Apr 07, 2026
Tutorials Pytest Fixtures for CaptchaAI API Testing
Build reusable pytest fixtures to test CAPTCHA-solving workflows with Captcha AI.

Build reusable pytest fixtures to test CAPTCHA-solving workflows with Captcha AI. Covers mocking, live integra...

Python Automation Cloudflare Turnstile
Apr 08, 2026
Troubleshooting ERROR_PAGEURL: URL Mismatch Troubleshooting Guide
Fix ERROR_PAGEURL when using Captcha AI.

Fix ERROR_PAGEURL when using Captcha AI. Diagnose URL mismatch issues, handle redirects, SPAs, and dynamic URL...

Python Automation Cloudflare Turnstile
Mar 23, 2026
Tutorials CAPTCHA Solving Fallback Chains
Implement fallback chains for CAPTCHA solving with Captcha AI.

Implement fallback chains for CAPTCHA solving with Captcha AI. Cascade through solver methods, proxy pools, an...

Python Automation Cloudflare Turnstile
Apr 06, 2026
Troubleshooting Handling reCAPTCHA v2 and Cloudflare Turnstile on the Same Site
Solve both re CAPTCHA v 2 and Cloudflare Turnstile on sites that use multiple CAPTCHA providers — detect which type appears, solve each correctly, and handle pr...

Solve both re CAPTCHA v 2 and Cloudflare Turnstile on sites that use multiple CAPTCHA providers — detect which...

Python Automation Cloudflare Turnstile
Mar 23, 2026
Tutorials Build an Automated Testing Pipeline with CaptchaAI
Build a CI/CD testing pipeline that uses Captcha AI to handle CAPTCHAs in end-to-end tests.

Build a CI/CD testing pipeline that uses Captcha AI to handle CAPTCHAs in end-to-end tests. Covers pytest inte...

Python Automation reCAPTCHA v2
Jan 16, 2026
Use Cases Multi-Step Workflow Automation with CaptchaAI
Manage workflows across multiple accounts on CAPTCHA-protected platforms — , action, and data collection at scale.

Manage workflows across multiple accounts on CAPTCHA-protected platforms — , action, and data collection at sc...

Python Automation Cloudflare Turnstile
Apr 06, 2026
Tutorials Batch reCAPTCHA Solving for Form Submission Pipelines
How to build a pipeline that solves re CAPTCHA v 2 for multiple form submissions — pre-solve tokens, manage token freshness, handle form validation, and process...

How to build a pipeline that solves re CAPTCHA v 2 for multiple form submissions — pre-solve tokens, manage to...

Python Automation reCAPTCHA v2
Mar 30, 2026
Integrations Solving CAPTCHAs in React Native WebViews with CaptchaAI
how to detect and solve re CAPTCHA v 2 and Cloudflare Turnstile CAPTCHAs inside React Native Web Views using the Captcha AI API with working Java Script bridge...

Learn how to detect and solve re CAPTCHA v 2 and Cloudflare Turnstile CAPTCHAs inside React Native Web Views u...

Python Automation Cloudflare Turnstile
Mar 30, 2026
API Tutorials Case-Sensitive CAPTCHA API Parameter Guide
How to use the regsense parameter for case-sensitive CAPTCHA solving with Captcha AI.

How to use the regsense parameter for case-sensitive CAPTCHA solving with Captcha AI. Covers when to use, comm...

Python Web Scraping Image OCR
Apr 09, 2026
API Tutorials Graceful Degradation When CAPTCHA Solving Fails
Keep your automation running when CAPTCHA solving fails — fallback strategies, queue-based retries, and degraded-mode patterns.

Keep your automation running when CAPTCHA solving fails — fallback strategies, queue-based retries, and degrad...

Python Automation All CAPTCHA Types
Apr 06, 2026
API Tutorials Solving CAPTCHAs with Swift and CaptchaAI API
Complete guide to solving re CAPTCHA, Turnstile, and image CAPTCHAs in Swift using Captcha AI's HTTP API with URLSession, async/await, and Alamofire.

Complete guide to solving re CAPTCHA, Turnstile, and image CAPTCHAs in Swift using Captcha AI's HTTP API with...

Automation Cloudflare Turnstile reCAPTCHA v2
Apr 05, 2026