#
Cloudflare Turnstile
Cloudflare's privacy-preserving captcha alternative.
#
Overview
Turnstile is Cloudflare's user-friendly captcha that often works without user interaction.
#
Task Types
#
Parameters
#
Finding the Site Key
Look for the Turnstile widget in page source:
<div class="cf-turnstile" data-sitekey="0x4AAAAAAAB..."></div>
Or search for:
data-sitekeyturnstile.rendercf-turnstile
#
Example
import requests
response = requests.post("https://v1.captchasolv.com/solve", json={
"clientKey": "YOUR_API_KEY",
"task": {
"type": "TurnstileTaskProxyless",
"websiteURL": "https://example.com",
"websiteKey": "0x4AAAAAAAB..."
}
}, timeout=130)
token = response.json()["solution"]["token"]
const response = await axios.post('https://v1.captchasolv.com/solve', {
clientKey: 'YOUR_API_KEY',
task: {
type: 'TurnstileTaskProxyless',
websiteURL: 'https://example.com',
websiteKey: '0x4AAAAAAAB...'
}
}, { timeout: 130000 });
const token = response.data.solution.token;
curl -X POST https://v1.captchasolv.com/solve \
-H "Content-Type: application/json" \
-d '{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "TurnstileTaskProxyless",
"websiteURL": "https://example.com",
"websiteKey": "0x4AAAAAAAB..."
}
}'
#
Using the Token
Submit the token in the cf-turnstile-response field:
# After solving
token = solve_turnstile(url, site_key)
# Submit with form
response = requests.post("https://example.com/submit", data={
"cf-turnstile-response": token,
# ... other form data
})
#
Response
{
"errorId": 0,
"solution": {
"token": "0.x7rN1bQ9...",
"userAgent": "Mozilla/5.0..."
},
"cost": "0.00100"
}
#
Turnstile Modes
Turnstile has different modes - all are supported:
All modes use the same API call.
#
Tips
- Token expiry - Tokens expire in ~5 minutes
- Use same User-Agent - Use the returned
userAgentin subsequent requests - Check for Cloudflare - Look for
challenges.cloudflare.comin network requests