Skip to content
API
Funcaptcha

Funcaptcha Image

Tổng quan

FunCaptcha (hay còn gọi là Arkose Labs Captcha) là một loại captcha tương tác, yêu cầu người dùng thực hiện các thao tác như xoay hình ảnh, kéo thả đối tượng để giải quyết thử thách. Được sử dụng bởi nhiều website lớn như Roblox, Epic Games, Outlook, v.v.

🎮

FunCaptcha được thiết kế để vừa bảo vệ khỏi bot, vừa tạo trải nghiệm "vui vẻ" cho người dùng thông qua các mini-game tương tác.

FunCaptcha FunCaptcha FunCaptcha

1. Tạo yêu cầu

Request

POST https://api.achicaptcha.com/createTask

Tham số

Tên paramKiểu dữ liệuBắt buộc?Mô tả
clientKeystringyesApi key
task.typestringyesFuncaptchaImageTask
task.subTypestringyesGiá trị bằng 1
task.imagestringyesBase64 của ảnh
task.otherstringyesCâu hỏi
Ví dụ: "Use the arrows to rotate the object to face in the direction of the hand"

Ví dụ Request

POST /createTask HTTP/1.1
Host: api.achicaptcha.com
Content-Type: application/json
 
{
  "clientKey": "API_KEY của bạn",
  "task": {
    "type": "FuncaptchaImageTask",
    "subType": "1",
    "image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...",
    "other": "Use the arrows to rotate the object to face in the direction of the hand"
  }
}

Response

Khi thành công, server sẽ trả về errorId = 0taskId

{
  "errorId": 0,
  "taskId": "f2fc70d6-c76b-4fba-9480-205ac1fe9fb9"
}

2. Lấy kết quả

Request

POST https://api.achicaptcha.com/getTaskResult

Tham số

Tên paramKiểu dữ liệuBắt buộc?Mô tả
clientKeystringyesApi key
taskIdstringyesTaskId lấy từ (1)

Ví dụ Request

POST /getTaskResult HTTP/1.1
Host: api.achicaptcha.com
Content-Type: application/json
 
{
  "clientKey": "API_KEY của bạn",
  "taskId": "f2fc70d6-c76b-4fba-9480-205ac1fe9fb9"
}

Response

{
  "errorId": 0,
  "status": "ready",
  "solution": "1" // Thứ tự ảnh cần click (Tính bắt đầu từ 0)
}

Giải thích trạng thái

  • errorId = 0status = ready: Giải thành công, đọc kết quả trong solution.answer (mảng các chỉ số hình ảnh)
  • errorId = 0status = processing: Đang giải captcha, đợi 2 giây rồi thử lại
  • errorId > 0: Lỗi hệ thống, đưa ra mã lỗi và mô tả lỗi

Ví dụ tích hợp

import requests
import time
 
def solve_funcaptcha_image(image_base64, question, api_key='YOUR_API_KEY'):
    # Bước 1: Tạo task
    create_task_url = 'https://api.achicaptcha.com/createTask'
    create_task_payload = {
        'clientKey': api_key,
        'task': {
            'type': 'FuncaptchaImageTask',
            'subType': '1',
            'image': image_base64,
            'other': question
        }
    }
    
    response = requests.post(create_task_url, json=create_task_payload)
    result = response.json()
    
    if result['errorId'] != 0:
        raise Exception(result['errorDescription'])
    
    task_id = result['taskId']
    
    # Bước 2: Lấy kết quả
    get_result_url = 'https://api.achicaptcha.com/getTaskResult'
    
    while True:
        time.sleep(2)  # Đợi 2 giây
        
        get_result_payload = {
            'clientKey': api_key,
            'taskId': task_id
        }
        
        response = requests.post(get_result_url, json=get_result_payload)
        result = response.json()
        
        if result['errorId'] != 0:
            raise Exception(result['errorDescription'])
        
        if result['status'] == 'ready':
            return result['solution']
        
        # Nếu status == 'processing', tiếp tục loop
 
# Sử dụng
image_base64 = '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...'  # Base64 của ảnh
question = 'Use the arrows to rotate the object to face in the direction of the hand'
solution = solve_funcaptcha_image(image_base64, question, 'YOUR_API_KEY')
print('FunCaptcha solution:', solution)

Các mã lỗi thường gặp

Mã lỗiMô tảChú thích
0successThành công
1processingĐang xử lý
2missing required fieldsThiếu trường bắt buộc, kiểm tra lại tham số
3task not supportedLoại task không được hỗ trợ
4task creation failedTạo task thất bại
5client key does not existAPI key không tồn tại, kiểm tra lại API key
6insufficient account balanceSố dư tài khoản không đủ, nạp thêm credit
7task failed, please create a new taskTask thất bại, vui lòng tạo task mới
8task ID does not existTask ID không tồn tại

Best Practices

Để đạt hiệu quả tốt nhất khi sử dụng API Achicaptcha cho FunCaptcha Image, hãy tuân thủ các nguyên tắc sau:

1. Xử lý ảnh Base64

  • Chỉ nhận vào 1 ảnh duy nhất. Đối với người dùng phone, cần ghép lại thành 1 ảnh to trước khi gửi
  • Đảm bảo ảnh đã được encode đúng định dạng Base64
  • Loại bỏ tiền tố data:image/...;base64, nếu có
  • Kiểm tra kích thước ảnh hợp lý (không quá lớn)

2. Câu hỏi (Question)

  • Cung cấp câu hỏi chính xác từ FunCaptcha challenge
  • Câu hỏi giúp hệ thống hiểu rõ hơn về loại thử thách
  • Ví dụ: "Use the arrows to rotate the object to face in the direction of the hand"

3. Polling interval

  • Đợi ít nhất 2 giây giữa các lần kiểm tra kết quả
  • Không spam API với quá nhiều request liên tiếp
  • Có timeout để tránh vòng lặp vô hạn (khuyến nghị 60 giây cho image task)

4. Xử lý kết quả

  • Kết quả trả về là 1 số duy nhất (chỉ số bắt đầu từ 0)
  • Sử dụng kết quả này để submit vào FunCaptcha

5. Retry logic

  • Implement retry cho các lỗi tạm thời như ERROR_NO_SLOT_AVAILABLE
  • Sử dụng exponential backoff khi retry
  • Giới hạn số lần retry tối đa

6. Bảo mật API key

  • Không hardcode API key trong code
  • Sử dụng biến môi trường
  • Không expose API key ra client-side

Liên kết hữu ích: