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

# Execute Task

## Authentication

This endpoint requires an API key passed via header.

<ParamField header="X-Api-Key" type="string" required>
  Your API key.
</ParamField>

## Request Body

<ParamField body="task_type" type="string" required>
  The type of challenge to solve. One of: `turnstile`, `waf`, `wafauto`, `datadome`.
</ParamField>

<ParamField body="task_data" type="object" required>
  The challenge-specific parameters. The required fields depend on the `task_type` — see the task type pages linked below.
</ParamField>

## Supported Task Types

<CardGroup cols={2}>
  <Card title="Turnstile" icon="shield-halved" href="/api-reference/tasks/cloudflare-turnstile">
    Cloudflare Turnstile CAPTCHA
  </Card>

  <Card title="WAF" icon="lock" href="/api-reference/tasks/cloudflare-waf">
    Cloudflare WAF challenge
  </Card>

  <Card title="WAF Auto" icon="bolt" href="/api-reference/tasks/cloudflare-waf-auto">
    Cloudflare WAF challenge (automatic)
  </Card>

  <Card title="DataDome" icon="robot" href="/api-reference/tasks/datadome">
    DataDome bot protection
  </Card>
</CardGroup>

## Request Examples

### Turnstile

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.uncaptcha.io/v1/task/execute \
    -H "Content-Type: application/json" \
    -H "X-Api-Key: your-api-key" \
    -d '{
      "task_type": "turnstile",
      "task_data": {
        "sitekey": "0x4AAAAAABs37s-ih7Jepz0J",
        "url": "https://example.com/",
        "proxy": "http://user:pass@1.2.3.4:8080"
      }
    }'
  ```

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

  resp = requests.post(
      "https://api.uncaptcha.io/v1/task/execute",
      headers={"X-Api-Key": "your-api-key"},
      json={
          "task_type": "turnstile",
          "task_data": {
              "sitekey": "0x4AAAAAABs37s-ih7Jepz0J",
              "url": "https://example.com/",
              "proxy": "http://user:pass@1.2.3.4:8080"
          }
      }
  )

  token = resp.json()["data"]["solution"]["token"]
  ```

  ```javascript Node.js theme={null}
  const resp = await fetch("https://api.uncaptcha.io/v1/task/execute", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-Api-Key": "your-api-key"
    },
    body: JSON.stringify({
      task_type: "turnstile",
      task_data: {
        sitekey: "0x4AAAAAABs37s-ih7Jepz0J",
        url: "https://example.com/",
        proxy: "http://user:pass@1.2.3.4:8080"
      }
    })
  });

  const { data } = await resp.json();
  const token = data.solution.token;
  ```

  ```go Go theme={null}
  payload, _ := json.Marshal(map[string]any{
      "task_type": "turnstile",
      "task_data": map[string]any{
          "sitekey": "0x4AAAAAABs37s-ih7Jepz0J",
          "url":     "https://example.com/",
          "proxy":   "http://user:pass@1.2.3.4:8080",
      },
  })

  req, _ := http.NewRequest("POST", "https://api.uncaptcha.io/v1/task/execute", bytes.NewReader(payload))
  req.Header.Set("Content-Type", "application/json")
  req.Header.Set("X-Api-Key", "your-api-key")

  resp, _ := http.DefaultClient.Do(req)
  ```
</CodeGroup>

### WAF / WAF Auto

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.uncaptcha.io/v1/task/execute \
    -H "Content-Type: application/json" \
    -H "X-Api-Key: your-api-key" \
    -d '{
      "task_type": "waf",
      "task_data": {
        "url": "https://example.com/",
        "proxy": "http://user:pass@1.2.3.4:8080"
      }
    }'
  ```

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

  resp = requests.post(
      "https://api.uncaptcha.io/v1/task/execute",
      headers={"X-Api-Key": "your-api-key"},
      json={
          "task_type": "waf",
          "task_data": {
              "url": "https://example.com/",
              "proxy": "http://user:pass@1.2.3.4:8080"
          }
      }
  )

  solution = resp.json()["data"]["solution"]
  clearance = solution["clearance"]
  ```

  ```javascript Node.js theme={null}
  const resp = await fetch("https://api.uncaptcha.io/v1/task/execute", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-Api-Key": "your-api-key"
    },
    body: JSON.stringify({
      task_type: "waf",
      task_data: {
        url: "https://example.com/",
        proxy: "http://user:pass@1.2.3.4:8080"
      }
    })
  });

  const { data } = await resp.json();
  const clearance = data.solution.clearance;
  ```

  ```go Go theme={null}
  payload, _ := json.Marshal(map[string]any{
      "task_type": "waf",
      "task_data": map[string]any{
          "url":   "https://example.com/",
          "proxy": "http://user:pass@1.2.3.4:8080",
      },
  })

  req, _ := http.NewRequest("POST", "https://api.uncaptcha.io/v1/task/execute", bytes.NewReader(payload))
  req.Header.Set("Content-Type", "application/json")
  req.Header.Set("X-Api-Key", "your-api-key")

  resp, _ := http.DefaultClient.Do(req)
  ```
</CodeGroup>

<Tip>
  For `wafauto`, use the same payload but set `"task_type": "wafauto"`. The response includes an additional `response` object with the page content.
</Tip>

### DataDome

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.uncaptcha.io/v1/task/execute \
    -H "Content-Type: application/json" \
    -H "X-Api-Key: your-api-key" \
    -d '{
      "task_type": "datadome",
      "task_data": {
        "url": "https://example.com/",
        "block_html": "<html>...</html>",
        "proxy": "http://user:pass@1.2.3.4:8080",
        "force_slider": false,
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36"
      }
    }'
  ```

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

  resp = requests.post(
      "https://api.uncaptcha.io/v1/task/execute",
      headers={"X-Api-Key": "your-api-key"},
      json={
          "task_type": "datadome",
          "task_data": {
              "url": "https://example.com/",
              "block_html": "<html>...</html>",
              "proxy": "http://user:pass@1.2.3.4:8080",
              "force_slider": False,
              "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36"
          }
      }
  )

  cookie = resp.json()["data"]["solution"]["cookie"]
  ```

  ```javascript Node.js theme={null}
  const resp = await fetch("https://api.uncaptcha.io/v1/task/execute", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-Api-Key": "your-api-key"
    },
    body: JSON.stringify({
      task_type: "datadome",
      task_data: {
        url: "https://example.com/",
        block_html: "<html>...</html>",
        proxy: "http://user:pass@1.2.3.4:8080",
        force_slider: false,
        user_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36"
      }
    })
  });

  const { data } = await resp.json();
  const cookie = data.solution.cookie;
  ```

  ```go Go theme={null}
  payload, _ := json.Marshal(map[string]any{
      "task_type": "datadome",
      "task_data": map[string]any{
          "url":          "https://example.com/",
          "block_html":   "<html>...</html>",
          "proxy":        "http://user:pass@1.2.3.4:8080",
          "force_slider": false,
          "user_agent":   "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36",
      },
  })

  req, _ := http.NewRequest("POST", "https://api.uncaptcha.io/v1/task/execute", bytes.NewReader(payload))
  req.Header.Set("Content-Type", "application/json")
  req.Header.Set("X-Api-Key", "your-api-key")

  resp, _ := http.DefaultClient.Do(req)
  ```
</CodeGroup>

## Response Examples

Successful responses always have this structure:

```json theme={null}
{
  "success": true,
  "data": {
    "solution": { ... }
  }
}
```

The `solution` object varies by task type:

<CodeGroup>
  ```json Turnstile theme={null}
  {
    "success": true,
    "data": {
      "solution": {
        "token": "0.AuR5g8kP..."
      }
    }
  }
  ```

  ```json WAF theme={null}
  {
    "success": true,
    "data": {
      "solution": {
        "clearance": "cf_clearance=abc123...",
        "cf_bm": "__cf_bm=xyz789...",
        "headers": {
          "user-agent": "Mozilla/5.0 ..."
        },
        "attributes": {
          "sec-ch-ua": "\"Chromium\";v=\"143\""
        }
      }
    }
  }
  ```

  ```json WAF Auto theme={null}
  {
    "success": true,
    "data": {
      "solution": {
        "clearance": "cf_clearance=abc123...",
        "cf_bm": "__cf_bm=xyz789...",
        "headers": {
          "user-agent": "Mozilla/5.0 ..."
        },
        "response": {
          "url": "https://example.com/",
          "status_code": 200,
          "headers": {
            "content-type": "text/html"
          },
          "base64_body": "PCFET0NUWVBFIGh0bWw+..."
        }
      }
    }
  }
  ```

  ```json DataDome theme={null}
  {
    "success": true,
    "data": {
      "solution": {
        "cookie": "datadome=abc123..."
      }
    }
  }
  ```
</CodeGroup>

## Error Responses

All errors follow the same format:

```json theme={null}
{
  "success": false,
  "message": "description of what went wrong"
}
```

| Status | Message                                     | Cause                                         |
| ------ | ------------------------------------------- | --------------------------------------------- |
| `400`  | `Request body could not be decoded`         | Malformed JSON or missing required fields     |
| `400`  | `provided url for task is invalid`          | The URL in `task_data` is not a valid URL     |
| `400`  | `task not found`                            | The `task_type` value is not recognized       |
| `401`  | `X-Api-Key header is missing`               | No `X-Api-Key` header was sent                |
| `401`  | `User provided an empty or invalid API key` | The API key does not exist                    |
| `401`  | `URL is blacklisted`                        | The target domain is blocked                  |
| `402`  | `insufficient balance`                      | Your account balance is too low for this task |
| `500`  | `* (solver related)`                        | The solver encountered an internal error      |
| `504`  | `task timed out`                            | The solver did not respond within 30 seconds  |

## Billing

<Note>
  Your balance is debited **before** the task is sent to the solver. If the solver fails, times out, or returns an error, the charge is **automatically refunded** — you are only charged for successful solves.
</Note>

<Warning>
  Requests have a hard **30-second timeout**. If the solver does not respond in time, you receive a `504` and your balance is refunded.
</Warning>
