> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vast.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloudflare Turnstile

> Solve Cloudflare Turnstile challenges with VastCap.

## Service Details

* **Service ID**: `turnstile`
* **Price**: \$0.001 $per solve$ (\$1 per 1000 solves)
* **Average Solve Time**: 6 seconds
* **Success Rate**: 98%

## Required Parameters

<ParamField body="websiteURL" type="string" required>
  The URL of the page where the Turnstile challenge is located.
</ParamField>

<ParamField body="websiteKey" type="string" required>
  The site key of the Turnstile challenge from the target website.
</ParamField>

## Optional Parameters

<ParamField body="proxy" type="string">
  Proxy in format `login:password@ip_address:port`. Using a proxy can improve success rates.
</ParamField>

<ParamField body="invisible" type="boolean">
  Set to `true` if the Turnstile is invisible. Default is `false`.
</ParamField>

## Example Request

```bash theme={null}
curl -X POST https://captcha.vast.sh/api/solver/createTask \
  -H "Content-Type: application/json" \
  -d '{
    "clientKey": "YOUR_API_KEY",
    "task": {
      "type": "TurnstileTask",
      "websiteURL": "https://example.com/turnstile",
      "websiteKey": "0x4AAAAAAAC_.......",
      "invisible": true
    }
  }'
```

## Solution Format

```json theme={null}
{
  "token": "0.ABC123def456..."
}
```

## Integration Examples

### Browser JavaScript

```javascript theme={null}
// After receiving the token from the API
document.getElementById('cf-turnstile-response').innerHTML = result.token;
// Then submit your form
document.getElementById('login-form').submit();
```

### Python

```python theme={null}
import requests
import time

# Create a task
task_data = {
    "clientKey": "YOUR_API_KEY",
    "task": {
        "type": "TurnstileTask",
        "websiteURL": "https://example.com/turnstile",
        "websiteKey": "0x4AAAAAAAC_.......",
        "invisible": True
    }
}

response = requests.post(
    "https://captcha.vast.sh/api/solver/createTask", 
    json=task_data
)
task_id = response.json()["taskId"]

# Get the result
while True:
    result_data = {
        "clientKey": "YOUR_API_KEY",
        "taskId": task_id
    }
    result = requests.post(
        "https://captcha.vast.sh/api/solver/getTaskResult", 
        json=result_data
    ).json()
    
    if result.get("status") == "ready":
        # Use the token in your form submission
        turnstile_token = result["solution"]["token"]
        break
    
    time.sleep(3)  # Wait before trying again
```

## Notes

* The solution token is typically valid for 5 minutes after being issued.
* Turnstile challenges are typically easier to solve than other CAPTCHA types, resulting in faster solving times.
* Be sure to specify the correct `invisible` parameter value based on the Turnstile implementation on the target site.
