Task types
Cloudflare Turnstile
A Cloudflare Turnstile task returns a token (token) that you submit to the target site to pass the check. TurnstileTaskProxyless costs 25 points (≈ $3.75 / 1k) per task and is asynchronous: createTask, then getTaskResult every 5 seconds. Failed and timed-out tasks are refunded automatically.
https://api.yescaptcha.com/createTaskGlobal endpointhttps://cn.yescaptcha.com/createTaskChina endpointThe request body is JSON authenticated with your clientKey. Query results on the same endpoint you created the task on.
When to use
Section titled “When to use”A Cloudflare verification widget (“Verify you are human”) is embedded in a form on the page, and the page loads a script from challenges.cloudflare.com/turnstile.
If the whole page is replaced by Cloudflare’s “Just a moment…” / “Checking your browser” screen, that is the challenge page, not Turnstile; use Cloudflare challenge page. See Identify the captcha type.
Task types and pricing
Section titled “Task types and pricing”| Task type | Price | Mode | Notes |
|---|---|---|---|
TurnstileTaskProxyless | $3.75 / 1k; 25 points/task · ¥25 / 1k | Async | |
TurnstileTaskProxylessM1 | $4.50 / 1k; 30 points/task · ¥30 / 1k | Async | |
TurnstileTaskProxylessLite | $1.65 / 1k; 11 points/task · ¥11 / 1k | Async | The lowest-priced Turnstile type (economy route); failed tasks are not retried on another route, and it is slower than TurnstileTaskProxyless (typically 6–7 seconds, occasionally failing after about 60 seconds) |
TurnstileTask | $3.75 / 1k; 25 points/task · ¥25 / 1k | Async | Own proxy |
US dollar prices are estimates at US$1 ≈ ¥6.67; tasks are charged in points.
TurnstileTaskProxylessandTurnstileTaskProxylessM1take the same parameters on different routes; use either as a fallback for the other.TurnstileTaskProxylessLitetakes the same parameters and costs 11 points (≈ $1.65 / 1k) per task. It is the lowest-priced Turnstile type (an economy route), but success rate and speed are not guaranteed: a failed task is not retried on another route, it usually takes 6–7 seconds, which is slower thanTurnstileTaskProxyless, and occasionally it returns a failure only after about 60 seconds. Failed tasks are refunded automatically, as with the other types. It suits high-volume use where you can handle retries yourself and timing is not critical. It only supports the Turnstile widget embedded in a page, not the Cloudflare challenge page (cf_clearance). It does not support proxies: proxy fields,userAgentand other extra fields are ignored without an error.TurnstileTaskloads the captcha through your own proxy and needs the proxy fields.
Which one to use
Section titled “Which one to use”- In most cases, use
TurnstileTaskProxyless; useTurnstileTaskProxylessM1when you want a fallback route. - For high volume where price matters most and you can handle failures yourself, use
TurnstileTaskProxylessLite. After a failure (errorIdis not 0), you can create a new task with the same parameters usingTurnstileTaskProxyless. - If the site also checks the IP that submits the token, use
TurnstileTaskand submit through the same proxy.
Request parameters
Section titled “Request parameters”| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Task type; see "Task types and pricing" on this page |
websiteURL | string | Yes | Full URL of the page that shows the captcha. Use the site you see the captcha on, not the captcha vendor's domain |
websiteKey | string | Yes | The Turnstile site key (sitekey), usually starting with 0x |
pageAction | string | No | The action the page passes to Turnstile (a turnstile.render option, or data-action on the widget element), e.g. login. Not needed in most cases; add it only when tasks keep failing |
data | string | No | The cData the page passes to Turnstile (a turnstile.render option, or data-cdata on the widget element), e.g. c0bd4b36-7419-4e18-83c6-378699f2a9a2. Not needed in most cases; add it only when tasks keep failing |
proxyType | string | Some types | Proxy protocol: http, https, socks4 or socks5 (Required for TurnstileTask) |
proxyAddress | string | Some types | Proxy IP address or hostname. Local or private addresses such as 127.0.0.1 or 192.168.x.x will not work because our servers cannot reach them (Required for TurnstileTask) |
proxyPort | integer | Some types | Proxy port (Required for TurnstileTask) |
proxyLogin | string | No | Proxy username, if the proxy requires authentication (TurnstileTask only) |
proxyPassword | string | No | Proxy password, if the proxy requires authentication (TurnstileTask only) |
userAgent | string | No | Browser User-Agent. If the result contains a userAgent, use that value when you submit the token (TurnstileTask only) |
websiteKey usually starts with 0x. How to find it: Find Turnstile parameters.
If tasks keep failing: pageAction and data
Section titled “If tasks keep failing: pageAction and data”In most cases websiteURL and websiteKey are all you need, and you don’t need these two parameters. If you are sure websiteURL and websiteKey are correct and tasks still fail, check whether the page passes action and cData to Turnstile (turnstile.render options, or data-action and data-cdata on the widget element). If it does, pass them as they are:
pageAction: the page’saction, e.g.logindata: the page’scData, e.g.c0bd4b36-7419-4e18-83c6-378699f2a9a2
{ "clientKey": "YOUR_CLIENT_KEY", "task": { "type": "TurnstileTaskProxyless", "websiteURL": "https://example.com/login", "websiteKey": "0x4AAAAAAA_SITE_KEY", "pageAction": "login", "data": "c0bd4b36-7419-4e18-83c6-378699f2a9a2" }}Request example
Section titled “Request example”{ "clientKey": "YOUR_CLIENT_KEY", "task": { "type": "TurnstileTaskProxyless", "websiteURL": "https://example.com/login", "websiteKey": "0x4AAAAAAA_SITE_KEY" }}curl -s https://api.yescaptcha.com/createTask \ -H 'Content-Type: application/json' \ -d '{ "clientKey": "YOUR_CLIENT_KEY", "task": { "type": "TurnstileTaskProxyless", "websiteURL": "https://example.com/login", "websiteKey": "0x4AAAAAAA_SITE_KEY" }}'
# Returns {"errorId":0,"taskId":"..."}; then poll every 5 seconds:curl -s https://api.yescaptcha.com/getTaskResult \ -H 'Content-Type: application/json' \ -d '{"clientKey": "YOUR_CLIENT_KEY", "taskId": "TASK_ID"}'import osimport time
import requests
API = "https://api.yescaptcha.com"CLIENT_KEY = os.environ["YESCAPTCHA_CLIENT_KEY"] # Read the clientKey from an environment variable
def call(method, payload): r = requests.post(f"{API}/{method}", json={"clientKey": CLIENT_KEY, **payload}, timeout=30) data = r.json() if data.get("errorId"): raise RuntimeError(f"{data.get('errorCode')}: {data.get('errorDescription')}") return data
def solve(task): task_id = call("createTask", {"task": task})["taskId"] for _ in range(36): # Poll every 5 seconds, for up to about 3 minutes time.sleep(5) result = call("getTaskResult", {"taskId": task_id}) if result.get("status") == "ready": return result["solution"] raise TimeoutError(task_id)
solution = solve({ "type": "TurnstileTaskProxyless", "websiteURL": "https://example.com/login", "websiteKey": "0x4AAAAAAA_SITE_KEY",})print(solution["token"])const API = 'https://api.yescaptcha.com';const CLIENT_KEY = process.env.YESCAPTCHA_CLIENT_KEY; // Read the clientKey from an environment variable
async function call(method, payload) { const res = await fetch(`${API}/${method}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ clientKey: CLIENT_KEY, ...payload }), }); const data = await res.json(); if (data.errorId) throw new Error(`${data.errorCode}: ${data.errorDescription}`); return data;}
async function solve(task) { const { taskId } = await call('createTask', { task }); for (let i = 0; i < 36; i++) { // Poll every 5 seconds, for up to about 3 minutes await new Promise((r) => setTimeout(r, 5000)); const result = await call('getTaskResult', { taskId }); if (result.status === 'ready') return result.solution; } throw new Error(`timeout: ${taskId}`);}
const solution = await solve({ type: "TurnstileTaskProxyless", websiteURL: "https://example.com/login", websiteKey: "0x4AAAAAAA_SITE_KEY",});console.log(solution.token);Replace websiteURL and websiteKey with the target site’s values.
Result
Section titled “Result”{ "errorId": 0, "status": "ready", "solution": { "token": "0.ufq5RgSVZd11DPSX1brdrxnEs28KcVlKj2ORchqxSy2q9yAW6ciq3hriXDF4x...", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36" }}| Field | Type | Description |
|---|---|---|
token | string | The token to submit to the target site. Single use; submit it as soon as possible |
userAgent | string | The User-Agent to use when you submit the token, even if it differs from the one you sent. For TurnstileTaskProxylessLite it is a fixed, recommended Chrome User-Agent |
Put the token in the page’s cf-turnstile-response field (or the field the site’s API expects) and submit, using the returned userAgent as the User-Agent. For TurnstileTaskProxylessLite, the returned userAgent is a fixed Chrome User-Agent recommended for submitting.
While in progress you get {"errorId": 0, "status": "processing"}; check again 5 seconds later. Handle errors by errorCode as described in Error codes.
TurnstileTaskProxylessLite failures and time limit
Section titled “TurnstileTaskProxylessLite failures and time limit”- Not solved:
ERROR_CAPTCHA_UNSOLVABLE. - Route error (timeout, busy and so on):
ERROR_SERVICE_UNAVALIABLE(that is how the code is spelled). When the route is unavailable as a whole,createTaskreturnsERROR_SERVICE_UNAVALIABLEstraight away and nothing is charged; you can switch toTurnstileTaskProxyless. - The time limit is 120 seconds, and a result normally comes within about 70 seconds; after the limit you get
ERROR_TASK_TIMEOUT.
Only successful tasks are charged; all of the failures above are refunded automatically.
How long is a token valid?
Section titled “How long is a token valid?”Single use. Submit it as soon as possible; Turnstile tokens usually expire within a few minutes (Cloudflare decides).
TurnstileTaskProxylessLite fails often. What can I do?
Section titled “TurnstileTaskProxylessLite fails often. What can I do?”TurnstileTaskProxylessLite is cheaper, but its success rate is not guaranteed, and a failed task is not retried on another route for you. Failed tasks are refunded automatically. If you need a higher success rate, switch to TurnstileTaskProxyless or TurnstileTaskProxylessM1, or try TurnstileTaskProxylessLite first and fall back to them when it fails.
The site still rejects the submission
Section titled “The site still rejects the submission”Check that websiteURL is the page with the widget and websiteKey is correct, and submit with the returned userAgent. If the page passes action and cData, add them as pageAction and data; see If tasks keep failing. If the site also checks the IP, use TurnstileTask and submit through the same proxy.