reCAPTCHA Enterprise
Enterprise-grade reCAPTCHA with advanced security features
Overview
reCAPTCHA Enterprise is Google's premium CAPTCHA solution designed for businesses requiring advanced bot detection and risk analysis. It combines the features of v2 and v3 with additional security layers and detailed analytics.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
type | string | Yes | Must be "recaptcha_enterprise" |
websiteKey | string | Yes | The Enterprise site key |
websiteUrl | string | Yes | Full URL of the page |
additionalData.pageAction | string | No | Action parameter found in grecaptcha.execute |
additionalData.isInvisible | boolean | No | For invisible reCAPTCHA (no checkbox) |
additionalData.enterprisePayload | object | No | S parameter in grecaptcha.enterprise.render |
additionalData.apiDomain | string | No | Domain to load CAPTCHA: google.com or recaptcha.net |
additionalData.proxy | object | No | Proxy configuration |
Code Examples
# Submit CAPTCHA task
curl -X POST https://api.ai4cap.com/api/captcha/solve \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "recaptcha_enterprise",
"websiteKey": "6Lc3fLwUAAAAAKpuMzGGnimGiI-kJ7lfO3PtLPez",
"websiteUrl": "https://enterprise.example.com",
"additionalData": {
"pageAction": "login",
"isInvisible": true,
"enterprisePayload": {
"s": "SOME_ADDITIONAL_TOKEN"
}
}
}'
# Response
{
"success": true,
"taskId": "ent456def789"
}
# Get result
curl -X GET https://api.ai4cap.com/api/captcha/result/ent456def789 \
-H "X-API-Key: YOUR_API_KEY"
# Response when solved
{
"errorId": 0,
"status": "ready",
"solution": {
"gRecaptchaResponse": "03AGdBq26gJ8jc..."
},
"cost": "0.020000",
"solveTime": 15000
}
import requests
import time
API_KEY = "YOUR_API_KEY"
API_URL = "https://api.ai4cap.com/api"
def solve_recaptcha_enterprise(site_key, page_url, page_action=None, is_invisible=False, enterprise_payload=None):
# Submit task
request_data = {
"type": "recaptcha_enterprise",
"websiteKey": site_key,
"websiteUrl": page_url
}
additional_data = {}
if page_action:
additional_data["pageAction"] = page_action
if is_invisible:
additional_data["isInvisible"] = is_invisible
if enterprise_payload:
additional_data["enterprisePayload"] = enterprise_payload
if additional_data:
request_data["additionalData"] = additional_data
response = requests.post(
f"{API_URL}/captcha/solve",
headers={"X-API-Key": API_KEY},
json=request_data
)
task_id = response.json()["taskId"]
# Poll for result
for _ in range(40): # Max 80 seconds for Enterprise
result = requests.get(
f"{API_URL}/captcha/result/{task_id}",
headers={"X-API-Key": API_KEY}
)
data = result.json()
if data.get("errorId", 0) != 0:
raise Exception(f"Task failed: {data.get('errorDescription', 'Unknown error')}")
if data["status"] == "ready":
return data["solution"]["gRecaptchaResponse"]
time.sleep(2)
raise Exception("Timeout waiting for solution")
# Example usage
solution = solve_recaptcha_enterprise(
"6Lc3fLwUAAAAAKpuMzGGnimGiI-kJ7lfO3PtLPez",
"https://enterprise.example.com",
page_action="login",
is_invisible=True,
enterprise_payload={"s": "SOME_ADDITIONAL_TOKEN"}
)
print(f"Token: {solution}")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const API_URL = 'https://api.ai4cap.com/api';
async function solveReCaptchaEnterprise(siteKey, pageUrl, options = {}) {
try {
// Build request data
const requestData = {
type: 'recaptcha_enterprise',
websiteKey: siteKey,
websiteUrl: pageUrl
};
const additionalData = {};
if (options.pageAction) {
additionalData.pageAction = options.pageAction;
}
if (options.isInvisible) {
additionalData.isInvisible = options.isInvisible;
}
if (options.enterprisePayload) {
additionalData.enterprisePayload = options.enterprisePayload;
}
if (Object.keys(additionalData).length > 0) {
requestData.additionalData = additionalData;
}
// Submit task
const submitResponse = await axios.post(
`${API_URL}/captcha/solve`,
requestData,
{
headers: { 'X-API-Key': API_KEY }
}
);
const taskId = submitResponse.data.taskId;
// Poll for result
for (let i = 0; i < 40; i++) { // Max 80 seconds
const resultResponse = await axios.get(
`${API_URL}/captcha/result/${taskId}`,
{
headers: { 'X-API-Key': API_KEY }
}
);
const data = resultResponse.data;
if (data.status === 'solved') {
return data.solution;
} else if (data.status === 'failed') {
throw new Error(`Task failed: ${data.error || 'Unknown error'}`);
}
await new Promise(resolve => setTimeout(resolve, 2000));
}
throw new Error('Timeout waiting for solution');
} catch (error) {
console.error('Error solving CAPTCHA:', error.message);
throw error;
}
}
// Example usage
(async () => {
try {
const solution = await solveReCaptchaEnterprise(
'6Lc3fLwUAAAAAKpuMzGGnimGiI-kJ7lfO3PtLPez',
'https://enterprise.example.com',
{ s: 'SOME_ADDITIONAL_TOKEN' }
);
console.log('Token:', solution.gRecaptchaResponse);
console.log('User-Agent:', solution.userAgent || 'N/A');
} catch (error) {
console.error('Failed:', error.message);
}
})();
<?php
$API_KEY = 'YOUR_API_KEY';
$API_URL = 'https://api.ai4cap.com/api';
function solveReCaptchaEnterprise($siteKey, $pageUrl, $enterprisePayload = null) {
global $API_KEY, $API_URL;
// Build request data
$requestData = [
'type' => 'recaptcha_enterprise',
'websiteKey' => $siteKey,
'websiteUrl' => $pageUrl
];
if ($enterprisePayload) {
$requestData['enterprisePayload'] = $enterprisePayload;
}
// Submit task
$ch = curl_init($API_URL . '/captcha/solve');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: ' . $API_KEY,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$response['success']) {
throw new Exception('Failed to submit task');
}
$taskId = $response['taskId'];
// Poll for result
for ($i = 0; $i < 40; $i++) { // Max 80 seconds
$ch = curl_init($API_URL . '/captcha/result/' . $taskId);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-API-Key: ' . $API_KEY]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($result['status'] === 'solved') {
return $result['solution'];
} elseif ($result['status'] === 'failed') {
throw new Exception('Task failed: ' . ($result['error'] ?? 'Unknown error'));
}
sleep(2);
}
throw new Exception('Timeout waiting for solution');
}
// Example usage
try {
$solution = solveReCaptchaEnterprise(
'6Lc3fLwUAAAAAKpuMzGGnimGiI-kJ7lfO3PtLPez',
'https://enterprise.example.com',
[
'pageAction' => 'login',
'isInvisible' => true,
'enterprisePayload' => ['s' => 'SOME_ADDITIONAL_TOKEN']
]
);
echo "Token: " . $solution . "\n";
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
?>
Response Format
{
"errorId": 0,
"status": "ready",
"solution": {
"gRecaptchaResponse": "03AGdBq26gJ8jc..." // The token to submit
},
"cost": "0.020000",
"ip": "192.168.1.1",
"createTime": 1640995200000,
"endTime": 1640995215000,
"solveCount": 1
}
Understanding pageAction Parameter
For reCAPTCHA Enterprise, the pageAction
parameter works similarly to v3 and must match the action used in the website's code.
How to find the correct pageAction:
1. Open DevTools Network tab
2. Look for requests to recaptchaenterprise.googleapis.com
3. Check the request payload for the action parameter
4. Or search for grecaptcha.enterprise.execute
in the source
grecaptcha.enterprise.execute('6Lc3fLwUAAAAA...', {action: 'login'})
// Use pageAction = "login" in your request
Enterprise-Specific Features
• Risk Analysis: Enhanced bot detection with detailed scoring
• Account Defender: Protects against account takeovers
• Payment Fraud Prevention: Specialized for e-commerce sites
• WAF Integration: Works with Web Application Firewalls
• Custom Challenges: Can present different challenge types
Integration Tips
• Enterprise tokens may have shorter validity periods
• The enterprisePayload
parameter is site-specific
• Some Enterprise implementations require specific user agents
• Monitor solve times as Enterprise CAPTCHAs can be more complex
• Consider implementing retry logic with different parameters