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

# FuncaptchaImageTask

> Giải FunCaptcha (Arkose Labs) dạng hình ảnh

FunCaptcha là một loại hình ảnh xác thực phổ biến.

<Columns cols={3}>
  <Frame caption="Dùng mũi tên để chọn ảnh có tổng số phi tiêu bằng số ở ảnh bên trái">
    <img src="https://mintcdn.com/omocaptcha/Jc1mwaiUF23R0W3R/images/funcaptcha-darts.png?fit=max&auto=format&n=Jc1mwaiUF23R0W3R&q=85&s=c23a3addf1eff8e5c9abec3ebcb0a35c" alt="FunCaptcha darts challenge" width="304" height="404" data-path="images/funcaptcha-darts.png" />
  </Frame>

  <Frame caption="Dùng mũi tên để xoay đối tượng hướng theo bàn tay">
    <img src="https://mintcdn.com/omocaptcha/Jc1mwaiUF23R0W3R/images/funcaptcha-rotate.png?fit=max&auto=format&n=Jc1mwaiUF23R0W3R&q=85&s=3b6395b6a057132472b475c82221df12" alt="FunCaptcha rotate object challenge" width="305" height="404" data-path="images/funcaptcha-rotate.png" />
  </Frame>

  <Frame caption="Chọn ảnh có hướng đứng đúng">
    <img src="https://mintcdn.com/omocaptcha/Jc1mwaiUF23R0W3R/images/funcaptcha-orientation.png?fit=max&auto=format&n=Jc1mwaiUF23R0W3R&q=85&s=e4295df1f84488a61d8bca8da18dba9a" alt="FunCaptcha orientation challenge" width="323" height="314" data-path="images/funcaptcha-orientation.png" />
  </Frame>
</Columns>

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

### Request

```http theme={null}
POST https://api.omocaptcha.com/v2/createTask
Content-Type: application/json
```

#### Body Parameters

| 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 (`FuncaptchaImageTask`) |
| `task.imageBase64` | `String` |     ✅    | Hình ảnh được mã hóa base64 (không phải ảnh chụp màn hình) |
| `task.other`       | `String` |     ✅    | Văn bản câu hỏi captcha                                    |

<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": "FuncaptchaImageTask",
        "imageBase64": "BASE64_BODY_HERE",
        "other": "Use the arrows to pick the image where all the darts add up to the number in the left image"
      }
    }'
  ```

  ```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: "FuncaptchaImageTask",
        imageBase64: "BASE64_BODY_HERE",
        other: "Use the arrows to pick the image where all the darts add up to the number in the left image"
      }
    })
  });
  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": "FuncaptchaImageTask",
              "imageBase64": "BASE64_BODY_HERE",
              "other": "Use the arrows to pick the image where all the darts add up to the number in the left image"
          }
      }
  )
  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" => "FuncaptchaImageTask",
          "imageBase64" => "BASE64_BODY_HERE",
          "other" => "Use the arrows to pick the image where all the darts add up to the number in the left image"
      ]
  ]));
  echo curl_exec($ch);
  ```
</CodeGroup>

### Response

<CodeGroup>
  ```json Thành công theme={null}
  {
    "errorId": 0,
    "taskId": "49f9f60a-c809-4af0-93c0-0409b72e67e0"
  }
  ```

  ```json Thất bại theme={null}
  {
    "errorId": 1,
    "errorCode": "",
    "errorDescription": ""
  }
  ```
</CodeGroup>

* `errorId = 0` và `taskId` → thành công
* `errorId = 1` và `errorCode` → thất bại (tra [Bảng mã lỗi](/vi/api/bang-ma-loi))

## 2. Nhận kết quả yêu cầu

### Request

```http theme={null}
POST https://api.omocaptcha.com/v2/getTaskResult
Content-Type: application/json
```

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

### Response

<CodeGroup>
  ```json Thành công theme={null}
  {
    "errorId": 0,
    "status": "ready",
    "solution": {
      "index": 1
    }
  }
  ```

  ```json Đang xử lý theme={null}
  {
    "status": "processing",
    "errorId": 0,
    "errorCode": "",
    "errorDescription": ""
  }
  ```

  ```json Thất bại theme={null}
  {
    "errorId": 1,
    "errorCode": "ERROR_JOB_STATUS",
    "errorDescription": "Job failed",
    "status": "fail",
    "solution": {}
  }
  ```
</CodeGroup>

* `errorId = 0` và `status = "ready"` → đọc kết quả trong `solution.index`.
* `errorId = 0` và `status = "processing"` → yêu cầu đang xử lý, chờ **2 giây** rồi gọi lại.
* `errorId = 1` → thất bại (tra [Bảng mã lỗi](/vi/api/bang-ma-loi)).

<Warning>
  Server trả về **vị trí của ảnh đúng** trong dãy. Khi click nút mũi tên phải trên web, bạn phải **trừ đi 1** vì ảnh captcha đang ở vị trí thứ nhất.

  Ví dụ: server trả về `index = 5` → click nút mũi tên phải **4 lần**.
</Warning>
