> ## 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.

# TiktokSliderWebTask

> Solve Tiktok slider (drag & drop) captcha on the web.

Slider on the web is a common captcha type. The user needs to drag a puzzle piece to the correct position on the background image.

<Frame caption="Example of Tiktok slider captcha">
  <img src="https://mintcdn.com/omocaptcha/Jc1mwaiUF23R0W3R/images/tiktok-slider-modal.png?fit=max&auto=format&n=Jc1mwaiUF23R0W3R&q=85&s=771d1be0b42a926503dc45968574a8e3" style={{ maxWidth: "720px", width: "100%" }} width="1017" height="787" data-path="images/tiktok-slider-modal.png" />
</Frame>

## 1. Create task

### Request

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

| Parameter          | Type     | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------ | -------- | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `clientKey`        | `String` |     ✅    | Client account API key                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `task.type`        | `String` |     ✅    | Captcha service class name: `TiktokSliderWebTask`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `task.imageBase64` | `String` |     ✅    | Screenshot encoded as base64 (without `data:image/...;base64,` prefix)<br /><br /><img src="https://mintcdn.com/omocaptcha/Jc1mwaiUF23R0W3R/images/tiktok-slider-image.png?fit=max&auto=format&n=Jc1mwaiUF23R0W3R&q=85&s=c83d7b0f2c9596667b2e19240c5dd1d3" style={{ maxWidth: "260px", width: "100%" }} width="552" height="344" data-path="images/tiktok-slider-image.png" />                                                                                                                                                         |
| `task.widthView`   | `Number` |     ✅    | Rendered image width on the web (px). In DevTools, right-click the captcha image → **Inspect**, then look at **Rendered size** (e.g. `340 × 212 px`) — the first value is `widthView`.<br /><br /><img src="https://mintcdn.com/omocaptcha/Jc1mwaiUF23R0W3R/images/tiktok-slider-width-view.png?fit=max&auto=format&n=Jc1mwaiUF23R0W3R&q=85&s=f9ff364f1d51dfbd48ab3f48f7629b21" style={{ maxWidth: "320px", width: "100%" }} width="380" height="214" data-path="images/tiktok-slider-width-view.png" /> |

### Sample code

<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": "TiktokSliderWebTask",
        "imageBase64": "BASE64_BODY_HERE",
        "widthView": 340
      }
    }'
  ```

  ```javascript Node.js theme={null}
  const axios = require('axios');

  const { data } = await axios.post('https://api.omocaptcha.com/v2/createTask', {
    clientKey: 'OMO_API_KEY',
    task: {
      type: 'TiktokSliderWebTask',
      imageBase64: 'BASE64_BODY_HERE',
      widthView: 340,
    },
  });

  console.log(data);
  ```

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

  resp = requests.post('https://api.omocaptcha.com/v2/createTask', json={
      'clientKey': 'OMO_API_KEY',
      'task': {
          'type': 'TiktokSliderWebTask',
          'imageBase64': 'BASE64_BODY_HERE',
          'widthView': 340,
      },
  })

  print(resp.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' => 'TiktokSliderWebTask',
          'imageBase64' => 'BASE64_BODY_HERE',
          'widthView' => 340,
      ],
  ]));

  $response = curl_exec($ch);
  curl_close($ch);
  echo $response;
  ```
</CodeGroup>

### Response

**Success:**

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

The server returns `errorId = 0` and a `taskId` on success.

**Failure:**

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

The server returns `errorId = 1` and the corresponding `errorCode`. See the [Error codes](/en/api/error-codes) list.

## 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
    }
  }
}
```

The server returns `errorId = 0` and `status = ready`. Read the result from the `solution` field.

| Field            | Type   | Description                                                                       |
| ---------------- | ------ | --------------------------------------------------------------------------------- |
| `solution.end.x` | Number | Target **X** coordinate to drag the puzzle piece to (px, relative to `widthView`) |
| `solution.end.y` | Number | Target **Y** coordinate to drag the puzzle piece to (px)                          |

<Tip>
  `end` is the **target position** of the puzzle piece on the image (scaled to `widthView`). Combine it with the original slider button position to compute the drag distance, then simulate a natural mouse drag (mousedown → mousemove → mouseup).
</Tip>

**Processing:**

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

The server returns `errorId = 0` and `status = processing`. Please wait **2 seconds** and retry.

**Failure:**

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

The server returns `errorId = 1`. See details in [Error codes](/en/api/error-codes).
