Cloudflare Turnstile
Solve Cloudflare Turnstile widgets with the turnstile type: what to send, how to read the answer, compatible names and error fixes.
Use the turnstile type to get a token for a Cloudflare Turnstile widget. You send the page address and the widget’s site key. You get back the token and the user agent that goes with it.
Overview
Turnstile is the small Cloudflare box on a form that checks you are human, usually without a click. When it’s happy, it puts a token in the form. The website checks that token with Cloudflare when the form is sent. No token, no entry.
type |
turnstile |
| Needs a site key | Yes |
| Optional extras | action, cdata |
| You get | solution.token and solution.user_agent |
Turnstile or Cloudflare Challenge? Turnstile is a box inside a page. If the whole page is replaced by “Just a moment…” or “Verifying you are human” before you can see the site, that is a different check. Use Cloudflare Challenge for that one.
Before you start
- Make an account and create an API key in the dashboard under API keys. The key starts with
drx_. - Add funds. A task needs enough balance to cover its price when you create it.
- Find the values on the page:
- Open the page in your browser.
- Right-click and choose View page source, then search for
sitekey. - You will usually find
data-sitekey="0x4..."on the widget’sdiv, or aturnstile.render(...)call withsitekey: "0x4..."in a script. - In the same place, look for
data-action/action:anddata-cdata/cData:. Many sites don’t set them. Copy them only if they are there. - If the widget is added later by a script and the source shows nothing, open the browser’s developer tools, go to the Network tab, reload, and look for a request to
challenges.cloudflare.com. The site key appears in its address.
Request fields
| Field | Required | What to put |
|---|---|---|
type |
Yes | turnstile |
website_url |
Yes | The full address of the page with the widget, starting with https://. Not the Cloudflare frame address. |
website_key |
Yes | The Turnstile site key, for example 0x4AAAAAAA.... |
action |
No | The widget’s action name, only if the page sets one. |
cdata |
No | The widget’s cData, only if the page sets one. Up to 255 characters. |
proxy |
No | Your proxy as user:pass@host:port, or with a scheme like http:// or socks5://. |
user_agent |
No | A browser user agent. Most Turnstile setups don’t need it. |
If you send cdata with another captcha type, it is ignored.
Create the task
curl
curl -s -X POST https://draxon.one/api/captcha/v1/tasks \
-H "Authorization: Bearer $DRAXON_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: signup-4821" \
-d '{
"type": "turnstile",
"website_url": "https://example.com/signup",
"website_key": "0x4AAAAAAAxxxxxxxxxxxxxx",
"action": "signup"
}'
Python
import os
import requests
API = "https://draxon.one/api/captcha/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['DRAXON_KEY']}"}
task = requests.post(f"{API}/tasks", headers=HEADERS, timeout=30, json={
"type": "turnstile",
"website_url": "https://example.com/signup",
"website_key": "0x4AAAAAAAxxxxxxxxxxxxxx",
}).json()
while task["status"] in ("queued", "processing"):
task = requests.get(f"{API}/tasks/{task['id']}", params={"wait": 30},
headers=HEADERS, timeout=60).json()
if task["status"] == "solved":
token = task["solution"]["token"]
user_agent = task["solution"]["user_agent"]
else:
print("not solved:", task["error"])
Node.js
const API = "https://draxon.one/api/captcha/v1";
const headers = {
Authorization: `Bearer ${process.env.DRAXON_KEY}`,
"Content-Type": "application/json",
};
let task = await (await fetch(`${API}/tasks`, {
method: "POST",
headers,
body: JSON.stringify({
type: "turnstile",
website_url: "https://example.com/signup",
website_key: "0x4AAAAAAAxxxxxxxxxxxxxx",
}),
})).json();
while (task.status === "queued" || task.status === "processing") {
task = await (await fetch(`${API}/tasks/${task.id}?wait=30`, { headers })).json();
}
if (task.status === "solved") {
const { token, user_agent } = task.solution;
}
The create call answers right away with 201 and a task in the queued state.
Get the result
Ask for the task with ?wait=30 (any number from 0 to 120). The request stays open until the task is done or the wait runs out, so you don’t need a tight loop.
curl -s -H "Authorization: Bearer $DRAXON_KEY" \
"https://draxon.one/api/captcha/v1/tasks/<id>?wait=30"
A solved task looks like this (cost fields left out):
{
"id": "7b8a5b2c-623b-410a-8677-2b7e56230f21",
"type": "turnstile",
"status": "solved",
"website_host": "example.com",
"attempts": 1,
"created_at": "2026-10-30T21:52:10Z",
"completed_at": "2026-10-30T21:52:13Z",
"solution": {
"token": "1.Etxg0XQnz1f-JBQ6nf...",
"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.6.2 Mobile/15E148 Safari/604.1"
},
"error": null
}
If the status is failed or expired, solution is null and error.code tells you why. You are not charged for those.
Use the answer
- Put
solution.tokenwhere the page puts its own token. On most sites that is a hidden form field namedcf-turnstile-response. Some sites copy it into a JSON field or a header. Check what the page sends in the Network tab and copy that. - Send
solution.user_agentas theUser-Agentheader on the request that submits the token. - Use the token once, and soon. Turnstile tokens are single-use and short-lived. If the site says the token is invalid or expired, create a new task.
- If you sent
actionorcdata, the token is tied to them. Submit it to the same form the action belongs to.
Compatible API names
Already using CapSolver, Anti-Captcha or 2Captcha? Keep your code and change the address to https://draxon.one/api/captcha/compat. Your DraxonCloud key is the client key.
| Service style | Name for Turnstile |
|---|---|
CapSolver / Anti-Captcha createTask |
TurnstileTask, TurnstileTaskProxyless, AntiTurnstileTask, AntiTurnstileTaskProxyLess |
2Captcha in.php |
method=turnstile |
Where the extras are read from:
- cData:
task.metadata.cdata, thentask.cData, thentask.data. On 2Captcha, thedataparameter. - action:
task.action, thentask.pageAction, thentask.metadata.action. On 2Captcha, theactionparameter.
Example in CapSolver style:
curl -s -X POST https://draxon.one/api/captcha/compat/createTask \
-H "Content-Type: application/json" \
-d '{
"clientKey": "'"$DRAXON_KEY"'",
"task": {
"type": "AntiTurnstileTaskProxyLess",
"websiteURL": "https://example.com/signup",
"websiteKey": "0x4AAAAAAAxxxxxxxxxxxxxx",
"metadata": {"action": "signup"}
}
}'
Then call getTaskResult with the taskId. When it’s ready, solution.token holds the token and solution.userAgent the user agent. See Compatible APIs for every format.
Errors and fixes
When you create a task:
| Error | What it means | What to do |
|---|---|---|
422 validation_error on website_key |
The site key is missing. | Send the 0x4... key from the page. |
422 validation_error on website_url |
The address is not a full http(s):// address, or is too long. |
Send the full page address. |
422 validation_error on cdata |
cData is longer than 255 characters. | Copy only the cData value from the page. |
422 target_blocked |
This website is not served. | Pick a site you are allowed to automate. |
402 insufficient_balance |
Not enough money to hold the price. | Add funds. |
402 spend_cap_reached |
The key hit its daily limit. | Raise the key’s limit or wait for the next day (UTC). |
When a task ends without a token:
error.code |
What it means | What to do |
|---|---|---|
solve_failed |
The widget could not be passed this time. | Check the site key, action and cData, then try a new task. |
provider_timeout |
It took too long. | Try again. |
expired |
The task was not finished within about 3 minutes. | Try again. |
invalid_task |
The stored task could not be used. | Check your fields. |
None of these cost anything. More codes are on the errors page.
Price and billing
Each solved Turnstile costs the price shown on the pricing page and in GET /api/captcha/v1/families, which also shows any discount on your account. When you create a task, we hold that amount from your balance. When the task is solved, the hold becomes a charge. If it fails or expires, the hold is released and you pay nothing. A task can only be charged once.
Related
- Cloudflare Turnstile solver: the short overview
- Cloudflare Challenge: the full-page “Just a moment…” check
- Solve a captcha: the general guide for all types
- Compatible APIs
- Errors
- Webhooks: get told when a task finishes