Skip to content
CaptchaSonic

Anti Turnstile

The Turnstile captcha is Cloudflare's attempt to replace reCaptcha. We automatically support all subtypes (manual, non-interactive, invisible) without needing you to specify them.

Billed separately

Pay-as-you-go · wallet balance

$0.0005/ request$0.50 / 1K

Turnstile is not covered by subscription plans. Successful solves are auto-deducted from your wallet balance.

  1. 1Add balance to your account wallet.
  2. 2Send Turnstile requests with your API key.
  3. 3$0.0005 auto-deducted per successful solve.

How to Use

Create the task with the createTask method and poll for the result using the getTaskResult method.

Proxy Information

This task type is proxyless (AntiTurnstileTaskProxyLess). You do not need to provide a proxy.

1. 작업 만들기

Use the `createTask` method to initiate the solving process. You must provide the `websiteURL` and `websiteKey`.

작업 객체 매개변수

속성유형필수설명
typeString예Must be `AntiTurnstileTaskProxyLess`
websiteURLString예The full URL of the target page where Turnstile is present.
websiteKeyString예The Turnstile `site-key` found on the target website.
metadataObject아니요An object for Turnstile's extra data parameters.
metadata.actionString아니요The value of the `data-action` attribute of the Turnstile element.
metadata.cdataString아니요The value of the `data-cdata` attribute of the Turnstile element.

요청 예시

POST https://api.captchasonic.com/createTask
Host: api.captchasonic.com
Content-Type: application/json
{
    "apiKey": "YOUR_API_KEY",
    "task": {
        "type": "AntiTurnstileTaskProxyLess",
        "websiteURL": "https://your-target-website.com",
        "websiteKey": "0x4AAAAAAABRS0NDnxxxxx",
        "metadata": {
            "action": "login",
            "cdata": "0000-1111-2222-3333-example-cdata"
        }
    }
}

응답 예시

작업 생성 요청이 성공하면 taskId 값을 반환합니다. 이 값은 다음 단계에서 사용합니다.

{
    "errorId": 0,
    "status": "idle",
    "taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}

2. 결과 가져오기

After creating a task, use the `getTaskResult` method to check the status and retrieve the solution. Poll this endpoint every 3-5 seconds until the status is `completed`.

결과 요청

POST https://api.captchasonic.com/getTaskResult
Host: api.captchasonic.com
Content-Type: application/json
{
    "apiKey": "YOUR_API_KEY",
    "taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}

성공 응답 예시

작업 상태가 completed이 되면 응답에 해결 결과 객체가 포함됩니다.

{
    "errorId": 0,
    "status": "completed",
    "solution": {
        "token": "0.ARgAI...solution..token..here...8dK35v",
        "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ..."
    },
    "taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}

SDK 사용법

# Coming soon: A simplified Python SDK
# pip install --upgrade captchasonic
#
# from captchasonic import CaptchaSonic
#
# client = CaptchaSonic(api_key="YOUR_API_KEY")
#
# solution = client.solve_turnstile(
#   website_url="https://your-target-website.com",
#   website_key="0x4AAAAAAABRS0NDnxxxxx"
# )
# print(solution.token)

전체 샘플 코드

import requests
import time

API_KEY = "YOUR_API_KEY"
API_URL = "https://api.captchasonic.com"

def solve_turnstile():
    # 1. Create the task
    print("Creating Turnstile task...")
    create_payload = {
        "apiKey": API_KEY,
        "task": {
            "type": "AntiTurnstileTaskProxyLess",
            "websiteURL": "https://your-target-website.com",
            "websiteKey": "0x4AAAAAAABRS0NDnxxxxx"
        }
    }
    res = requests.post(f"{API_URL}/createTask", json=create_payload)
    if res.status_code != 200:
        print(f"Error creating task: {res.text}")
        return

    task_id = res.json().get("taskId")
    if not task_id:
        print(f"Could not find taskId in response: {res.json()}")
        return
    
    print(f"Task created successfully. Task ID: {task_id}")

    # 2. Poll for the result
    while True:
        print("Polling for result...")
        time.sleep(3) # Wait 3 seconds between polls
        get_payload = {"apiKey": API_KEY, "taskId": task_id}
        res = requests.post(f"{API_URL}/getTaskResult", json=get_payload)
        
        if res.status_code != 200:
            print(f"Error getting result: {res.text}")
            continue

        resp_json = res.json()
        status = resp_json.get("status")
        
        if status == "completed":
            print("Task completed!")
            return resp_json.get("solution")
        elif status == "failed":
            print(f"Task failed: {resp_json.get('errorDescription')}")
            return
        elif status == "processing":
            print("Task is still processing, trying again...")
        else:
            print(f"Unknown status: {status}, response: {resp_json}")
            
# Run the solver
solution = solve_turnstile()
if solution:
    print("\n--- SOLUTION ---")
    print(f"Token: {solution.get('token')[:30]}...")
    print("----------------")