Skip to content
Programmatic guide

Cloudflare Turnstile solver for HTTP / requests Python

Cloudflare Turnstile is invisible — there's no widget to render. A pure HTTP client can pass the cf-turnstile-response cookie / form field directly from a Sonic-issued token.

Python · HTTP / requests

Runnable example

import requests
from captchasonic import CaptchaSonic

sonic = CaptchaSonic('YOUR_API_KEY')
result = sonic.solve(
    type='TurnstileTaskProxyless',
    website_url='https://target.example.com/login',
    website_key='0x4AAAAAAA...',
)

r = requests.post(
    'https://target.example.com/login',
    data={'username': '...', 'password': '...', 'cf-turnstile-response': result.token},
)
print(r.status_code)

Replace YOUR_API_KEY with a real key from your dashboard. The token is good for one form submission.

FAQ

Is requests enough for Turnstile?
Yes for the captcha itself. Cloudflare may still TLS-fingerprint your client, so pair with a curl-impersonate-style HTTP client if your target enforces JA3/JA4 strict-matching.
What if the form posts JSON, not form-encoded?
Set cf-turnstile-response as a key in the JSON body — Cloudflare reads whatever the page declared. Most Turnstile sites accept form-encoded, but a few enforce content-type strictness.
How long is a Turnstile token valid?
About 5 minutes per origin. The token is single-use on the verify endpoint, so submit the form immediately after receiving it.

How CaptchaSonic compares for this captcha

Feature-by-feature against the four most-mentioned alternatives. Independently benchmarked; numbers refresh quarterly.

FeatureCaptchaSonic2CaptchaCapSolverAnti-CaptchaCapMonster Cloud
AI / ML solver (no human relay)
Cloudflare Turnstile
Success rate (trailing 30d)99.9%~95%~98%~95%~97%
Price per 1k — Turnstile$0.50$1.99$0.80$1.50$0.80
Proxy + proxyless modes
Free trial credits
SDK languages (Py, Node, Go, C#, Java, PHP)66454
Selenium / Puppeteer / Playwright examples
Browser extension
Webhook callbacks
99.9% uptime SLA

Yes / No / Partial reflect publicly documented support. Pricing and solve-time figures snapshot the published rate at the time this page was last updated.

Related guides