GeeTest v4 Token Solving
Solve GeeTest v4 token-based captchas. Returns verification tokens including pass_token, lot_number, gen_time, and captcha_output for form submission.
GeeTest v4 is an advanced behavioral analysis captcha system that provides invisible bot protection. Unlike traditional captchas, GeeTest v4 analyzes user behavior patterns and provides multiple verification tokens that must be submitted together. It returns pass_token, lot_number, gen_time, and captcha_output parameters that work together to verify legitimate user activity.
Captcha Type
Use the following captcha type identifier in your API requests:
"type": "GEETEST_V4_TOKEN"
Request Format
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
captcha.type |
string | required | Must be "GEETEST_V4_TOKEN" |
captcha.metadata.siteUrl |
string | required | URL where captcha appears |
captcha.metadata.siteKey |
string | required | GeeTest captcha_id |
captcha.metadata.apiServerSubdomain |
string | optional | Custom API server subdomain |
captcha.payload.proxy |
object | required | Proxy configuration object (required for GeeTest v4) |
captcha.payload.proxy.protocol |
string | required | Proxy protocol: "http", "https", "socks4", or "socks5" |
captcha.payload.proxy.host |
string | required | Proxy IP address or hostname |
captcha.payload.proxy.port |
number | required | Proxy port number |
captcha.payload.proxy.username |
string | optional | Proxy authentication username |
captcha.payload.proxy.password |
string | optional | Proxy authentication password |
GeeTest v4 Token requires a proxy. The same proxy IP must be used for both solving the captcha and submitting the verification tokens to the target website.
Example Request
const response = await fetch('https://solver-api.mydisct.com/createTask', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': 'YOUR_API_KEY'
},
body: JSON.stringify({
auth: { token: 'YOUR_API_KEY' },
context: { source: 'api', version: '1.0.0' },
captcha: {
type: 'GEETEST_V4_TOKEN',
metadata: {
siteUrl: 'https://example.com',
siteKey: 'captcha_id_here'
},
payload: {
proxy: {
protocol: 'http',
host: '1.2.3.4',
port: 8080,
username: 'proxyuser',
password: 'proxypass'
}
}
}
})
});
const data = await response.json();
console.log('Task ID:', data.task.id);
Response Format
Create Task Response
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha is being processed",
"task": {
"id": "MyDisctSolver_abc123",
"status": "processing"
}
}
Fetch Result Response (Processing)
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha is being processed",
"task": {
"id": "MyDisctSolver_abc123",
"status": "processing"
}
}
Fetch Result Response (Completed)
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha solved successfully",
"task": {
"id": "MyDisctSolver_abc123",
"status": "completed",
"result": {
"token": "abc123...",
"challenge": "def456...",
"timestamp": "1699200000",
"validation": "ghi789...",
"timestamp": "2025-11-05T12:34:56.789Z"
}
}
}
Response contains masked field names. Map them to GeeTest parameters:
token→ pass_tokenchallenge→ lot_numbertimestamp→ gen_timevalidation→ captcha_output
Python Example
import requests
import time
def solve_geetest_v4_token(site_url, site_key, proxy, api_key):
create_response = requests.post(
'https://solver-api.mydisct.com/createTask',
headers={'Content-Type': 'application/json', 'apikey': api_key},
json={
'auth': {'token': api_key},
'context': {'source': 'api', 'version': '1.0.0'},
'captcha': {
'type': 'GEETEST_V4_TOKEN',
'metadata': {
'siteUrl': site_url,
'siteKey': site_key
},
'payload': {
'proxy': proxy
}
}
}
)
create_data = create_response.json()
if not create_data['success']:
raise Exception(create_data['error']['message'])
task_id = create_data['task']['id']
while True:
time.sleep(5)
result_response = requests.post(
'https://solver-api.mydisct.com/fetchResult',
headers={'Content-Type': 'application/json', 'apikey': api_key},
json={'taskId': task_id}
)
result_data = result_response.json()
if result_data['task']['status'] == 'completed':
return result_data['task']['result']
elif result_data['task']['status'] == 'failed':
raise Exception('Token solving failed')
result = solve_geetest_v4_token(
site_url='https://example.com',
site_key='captcha_id_here',
proxy='1.2.3.4:8080:user:pass',
api_key='YOUR_API_KEY'
)
# Submit with form
response = requests.post(
'https://example.com/submit',
data={
'lot_number': result['challenge'],
'pass_token': result['token'],
'gen_time': result['timestamp'],
'captcha_output': result['validation']
}
)
print(f'Status: {response.status_code}')
Implementation Guide
Step 1: Extract GeeTest v4 Site Key
Find the GeeTest v4 captcha_id from the page source:
// Method 1: From initGeetest4 parameters
function getGeeTestV4SiteKey() {
const scripts = document.querySelectorAll('script');
for (const script of scripts) {
const match = script.textContent?.match(/initGeetest4(s*{s*captchaId:s*['"]([^'"]+)/);
if (match) return match[1];
}
if (window.captchaObj && window.captchaObj.captchaId) {
return window.captchaObj.captchaId;
}
const gtElement = document.querySelector('[data-captcha-id], .geetest_holder');
if (gtElement) {
return gtElement.getAttribute('data-captcha-id') ||
gtElement.getAttribute('data-site-key');
}
return null;
}
const siteKey = getGeeTestV4SiteKey();
console.log('GeeTest v4 Site Key:', siteKey);
Step 2: Solve GeeTest v4 Token
async function solveGeeTestV4Token(siteUrl, siteKey, proxy) {
const createResponse = await fetch('https://solver-api.mydisct.com/createTask', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': 'YOUR_API_KEY'
},
body: JSON.stringify({
auth: { token: 'YOUR_API_KEY' },
context: { source: 'api', version: '1.0.0' },
captcha: {
type: 'GEETEST_V4_TOKEN',
metadata: { siteUrl, siteKey },
payload: { proxy } // Proxy is required for GeeTest v4
}
})
});
const createData = await createResponse.json();
if (!createData.success) {
throw new Error(createData.error.message);
}
const taskId = createData.task.id;
while (true) {
await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds
const resultResponse = await fetch('https://solver-api.mydisct.com/fetchResult', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': 'YOUR_API_KEY'
},
body: JSON.stringify({ taskId })
});
const resultData = await resultResponse.json();
if (resultData.task.status === 'completed') {
return resultData.task.result;
} else if (resultData.task.status === 'failed') {
throw new Error('GeeTest v4 solving failed');
}
}
}
const result = await solveGeeTestV4Token(
'https://example.com/login',
'captcha_id_here',
'1.2.3.4:8080:user:pass' // Proxy required
);
console.log('GeeTest v4 Result:', result);
Step 3: Submit with All Required Parameters
// Method 1: Submit with form data
async function submitFormWithGeeTestV4(result) {
const formData = new FormData();
formData.append('username', 'myusername');
formData.append('password', 'mypassword');
formData.append('lot_number', result.challenge);
formData.append('pass_token', result.token);
formData.append('gen_time', result.timestamp);
formData.append('captcha_output', result.validation);
const response = await fetch('https://example.com/login', {
method: 'POST',
body: formData
});
return await response.json();
}
async function submitJsonWithGeeTestV4(result) {
const response = await fetch('https://example.com/api/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: 'myusername',
password: 'mypassword',
lot_number: result.challenge,
pass_token: result.token,
gen_time: result.timestamp,
captcha_output: result.validation
})
});
return await response.json();
}
const result = await solveGeeTestV4Token(siteUrl, siteKey, proxy);
await submitFormWithGeeTestV4(result);
Best Practices
- Proxy is required for GeeTest v4 token solving
- Use high-quality residential proxies for best results
- Token solving takes 10-20 seconds on average
- All 4 parameters must be submitted together: lot_number, pass_token, gen_time, captcha_output
- Include captcha_id (siteKey) from page initialization
- Poll every 5 seconds for results
- Implement proper error handling for failed tasks
Common Issues
Solution: GeeTest v4 requires a proxy for solving. Include a valid proxy string
in the format ip:port:user:pass.
Solution: GeeTest v4 requires all 4 parameters to be submitted together. Ensure lot_number, pass_token, gen_time, and captcha_output are all included.
Solution: GeeTest v4 site keys are usually found in the initGeetest4() call or as captchaId parameters in the page source.
Solution: Use high-quality residential proxies. Free or low-quality proxies often result in solving failures for GeeTest v4.