# Cloudflare Turnstile & Challenge

{% hint style="warning" %}
We support the following Cloudflare types:

<mark style="color:orange;">**Cloudflare Turnstile**</mark>: *Manual, Non-Interactive & Invisible*

<mark style="color:orange;">**Cloudflare Challenges**</mark>*: 5S Challenge & Non-Interactive Turnstiles.*
{% endhint %}

{% hint style="danger" %} <mark style="color:red;">**PLEASE NOTE:**</mark>**&#x20;CloudFlare Challenges** have been showing increase signs of instability due to recent Cloudflare updates. We apologize for any inconvenience this may cause. This does not impact the stability of the regular Turnstile solver.
{% endhint %}

Rest API Endpoint: `https://captcha.datalabs.net/createTask`

## Creating The Task <a href="#creating-the-task" id="creating-the-task"></a>

```json
POST https://captcha.datalabs.net/createTask
Host: captcha.datalabs.net
Content-Type: application/json

{
  "clientKey": "DATALABS_API_KEY",
  "task": {
    "type": "AntiTurnstileTaskProxyLess",
    "websiteURL": "WEBSITE_URL",
    "websiteKey": "0x4*****************",
    "metadata": {
       "action": "search",  // Optional
       "cdata": "0000-1111-2222-3333-example-cdata"  // Optional
    }
  }
}
```

### Task Parameter Table <a href="#task-parameter-table" id="task-parameter-table"></a>

<table><thead><tr><th width="260">Parameters</th><th width="114.66666666666666">Required</th><th>Description</th></tr></thead><tbody><tr><td>type</td><td>true</td><td>GeeTestTaskProxyLess</td></tr><tr><td>websiteURL</td><td>true</td><td>The website address in which you're solving the captcha for.</td></tr><tr><td>websiteKey</td><td>true</td><td>The Cloudflare website key specific to the site you're solving for. Typically starts with <code>0x4</code>.</td></tr><tr><td>metadata.action</td><td>false</td><td>If available, you must include the value of the <code>data-action</code> attribute.</td></tr><tr><td>metadata.cdata</td><td>false</td><td>If available, you must include the value of the <code>data-cdata</code> attribute.</td></tr></tbody></table>

### Task Created Response <a href="#task-created-response" id="task-created-response"></a>

```json
{
  "errorId":0,
  "taskId":997993082
}
```

<table><thead><tr><th width="184">Parameters</th><th width="370">Description</th></tr></thead><tbody><tr><td>errorId</td><td>0: Without error.<br>1: Error with request.</td></tr><tr><td>errorCode</td><td>Short code for error type.</td></tr><tr><td>errorDescription</td><td>More detailed description of the error that occurred.</td></tr><tr><td>taskId</td><td>Task ID, provided for synchronous tasks to be pushed to /getTaskResult</td></tr></tbody></table>

## Retrieving the Solution

```json
POST https://captcha.datalabs.net/getTaskResult
Host: captcha.datalabs.net
Content-Type: application/json

{
  "clientKey": "DATALABS_API_KEY",
  "taskId": "997993082"
}
```

### Successful Solution Response <a href="#retrieved-solution-response-structure" id="retrieved-solution-response-structure"></a>

```json
{
  "errorId": 0,
  "status": "ready",
  "solution": {
    "token": "0.mF74FV8wEufAWOdvOak_x...",
    "type": "turnstile",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Appl..."
  }
}
```

<table><thead><tr><th width="246">Parameters</th><th>Description</th></tr></thead><tbody><tr><td>token</td><td>The token from the succesful solution.</td></tr><tr><td>type</td><td>The type of cloudflare challenge/captcha encountered.</td></tr><tr><td>userAgent</td><td>The user agent in which the solution was solved with.</td></tr></tbody></table>
