TurnstileTask
Parameters, request and response for Cloudflare Turnstile solved through your proxy: the TurnstileTask task type.
On this page
Cloudflare Turnstile: the widget from challenges.cloudflare.com/turnstile/v0/api.js, usually a “Verify you are human” box, sometimes invisible. The task is solved through your proxy, so the answer is issued for your IP address.
| Price | $0.80 per 1000 tasks ($0.0008 per task), only for solved tasks — pricing |
| Proxy | required — your proxy |
| Queue in getQueueStats | — |
| Also accepted as | — |
Parameters#
Fields of the task object in createTask:
ParameterDescription
typestringrequiredTurnstileTaskwebsiteURLstringrequired- Full address of the page with the captcha: http(s), up to 2048 characters, a public site.
websiteKeystringrequired- Turnstile site key: the
data-sitekeyattribute of thecf-turnstilewidget or thesitekeypassed toturnstile.render, usually0x4AAAAAAA…. actionstring- The widget
action(data-action), if the page sets one. Letters, digits,_ / . -, up to 128 characters.pageActionis accepted too. turnstileCDatastring- The widget
cData(data-cdata), if the page sets one. Up to 1024 characters: letters, digits and_ - . : = + /. userAgentstring- User-Agent of the browser that will submit the token, up to 512 characters. It is returned in
solution.userAgent. cookiesstring- Cookies of the target site for the solving browser:
name=value; name2=value2, up to 8192 characters. Stored encrypted. proxyTypestringhttp(default),https,socks4orsocks5.proxyAddressstringrequired- IP address or host name of the proxy. Private and local addresses are rejected.
proxyPortintegerrequired- Proxy port, 1–65535.
proxyLoginstring- Proxy login, up to 256 characters. Stored encrypted.
proxyPasswordstring- Proxy password, up to 256 characters. Stored encrypted.
Request#
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "TurnstileTask",
"websiteURL": "https://example.com/login",
"websiteKey": "0x4AAAAAAA-SITE-KEY",
"proxyType": "http",
"proxyAddress": "proxy.example.com",
"proxyPort": 8080,
"proxyLogin": "user",
"proxyPassword": "pass"
}
}Complete example#
Create the task, poll every 2 seconds, print the token:
import os
import time
import requests
API = "https://neurocaptcha.com"
KEY = os.environ["API_KEY"]
def call(method, payload):
data = requests.post(f"{API}/{method}", json={"clientKey": KEY, **payload}, timeout=30).json()
if data.get("errorId"):
raise RuntimeError(f'{data["errorCode"]}: {data.get("errorDescription", "")}')
return data
task = {
"type": "TurnstileTask",
"websiteURL": "https://example.com/login",
"websiteKey": "0x4AAAAAAA-SITE-KEY",
"proxyType": "http",
"proxyAddress": "proxy.example.com",
"proxyPort": 8080,
"proxyLogin": "user",
"proxyPassword": "pass",
}
# 1. create the task: its price is held, not charged
task_id = call("createTask", {"task": task})["taskId"]
# 2. poll every 2 s; a failed task raises with its error code and costs nothing
deadline = time.time() + 300
while time.time() < deadline:
time.sleep(2)
result = call("getTaskResult", {"taskId": task_id})
if result["status"] == "ready":
print(result["solution"]["token"])
break
else:
raise TimeoutError("the task was not solved in time")Response#
getTaskResult once the task is solved:
{
"errorId": 0,
"status": "ready",
"solution": {
"token": "0.Q2Vo3vPq7TnZxw…",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"
},
"cost": "0.000800",
"ip": "198.51.100.7",
"createTime": 1793370000,
"endTime": 1793370007,
"solveCount": 1
}Tips#
- Find
websiteKeyin thedata-sitekeyattribute of thecf-turnstileelement or in theturnstile.rendercall. - Copy
actionandcDataexactly when the widget sets them: the site may compare them with the token. - Put the token into the
cf-turnstile-responsefield (or pass it to the widget callback) and send the form. - Submit the token through the same proxy and with the same
userAgentas in the task. See Proxies.