
Sora Fujimoto
AI Solutions Architect

Cloudflare Turnstile is a free tool designed to replace traditional CAPTCHAs. Turnstile provides frustration-free, CAPTCHA-free web experiences for visitors with just a simple snippet of code. Unlike traditional CAPTCHAs, it protects websites from bot traffic without compromising user privacy or user experience.
Key Benefits of Turnstile:
Turnstile can appear in different forms depending on the context and risk assessment:
Non-interactive challenge

Non-intrusive interactive challenge

Invisible challenge

pip install requests
import time
import requests
CAPSOLVER_API_KEY = "api key"
PAGE_URL = "url"
WEBSITE_KEY = "site key"
def solvecf(metadata_action=None, metadata_cdata=None):
url = "https://api.capsolver.com/createTask"
task = {
"type": "AntiTurnstileTaskProxyLess",
"websiteURL": PAGE_URL,
"websiteKey": WEBSITE_KEY,
}
if metadata_action or metadata_cdata:
task["metadata"] = {}
if metadata_action:
task["metadata"]["action"] = metadata_action
if metadata_cdata:
task["metadata"]["cdata"] = metadata_cdata
data = {
"clientKey": CAPSOLVER_API_KEY,
"task": task
}
response_data = requests.post(url, json=data).json()
print(response_data)
return response_data['taskId']
def solutionGet(taskId):
url = "https://api.capsolver.com/getTaskResult"
status = ""
while status != "ready":
data = {"clientKey": CAPSOLVER_API_KEY, "taskId": taskId}
response_data = requests.post(url, json=data).json()
print(response_data)
status = response_data.get('status', '')
print(status)
if status == "ready":
return response_data['solution']
time.sleep(2)
def main():
taskId = solvecf()
solution = solutionGet(taskId)
if solution:
user_agent = solution['userAgent']
token = solution['token']
print("User_Agent:", user_agent)
print("Solved Turnstile Captcha, token:", token)
if __name__ == "__main__":
main()
By leveraging CapSolver, developers can efficiently bypass Cloudflare Turnstile CAPTCHAs in a secure and automated way. With high accuracy, proxyless support, and minimal setup, this solution is ideal for web scraping, automation, and testing workflows that need to interact with sites protected by Turnstile.
Capsolver’s Python API makes it straightforward to integrate into existing scripts or automation pipelines, allowing you to save time and reduce manual intervention.
Q1: Do I need proxies to use Capsolver for Turnstile?
A: No, Capsolver provides proxyless solving, though you can use your own proxies for additional safety if needed.
Q2: How long does it take to solve a Turnstile captcha?
A: Usually a few seconds, depending on the challenge type and network conditions.
Q3: Can this solution handle multiple Turnstile challenges in parallel?
A: Yes, you can create multiple tasks simultaneously to solve challenges concurrently.
Q4: Is it safe to use for production environments?
A: Yes, Capsolver is designed for high reliability and can handle real-time automated workflows without risk to your accounts.
Q5: Are there limitations for the invisible Turnstile challenge?
A: Invisible challenges work the same way as visible ones; Capsolver detects and solves them automatically.
Learn how to fix the "failed to verify cloudflare turnstile token" error. This guide covers causes, troubleshooting steps, and how to defeat cloudflare turnstile with CapSolver.

Discover the best cloudflare challenge solver tools, compare API vs. manual automation, and find optimal solutions for your web scraping and automation needs. Learn why CapSolver is a top choice.
