# Image to Text - Captcha dạng ảnh chữ

Captcha thông thường là một hình ảnh có chứa văn bản bị bóp méo nhưng con người có thể đọc được. Để giải quyết hình ảnh xác thực, người dùng phải nhập văn bản từ hình ảnh. trông giống như những hình ảnh dưới đây

<figure><img src="/files/WjuqZAIOrFHABGjhwiGr" alt=""><figcaption></figcaption></figure>

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

<mark style="color:red;">**POST :**</mark> <mark style="color:red;"></mark><mark style="color:red;">`https://anticaptcha.top/api/captcha`</mark>

**Các tham số Body**:

<table data-header-hidden><thead><tr><th width="197">Tên trường dữ liệu</th><th width="134"></th><th width="105"></th><th></th></tr></thead><tbody><tr><td><strong>Tên trường dữ liệu</strong></td><td><strong>Kiểu dữ liệu</strong></td><td><strong>Bắt buộc</strong></td><td><strong>Mô tả</strong></td></tr><tr><td>apikey</td><td>String</td><td>x</td><td>Key duy nhất để xác định đối tác API</td></tr><tr><td>img</td><td>String</td><td>x</td><td>Link ảnh hoặc ảnh dạng base64<br><mark style="color:red;">Lưu ý:</mark> <br>- <mark style="color:red;">vietinbank</mark> thì truyền giá trị là thẻ svg<br><em>ví dụ: &#x3C;svg xmnls="http://www.w3.org/2000/svg"width="192" height="24">&#x3C;path xmlns="http://www.w3.org/2000/svg" fill="#111" d="M87.37 4.87L86.43 4.87L86.43 3.68L84......&#x3C;/svg></em><br>- <mark style="color:red;">hóa đơn điện tử</mark> thì truyền giá trị là file .svg hoặc base64 svg<br><em>ví dụ: data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL.....</em></td></tr><tr><td>type</td><td>Integer</td><td>x</td><td><strong>Kiểu captcha</strong><br>Xem chi tiết ở <a href="#bang-tham-so-type">bảng tham số type bên dưới</a></td></tr><tr><td>calc</td><td>Integer</td><td></td><td><mark style="color:red;"><strong>1</strong></mark>: <strong>Kiểu toán học</strong><br>Ví dụ: 2 + 7 = 9</td></tr><tr><td>numeric</td><td>Integer</td><td></td><td><mark style="color:red;"><strong>1</strong></mark>: <strong>Kiểu số</strong><br>Nếu captcha là dạng chỉ toàn số thì truyền thêm tham số numeric=1 để áp buộc giải ra dạng số, tránh một số captcha hay bị giải sai ở số 0 thành chữ O</td></tr><tr><td>casesensitive</td><td>Integer</td><td></td><td><mark style="color:red;"><strong>1</strong></mark>: Giải ra kết quả phân biệt chữ hoa chữ thường</td></tr></tbody></table>

### **Bảng tham số Type**

<table><thead><tr><th width="165">Ảnh minh họa</th><th width="355">Loại Captcha</th><th width="74">Type</th><th>Size ảnh captcha</th></tr></thead><tbody><tr><td><img src="/files/pPEuMeZROb7HosemsjiM" alt="" data-size="line"></td><td><strong>Captcha MyViettel</strong></td><td><mark style="color:red;"><strong>1</strong></mark></td><td>320x80px</td></tr><tr><td><img src="/files/4B1xcPfi98eN330dWOoT" alt="" data-size="line"></td><td><strong>Captcha MyVina/MyVnpt</strong></td><td><mark style="color:red;"><strong>3</strong></mark></td><td></td></tr><tr><td><img src="/files/3M1LNGLImg22AZeuhetE" alt="" data-size="original"><br><img src="/files/iUx3eXHe1xNPj0gHuGi8" alt=""></td><td><strong>Captcha FACEBOOK</strong></td><td><mark style="color:red;"><strong>6</strong></mark></td><td>280x70px</td></tr><tr><td><img src="/files/7xl6y0Nt2crx9HTmmjiI" alt="" data-size="line"></td><td><strong>Captcha GARENA</strong></td><td><mark style="color:red;"><strong>7</strong></mark></td><td>160x60px</td></tr><tr><td><img src="/files/zMrngSaGgv4JqO69slXd" alt="" data-size="line"></td><td><strong>Captcha Vietcombank Cá Nhân</strong></td><td><mark style="color:red;"><strong>9</strong></mark></td><td>112x36px hoặc 155x50px</td></tr><tr><td><img src="/files/fmJHLkXgCjKeQqvVsTAy" alt="" data-size="line"><br><img src="/files/GoL0erPdaqaEIV6bKsJi" alt=""></td><td><strong>Captcha AMAZONE</strong></td><td><mark style="color:red;"><strong>10</strong></mark></td><td>200x70px và 300x50px</td></tr><tr><td><img src="/files/3kpYsfhHThGWLoRlYPDM" alt="" data-size="line"></td><td><strong>Captcha MBBank Cá Nhân</strong></td><td><mark style="color:red;"><strong>18</strong></mark></td><td>160x50px</td></tr><tr><td><img src="/files/h3zyH1MIiMYsEAeVd1SC" alt="" data-size="original"></td><td><strong>Captcha VietinBank Cá Nhân</strong></td><td><mark style="color:red;"><strong>19</strong></mark></td><td>truyền giá trị là thẻ html svg</td></tr><tr><td><img src="/files/hhXTDW3kb9kSiL27qkfZ" alt="" data-size="line"></td><td><strong>Captcha MAJESTIC</strong></td><td><mark style="color:red;"><strong>20</strong></mark></td><td>150x40px</td></tr><tr><td><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaiWdIa3pJ7tiyJ3OnlF8%2Fuploads%2FNsbuCWJJE9OrNp65iBrZ%2Fimage.png?alt=media&#x26;token=000262ec-a427-4088-b519-c8dd042d26b1" alt=""></td><td><strong>Captcha Hóa Đơn Điện Tử</strong></td><td><mark style="color:red;"><strong>28</strong></mark></td><td>200x40px</td></tr><tr><td><img src="/files/KqkuRTWtfTGIxDvgW16Q" alt=""></td><td><strong>Captcha Tra Cứu Thông Tin Người Nộp Thuế</strong></td><td><mark style="color:red;"><strong>29</strong></mark></td><td>117x45px hoặc 130x50px</td></tr><tr><td><img src="/files/jYltvyBTo6OWcDgc5UgF" alt=""></td><td><strong>Captcha Tra Cứu Thông Tin Hóa Đơn</strong></td><td><mark style="color:red;"><strong>30</strong></mark></td><td>120x25px</td></tr><tr><td><img src="/files/cYPHTXWQge82OOnZLk1F" alt="" data-size="original"></td><td><strong>Captcha BIDV Đăng Ký Trực Tuyến</strong></td><td><mark style="color:red;"><strong>31</strong></mark></td><td>110x44px</td></tr><tr><td><img src="/files/lVvMzZ2EDB8ByKjMRNBF" alt="" data-size="original"></td><td><strong>Captcha AgriBank Mua Vàng JSC</strong></td><td><mark style="color:red;"><strong>32</strong></mark></td><td>490x60px</td></tr><tr><td><img src="/files/CkDgq0t4LN087XMhKM5i" alt="" data-size="original"></td><td><strong>Captcha Vietcombank DigiBiz Doanh Nghiệp SME</strong></td><td><mark style="color:red;"><strong>33</strong></mark></td><td>145x50px</td></tr><tr><td><img src="/files/pYegTeRzYU2cgD2Y3Ljj" alt="" data-size="original"></td><td>Các captcha dạng <strong>Image to text</strong> không thuộc các loại trên thì dùng loại này</td><td><mark style="color:red;"><strong>14</strong></mark></td><td>Nhiều kích thước</td></tr><tr><td><div><figure><img src="/files/n5ztAPtC3YP8Jj1gtYBS" alt=""><figcaption></figcaption></figure></div></td><td><strong>Captcha Discord App</strong><br><em>Lưu ý: chỉ hỗ trợ dạng số, chưa hỗ trợ dạng chữ</em></td><td><mark style="color:red;"><strong>34</strong></mark></td><td>300x100px</td></tr><tr><td><div><figure><img src="/files/ChBw34SmleKTRcfXpzR9" alt=""><figcaption></figcaption></figure></div></td><td><strong>Captcha MSB Cá Nhân</strong></td><td><mark style="color:red;"><strong>38</strong></mark></td><td>68x22px</td></tr><tr><td><div><figure><img src="/files/Pi7OUFfLAXI4D6CRig15" alt=""><figcaption></figcaption></figure></div></td><td><strong>Captcha Size 120x50</strong></td><td><mark style="color:red;"><strong>39</strong></mark></td><td>120x50px</td></tr><tr><td><div><figure><img src="/files/JPUWKpUe5bWiFURJnZav" alt=""><figcaption></figcaption></figure></div></td><td><strong>Captcha BIDV Cá Nhân</strong></td><td><mark style="color:red;"><strong>40</strong></mark></td><td>145x50px</td></tr><tr><td><div><figure><img src="/files/E2EztkkkIRxYqJDsEZDw" alt=""><figcaption></figcaption></figure></div></td><td><strong>Captcha MyViettel mới</strong></td><td><mark style="color:red;"><strong>48</strong></mark></td><td>320x80px</td></tr><tr><td><div><figure><img src="/files/M70XPvfSJwB7kcDujxgz" alt=""><figcaption></figcaption></figure></div></td><td><strong>Captcha MBBank Doanh Nghiệp</strong></td><td><mark style="color:red;"><strong>49</strong></mark></td><td>200x35px</td></tr><tr><td><div><figure><img src="/files/1aapTtGPwA8R3ti68tqd" alt=""><figcaption></figcaption></figure></div></td><td><strong>Captcha Size 300x50</strong></td><td><mark style="color:red;"><strong>50</strong></mark></td><td>300x50px</td></tr><tr><td><div><figure><img src="/files/LMjmmSTT90Le74SqDM06" alt=""><figcaption></figcaption></figure></div></td><td><strong>Captcha Size 338x117</strong></td><td><mark style="color:red;"><strong>55</strong></mark></td><td>338x117px</td></tr><tr><td><div><figure><img src="/files/him77dcBMsXiBDecNCf7" alt=""><figcaption></figcaption></figure></div></td><td><strong>Captcha image to text phép toán</strong></td><td><mark style="color:red;"><strong>58</strong></mark></td><td></td></tr><tr><td><div><figure><img src="/files/RlRHKo9s04NU5cQnn0dN" alt=""><figcaption></figcaption></figure></div></td><td><strong>Captcha ACB</strong></td><td><mark style="color:red;"><strong>59</strong></mark></td><td>100x27px</td></tr></tbody></table>

```http
POST HTTP
Url: https://anticaptcha.top/api/captcha
Content-Type: application/json

{
	"apikey": "YOUR_API_KEY",
	"img": "image base64 encoded hoặc url ảnh",
	"type": 9 // id loại captcha muốn giải theo bảng trên
}
```

### 2. Kết quả trả về/Response

Kết quả trả về dạng JSON gồm các trường sau

<table data-header-hidden><thead><tr><th width="201"></th><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Tên trường dữ liệu</strong></td><td><strong>Kiểu dữ liệu</strong></td><td><strong>Mô tả</strong></td></tr><tr><td>success</td><td>boolean</td><td><p>Mã thông báo xác định kết quả của bước gửi captcha qua POST</p><p><mark style="color:red;"><strong>true</strong></mark>: Thành công<br><mark style="color:red;"><strong>false</strong></mark>: Thất bại</p></td></tr><tr><td>message</td><td>String</td><td>Thông báo tương ứng nếu có</td></tr><tr><td>captcha</td><td>String</td><td>mã captcha đã giải</td></tr><tr><td>base64img</td><td>String</td><td></td></tr></tbody></table>

{% tabs %}
{% tab title="Thành công" %}

```json
{
	"success": true,
	"message": "Thành công",
	"captcha": "764NHK", //kết quả giải ra
	"base64img": "/9j/4AAQSkZJRgABAgAAAQABAAsLDBkSEw8UHRofHh0aHBwgJC4nICI..."
}
```

{% endtab %}

{% tab title="Thất bại" %}

```json
{
	"success": false,
	"message": null,
	"captcha": null,
	"base64img": "/9j/4AAQSkZJRgABAgAAAQABAAsLDBkSEw8UHRofHh0aHBwgJC4nICI..."
}
```

hoặc

```json
{
	"success": false,
	"message": "Số xu không đủ",
	"captcha": ""
}
```

hoặc

```json
{
	"success": false,
	"message": "Api key không chính xác",
	"captcha": ""
}
```

{% endtab %}
{% endtabs %}

### 3. Code mẫu

{% tabs %}
{% tab title="C#" %}

```csharp
public class CatpchaResult
{
    public string log { get; set; }
    public bool status { get; set; }
    public string catcha { get; set; }
}
public class AnticaptchaTopApi
{
    public string apiKey = "";
    public string Post(string url, object data, string method = "POST")
    {
        int num = 0;
        NameValueCollection values;
        while (num < 1)
        {
            try
            {
                using (WebClient webClient = new WebClient())
                {
                    values = new NameValueCollection();
                    if (data != null)
                    {
                        data.GetType().GetProperties().ToList().ForEach(delegate (PropertyInfo pi)
                        {
                            values.Add(pi.Name, (pi.GetValue(data, null) ?? "").ToString());
                        });
                        byte[] bytes = webClient.UploadValues(url, method, values);
                        return Encoding.UTF8.GetString(bytes);
                    }
                    return webClient.DownloadString(url);
                }
             }
            catch
            {                
            }
        }
        return "";
    }
    public CatpchaResult GetCatpcha(string img, int type)
    {
        var data = new
        {
            apikey = apiKey,
            type = type,
            img = img            
        };
        var rs = new CatpchaResult
        {
            status = false
        };
        try
        {
            var result = JsonConvert.DeserializeObject<dynamic>(Post("https://anticaptcha.top/api/captcha", data));
            if (result.success == true)
            {
                rs.status = true;
                rs.catcha = result.captcha;
                rs.log = result.message;
            }
        }
        catch
        {
        }
        return rs;
    }
}
```

{% endtab %}

{% tab title="PHP Curl" %}

```php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://anticaptcha.top/api/captcha",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"apikey\"\r\n\r\n[apikey]\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\n9\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"img\"\r\n\r\n[url ảnh hoặc base64]\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache",
    "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

{% endtab %}

{% tab title="Javascript Jquery AJAX" %}

```javascript
var form = new FormData();
form.append("apikey", "[apikey]");
form.append("type", "9");
form.append("img", "[url ảnh hoặc base64]");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://anticaptcha.top/api/captcha",
  "method": "POST",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

### *<mark style="color:red;">Lưu ý</mark>:* Nên sử dụng phần mềm PostMan để kiểm tra chạy test trước


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.anticaptcha.top/su-dung-api/api-giai-captcha/image-to-text-captcha-dang-anh-chu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
