Skip to content
API
Text Captcha

Text Captcha

Overview

A standard text captcha is an image containing distorted text that is readable by humans. To solve the captcha image, users must enter the text from the image.

📝

Text captcha can include numbers, letters, or a combination of both. They typically use image distortions, noise, and various fonts to make automated reading difficult.

Common text captcha

1. Create Task

Request

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

Parameters

ParameterData TypeRequired?Description
clientKeystringyesAPI key
task.typestringyesImageToTextTask
task.imagestringyesBase64 of the image
task.subTypestringyesOne of the following types: common, amazon, microsoft, facebook, garena, artistshot, gmx, 11166, houssam

Request Example

POST /createTask HTTP/1.1
Host: api.achicaptcha.com
Content-Type: application/json
 
{
  "clientKey": "Your API_KEY",
  "task": {
    "type": "ImageToTextTask",
    "image": "base64 encoded image",
    "subType": "gmx"
  }
}

Response

On success, the server will return errorId = 0 and taskId

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

2. Get Result

Request

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

Parameters

ParameterData TypeRequired?Description
clientKeystringyesAPI key
taskIdstringyesTaskId from step (1)

Request Example

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

Response

{
  "errorId": 0,
  "status": "ready",
  "solution": "swamn"
}

Status Explanation

  • errorId = 0 and status = ready: Successfully solved, read result in solution.text
  • errorId = 0 and status = processing: Captcha is being solved, wait 2 seconds and try again
  • errorId > 0: System error, error code and description provided

SubType Options

Achicaptcha supports various types of text captcha through the subType parameter:

SubTypeDescription
commonCommon text captcha, most popular
amazonAmazon-specific captcha with special distortion
microsoftCaptcha used on Microsoft services
facebookFacebook captcha with distinctive fonts
garenaCaptcha on Garena platform
artistshotCaptcha from Artistshot website
gmxGMX email captcha
11166Special captcha type with code 11166
houssamSpecific captcha type named Houssam
discordDiscord-specific captcha type
okvipOKVIP-specific captcha type
shopeeShopee-specific captcha type
📝

Typically subType: common can handle all types of text captcha. If your website's text captcha is too specific, please contact admin (opens in a new tab) for support.

Integration Examples

import requests
import time
import base64
 
def solve_captcha(image_path, sub_type='common', api_key='YOUR_API_KEY'):
    # Read and encode image
    with open(image_path, 'rb') as image_file:
        image_base64 = base64.b64encode(image_file.read()).decode('utf-8')
    
    # Step 1: Create task
    create_task_url = 'https://api.achicaptcha.com/createTask'
    create_task_payload = {
        'clientKey': api_key,
        'task': {
            'type': 'ImageToTextTask',
            'image': image_base64,
            'subType': sub_type
        }
    }
    
    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']
    
    # Step 2: Get result
    get_result_url = 'https://api.achicaptcha.com/getTaskResult'
    
    while True:
        time.sleep(2)  # Wait 2 seconds
        
        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']
        
        # If status == 'processing', continue loop
 
# Usage
solution = solve_captcha('captcha.png', 'common', 'YOUR_API_KEY')
print('Captcha result:', solution)

Common Error Codes

Error CodeDescriptionNotes
0successSuccess
1processingProcessing
2missing required fieldsMissing required fields, check parameters
3task not supportedTask type not supported
4task creation failedTask creation failed
5client key does not existAPI key does not exist, check your API key
6insufficient account balanceInsufficient account balance, add more credits
7task failed, please create a new taskTask failed, please create a new task
8task ID does not existTask ID does not exist

Best Practices

To achieve the best results when using Achicaptcha API, follow these principles:

1. Image Quality

  • Use images with good resolution
  • Ensure images are not too blurry or noisy
  • Choose the appropriate subType for your captcha type

2. Polling Interval

  • Wait at least 2 seconds between result checks
  • Don't spam the API with too many consecutive requests
  • Have a timeout to avoid infinite loops

3. Retry Logic

  • Implement retry for temporary errors like ERROR_NO_SLOT_AVAILABLE
  • Use exponential backoff when retrying
  • Limit maximum retry attempts

4. API Key Security

  • Don't hardcode API key in code
  • Use environment variables
  • Don't expose API key on client-side

Useful Links: