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

# Tiktok3DSelectObjectPhoneTask

> Giải captcha chọn 2 đối tượng 3D cùng loại trên phiên bản mobile (phone) của TikTok.

<Frame caption="Ví dụ captcha 3D Select Object trên phone (Select 2 objects that are the same shape)">
  <img src="https://mintcdn.com/omocaptcha/Jc1mwaiUF23R0W3R/images/tiktok-3d-select-phone.png?fit=max&auto=format&n=Jc1mwaiUF23R0W3R&q=85&s=b957a0837925c714234fcdc0e72f9107" style={{ maxWidth: "320px" }} width="432" height="768" data-path="images/tiktok-3d-select-phone.png" />
</Frame>

## 1. Tạo yêu cầu

**Endpoint**

```http theme={null}
POST https://api.omocaptcha.com/v2/createTask
```

### Tham số

| Tham số            | Kiểu   | Bắt buộc | Mô tả                                     |
| ------------------ | ------ | :------: | ----------------------------------------- |
| `clientKey`        | String |     ✅    | Khóa tài khoản khách hàng                 |
| `task.type`        | String |     ✅    | Tên class dịch vụ captcha cần giải        |
| `task.imageBase64` | String |     ✅    | Hình ảnh chụp màn hình được mã hóa base64 |

<Info>
  Ảnh gửi lên nên là **ảnh crop** đúng vùng challenge (như hình minh họa ở trên), không bao gồm phần header/footer của modal.
</Info>

### Ví dụ request

<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": "Tiktok3DSelectObjectPhoneTask",
        "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: "Tiktok3DSelectObjectPhoneTask",
        imageBase64: "BASE64_BODY_HERE",
      },
    }),
  });
  const data = await res.json();
  console.log(data);
  ```

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

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

  ```php PHP theme={null}
  <?php
  $payload = [
      "clientKey" => "OMO_API_KEY",
      "task" => [
          "type" => "Tiktok3DSelectObjectPhoneTask",
          "imageBase64" => "BASE64_BODY_HERE",
      ],
  ];

  $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_POSTFIELDS, json_encode($payload));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

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

### Response

**Thành công**

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

Máy chủ trả về `errorId = 0` và `taskId` khi tạo task thành công.

**Thất bại**

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

Máy chủ trả về `errorId = 1` kèm mã lỗi trong `errorCode`.

## 2. Nhận kết quả

**Endpoint**

```http theme={null}
POST https://api.omocaptcha.com/v2/getTaskResult
```

### Request

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

### Response

**Thành công**

```json theme={null}
{
  "errorId": 0,
  "status": "ready",
  "solution": {
    "pointA": { "x": 50, "y": 30 },
    "pointB": { "x": 100, "y": 70 }
  }
}
```

Máy chủ trả về `errorId = 0` và `status = ready`. Đọc kết quả trong `solution`:

* `pointA` — tọa độ đối tượng thứ nhất (x, y).
* `pointB` — tọa độ đối tượng thứ hai (x, y).

Hai điểm này ứng với 2 vật thể có cùng hình dạng trong ảnh challenge.

**Đang xử lý**

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

Máy chủ trả về `errorId = 0` và `status = processing` — yêu cầu đang được xử lý, vui lòng chờ **2 giây** rồi gọi lại.

**Thất bại**

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

Máy chủ trả về `errorId = 1` khi giải thất bại.
