Skip to content
StatusConsole

Task types

Cloudflare challenge page

IllustrationThe Cloudflare challenge replaces the whole page ("Just a moment..."). Usually the check finishes on its own and the browser moves on to the real page.

The Cloudflare challenge page replaces a whole site with “Just a moment…” / “Checking your browser” before letting you in. YesCaptcha opens the page through the proxy you provide, passes the check, and returns the cookies (such as cf_clearance), the User-Agent it used, the request and response headers, and the HTML of the page behind the check. CloudFlareTaskS2 costs 25 points (≈ $3.75 / 1k) and CloudFlareTaskS3 costs 20 points (≈ $3.00 / 1k) per task; the two types have the same parameters, results and effectiveness and differ only in price. Tasks are asynchronous and usually take 6 to 35 seconds, varying a lot between sites. Failed and timed-out tasks are refunded automatically.

POSThttps://api.yescaptcha.com/createTaskGlobal endpoint
POSThttps://cn.yescaptcha.com/createTaskChina endpoint
  • The page source contains __cf_chl_rt_tk or cdn-cgi/challenge-platform, and the title is Just a moment...: this is the challenge page. Challenge pages that ask you to tick “Verify you are human” are handled here too.
  • If only a Cloudflare widget is embedded in a form, it is Turnstile instead.
  • If your HTTP library gets a 403 with “Just a moment…” but a browser opens the page directly, you are probably only being blocked by TLS fingerprinting. A library that imitates a browser’s TLS fingerprint (such as curl_cffi) usually fixes it without solving anything.
Task typePriceModeNotes
CloudFlareTaskS2$3.75 / 1k; 25 points/task · ¥25 / 1kAsyncOwn proxy
CloudFlareTaskS3$3.00 / 1k; 20 points/task · ¥20 / 1kAsyncOwn proxy

US dollar prices are estimates at US$1 ≈ ¥6.67; tasks are charged in points.

FieldTypeRequiredDescription
typestringYesTask type; see "Task types and pricing" on this page
websiteURLstringYesFull URL of the page behind the challenge. Must be a public http:// or https:// URL; private IP addresses and local or internal host names such as localhost are rejected
proxystringYesProxy as one string: http://user:[email protected]:8080 (HTTP proxy, credentials optional) or socks5://proxy.example.com:1080 (no credentials). https:// proxies and SOCKS5 with credentials are not supported, and local or private addresses are rejected. Every request for the target page goes through this proxy
userAgentstringNoUsually leave it out. Only a desktop Chrome on Linux User-Agent is used; anything else (Windows, macOS, mobile, other browsers) is ignored. Always use user_agent from the result for later requests
waitLoadbooleanNoDefaults to false. If true, after passing the check the task waits until the page's network activity settles before returning, so content includes more dynamically loaded content; it takes a few seconds longer
requiredCookiesarrayNoCookie names that must be obtained, as an array of strings, e.g. ["cf_clearance"]. If set, the task only succeeds when all of them are obtained; otherwise it returns ERROR_CAPTCHA_UNSOLVABLE and is refunded. If omitted, the task still tries to get cf_clearance, but succeeds (and is charged) with whatever other cookies it got, so pass it explicitly if you need cf_clearance
blockImagebooleanNoIf true, images on the target page are not loaded (except those the Cloudflare check itself needs), saving proxy traffic
postDataobjectNoIf set, it is submitted to websiteURL as a regular HTML form POST (application/x-www-form-urlencoded): each key is a form field and values are sent as strings, e.g. {"name": "hi"}. Must be an object

proxy is required, and every request for the target page goes through it. cf_clearance is bound to the exit IP, so keep using the same proxy when you visit the site afterwards.

Format Supported
http://user:[email protected]:8080 Yes: HTTP proxy with credentials
http://proxy.example.com:8080 Yes: HTTP proxy without credentials
socks5://proxy.example.com:1080 Yes: SOCKS5 proxy without credentials; socks5h:// is treated as socks5://
socks5://user:[email protected]:1080 No, returns ERROR_PROXY_INCORRECT; use an HTTP proxy if you need credentials
https://proxy.example.com:443 or any other scheme, or a missing port No, returns ERROR_PROXY_INCORRECT
Local, private or reserved addresses such as 127.0.0.1, 192.168.x.x, 10.x.x.x, or a host name that resolves to one Rejected, returns ERROR_PROXY_BANNED

Usually leave out userAgent. The check is passed with desktop Chrome on Linux, so only a desktop Chrome on Linux User-Agent is used; anything else (Windows, macOS, mobile or other browsers) is ignored, because in our tests Cloudflare’s check fails when the User-Agent does not match the real browser environment. Always use the user_agent from the result for later requests.

POST https://api.yescaptcha.com/createTask
{
"clientKey": "YOUR_CLIENT_KEY",
"task": {
"type": "CloudFlareTaskS3",
"websiteURL": "https://example.com/",
"proxy": "http://user:[email protected]:8080",
"requiredCookies": ["cf_clearance"]
}
}
  • To use CloudFlareTaskS2, change only type.
  • With requiredCookies set to ["cf_clearance"], the task fails and is refunded if cf_clearance is not obtained. Without it, a task that gets other cookies but no cf_clearance still succeeds and is charged.
  • To submit a form, add postData, for example {"name": "hi"}; it is posted to websiteURL as a regular HTML form.

Then call getTaskResult every 5 seconds as for any asynchronous task; see getTaskResult.

{
"errorId": 0,
"status": "ready",
"solution": {
"user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36",
"cookies": {
"cf_clearance": "Wq3vXk9...-1760860800-1.2.1.1-..."
},
"request_headers": {
"accept-language": "en-US,en;q=0.9",
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36"
},
"headers": {
"content-type": "text/html; charset=UTF-8",
"server": "cloudflare"
},
"content": "<!DOCTYPE html>..."
}
}

The cookie value and headers above are illustrative; use what the API returns.

FieldTypeDescription
cookiesobjectAll cookies in the browser after passing the check (name-to-value object), usually including cf_clearance; if you set requiredCookies, every one of them is included. Use them together with the returned user_agent and the proxy you supplied
user_agentstringThe User-Agent the browser actually used to pass the check (desktop Chrome on Linux). cf_clearance is bound to it, so use it for all follow-up requests
request_headersobjectRequest headers the browser sent in its last request for the target page; reuse them in follow-up requests
headersobjectResponse headers of the target page after passing the check
contentstringHTML source of the target page after passing the check
  1. Make later requests with the returned cookies, the returned user_agent and the same proxy you used for the task. cf_clearance is bound to the User-Agent and the exit IP; if any of them changes, the challenge page comes back.
  2. Send the request_headers too where possible, and use a browser-like TLS fingerprint (for example curl_cffi’s impersonate option).
  3. cf_clearance stays valid for a while (set by the site, up to an hour on some sites), so you don’t need to solve again within that time, but sending requests too fast may get the IP blocked by Cloudflare.
  4. If you only need the page content, use content directly instead of requesting the page again.

Errors returned by createTask are not charged; tasks that fail or time out after being created are refunded automatically. The API only returns the error code and a generic description, so use this table to find the cause.

Error code When What to do
ERROR_REQUIRED_FIELDS On createTask: websiteURL or proxy is missing Add both required fields
ERROR_ILLEGAL_PARAMETERS On createTask: websiteURL is not a public http:// / https:// URL, postData is not an object, or requiredCookies is not an array of strings. On getTaskResult: the target domain could not be resolved through the proxy Fix the parameters; check the URL spelling and whether the proxy can reach the site
ERROR_PROXY_INCORRECT On createTask: the proxy is malformed or has no port, or it is an https:// proxy or SOCKS5 with credentials Use one of the formats under “Proxy requirements”; use an HTTP proxy if you need credentials
ERROR_PROXY_BANNED On createTask: the proxy is a local, private or reserved address, or it failed to connect several times recently. On getTaskResult: the site’s Cloudflare blocked the proxy IP outright (“Sorry, you have been blocked”, “Access denied”) Use another proxy; better-quality IPs pass more easily
ERROR_PROXY_CONNECT_REFUSED Could not connect to the proxy (connection refused, proxy host name not resolvable), or the connection was refused or reset while opening the page through it Check the proxy address and port and make sure it is online and accepts external connections; otherwise use another proxy
ERROR_PROXY_CONNECT_TIMEOUT Connecting to the proxy, or opening the page through it, timed out Use a faster, more reliable proxy
ERROR_PROXY_NOT_AUTHORISED The proxy username or password is wrong Check the credentials in proxy; URL-encode special characters
ERROR_PROXY_TLS_ERROR A TLS handshake failed while opening the page through the proxy Check the proxy address, port and scheme; otherwise use another proxy
ERROR_CAPTCHA_UNSOLVABLE The check was not passed in time, the page was still the challenge after passing, or a cookie listed in requiredCookies was not obtained Try again with another proxy; contact support about specific sites
ERROR_NO_SLOT_AVAILABLE On createTask: the queue is full. On getTaskResult: the task waited in the queue too long and was refunded Wait a few seconds and create the task again
ERROR_TASK_TIMEOUT The task did not finish in time Create a new task; repeated timeouts usually mean the proxy is too slow

See Error codes for all error codes.