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

# GeetestSliderWebTask

> Solve Geetest slider captcha on web

Web slider is a common Geetest captcha type.

<Frame>
  <img src="https://mintcdn.com/omocaptcha/Jc1mwaiUF23R0W3R/images/geetest-slider-web.png?fit=max&auto=format&n=Jc1mwaiUF23R0W3R&q=85&s=6b7974439d0f1685a21d2baf1b63645e" style={{ maxWidth: "360px", width: "100%" }} width="340" height="385" data-path="images/geetest-slider-web.png" />
</Frame>

## 1. Create task

### Request

`POST https://api.omocaptcha.com/v2/createTask`

| Parameter          | Type     | Required | Description                                        |
| ------------------ | -------- | :------: | -------------------------------------------------- |
| `clientKey`        | `String` |     ✅    | Client account key                                 |
| `task.type`        | `String` |     ✅    | Captcha service class name: `GeetestSliderWebTask` |
| `task.imageBase64` | `String` |     ✅    | Base64-encoded image                               |

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.omocaptcha.com/v2/createTask \
    -H "Content-Type: application/json" \
    -d '{
      "clientKey": "OMO_API_KEY",
      "task": {
        "type": "GeetestSliderWebTask",
        "imageBase64": "BASE64_BODY_HERE"
      }
    }'
  ```

  ```javascript Node.js theme={null}
  const res = await fetch("https://api.omocaptcha.com/v2/createTask", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      clientKey: "OMO_API_KEY",
      task: {
        type: "GeetestSliderWebTask",
        imageBase64: "BASE64_BODY_HERE"
      }
    })
  });
  console.log(await res.json());
  ```

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

  res = requests.post("https://api.omocaptcha.com/v2/createTask", json={
      "clientKey": "OMO_API_KEY",
      "task": {
          "type": "GeetestSliderWebTask",
          "imageBase64": "BASE64_BODY_HERE"
      }
  })
  print(res.json())
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init("https://api.omocaptcha.com/v2/createTask");
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
      "clientKey" => "OMO_API_KEY",
      "task" => [
          "type" => "GeetestSliderWebTask",
          "imageBase64" => "BASE64_BODY_HERE"
      ]
  ]));
  echo curl_exec($ch);
  ```
</CodeGroup>

### Response

**Success:**

```json theme={null}
{
  "errorId": 0,
  "taskId": "49f9f60a-c809-4af0-93c0-0409b72e67e0"
}
```

Server returns `errorId = 0` and a `taskId` on success.

**Failure:**

```json theme={null}
{
  "errorId": 1,
  "errorCode": "",
  "errorDescription": ""
}
```

Server returns `errorId = 1` with the corresponding `errorCode`.

## 2. Get task result

### Request

`POST https://api.omocaptcha.com/v2/getTaskResult`

```json theme={null}
{
  "clientKey": "OMO_API_KEY",
  "taskId": "49f9f60a-c809-4af0-93c0-0409b72e67e0"
}
```

### Response

**Success:**

```json theme={null}
{
  "errorId": 0,
  "status": "ready",
  "solution": {
    "end": {
      "x": 150,
      "y": 42
    }
  }
}
```

Server returns `errorId = 0` and `status = ready`. Read the answer in the `solution` field.

<Tip>
  `solution.end` is the target end position (in original image pixels) the slider should be dragged to. Compute drag distance by subtracting the slider's initial x from `end.x`.
</Tip>

**Processing:**

```json theme={null}
{
  "status": "processing",
  "errorId": 0,
  "errorCode": "",
  "errorDescription": ""
}
```

Server returns `errorId = 0` and `status = processing`. Wait 2 seconds and retry.

**Failure:**

```json theme={null}
{
  "errorId": 1,
  "errorCode": "ERROR_JOB_STATUS",
  "errorDescription": "Job failed",
  "status": "fail",
  "solution": {}
}
```

Server returns `errorId = 1` when the task fails.
