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

# GeetestSelectObjectTask

> Giải Geetest Select Object captcha - chọn các hình ảnh trùng khớp với anchor

Captcha select object là một loại hình ảnh xác thực phổ biến. Người dùng cần chọn các ô hình ảnh trùng khớp với chủ đề được yêu cầu (anchor).

<Frame>
  <img src="https://mintcdn.com/omocaptcha/Jc1mwaiUF23R0W3R/images/geetest-select-object-modal.png?fit=max&auto=format&n=Jc1mwaiUF23R0W3R&q=85&s=fea5783f261c280d0f6e4b6545e6246c" style={{ maxWidth: "360px", width: "100%" }} width="338" height="382" data-path="images/geetest-select-object-modal.png" />
</Frame>

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

**Request**

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

| 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` |     ✅    | `GeetestSelectObjectTask`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `task.imageBase64` | `String` |     ✅    | Hình ảnh lưới 3×3 được mã hóa base64 <br /><br /><img src="https://mintcdn.com/omocaptcha/Jc1mwaiUF23R0W3R/images/geetest-select-object-image.png?fit=max&auto=format&n=Jc1mwaiUF23R0W3R&q=85&s=13fc3ce841d1d81ef574904e33ea96f9" style={{ maxWidth: "260px", width: "100%" }} width="299" height="258" data-path="images/geetest-select-object-image.png" /> |
| `task.question`    | `String` |     ✅    | Câu hỏi của captcha <br />(ví dụ: `Select 3 images with`)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `task.anchor`      | `String` |     ✅    | Ảnh anchor<br /><img src="https://mintcdn.com/omocaptcha/Jc1mwaiUF23R0W3R/images/geetest-select-object-anchor.png?fit=max&auto=format&n=Jc1mwaiUF23R0W3R&q=85&s=90a487ca6d756496853c98765329f172" style={{ maxWidth: "120px", width: "100%" }} width="198" height="194" data-path="images/geetest-select-object-anchor.png" />                          |

<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": "GeetestSelectObjectTask",
        "imageBase64": "BASE64_BODY_HERE",
        "question": "Select 3 images with",
        "anchor": "BASE64_ICON_HERE"
      }
    }'
  ```

  ```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: 'GeetestSelectObjectTask',
      imageBase64: 'BASE64_BODY_HERE',
      question: 'Select 3 images with',
      anchor: 'BASE64_ICON_HERE'
    }
  });
  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': 'GeetestSelectObjectTask',
          'imageBase64': 'BASE64_BODY_HERE',
          'question': 'Select 3 images with',
          'anchor': 'BASE64_ICON_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' => 'GeetestSelectObjectTask',
      'imageBase64' => 'BASE64_BODY_HERE',
      'question' => 'Select 3 images with',
      'anchor' => 'BASE64_ICON_HERE'
    ]
  ]));
  echo curl_exec($ch);
  ```
</CodeGroup>

**Response**

Thành công:

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

Máy chủ sẽ trả về `errorId = 0` và `taskId` thành công.

Thất bại:

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

Máy chủ sẽ trả về `errorId = 1` và `errorCode` mã lỗi.

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

**Request**

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

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

**Response**

Thành công:

```json theme={null}
{
  "errorId": 0,
  "errorCode": "",
  "errorDescription": "",
  "status": "ready",
  "solution": {
    "objects": [0, 1, 6]
  }
}
```

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

<Info>
  `objects` là mảng chỉ số các ô hình trùng khớp (0–8), đếm từ trái sang phải, trên xuống dưới:

  * Hàng 1: `0`, `1`, `2`
  * Hàng 2: `3`, `4`, `5`
  * Hàng 3: `6`, `7`, `8`
</Info>

Đang xử lý:

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

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

Thất bại:

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

Máy chủ sẽ trả về `errorId = 1`.
