Skip to content
API
Grid Captcha
Amazon

Amazon Grid Captcha

Overview

Amazon Grid Captcha is a grid selection captcha: the page shows a question/prompt and a grid of tiles. The solver must return which grid cells match the question (0-based indices, row-major: left-to-right, top-to-bottom).

🔲

The task.image field can encode the grid image as a single Base64 string or as 9 separate 1x1 images (Base64, separated by |)

Amazon Grid Captcha UI example

1. Create Task

Image Submission Format

Grid image 3x3 Amazon Grid Captcha request payload (grid) Or 9 separate 1x1 images

Request

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

Parameters

Parameter NameData TypeRequired?Description
clientKeystringyesAPI key
task.typestringyesGridCaptcha
task.subTypestringyesamzn
task.imagestringyesBase64-encoded grid image
task.otherstringyesThe question/prompt text shown to the user (e.g. "the curtains")

Request Example

POST /createTask HTTP/1.1
Host: api.achicaptcha.com
Content-Type: application/json
 
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "GridCaptcha",
    "subType": "amzn",
    "image": "BASE64_GRID_IMAGE",
    "other": "the curtains"
  }
}

Response

When successful, server returns errorId = 0 and taskId

{
  "errorId": 0,
  "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

2. Get Result

Request

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

Parameters

Parameter NameData TypeRequired?Description
clientKeystringyesAPI key
taskIdstringyesTaskId obtained from step (1)

Request Example

POST /getTaskResult HTTP/1.1
Host: api.achicaptcha.com
Content-Type: application/json
 
{
  "clientKey": "YOUR_API_KEY",
  "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Response

{
  "errorId": 0,
  "status": "ready",
  "solution": {
    "click": "0,2,5"
  }
}

solution.click is a comma-separated string of 0-based cell indices (row-major) to click in the grid.

Status Explanation

  • errorId = 0 and status = ready: Successfully solved, read cell indices in solution.click
  • errorId = 0 and status = processing: Still solving, wait 2 seconds and poll again
  • errorId > 0: System error, check errorCode and errorDescription

Integration Examples

import requests
import base64
import time
 
def solve_amzn(grid_path, question, api_key='YOUR_API_KEY'):
    with open(grid_path, 'rb') as f:
        grid_b64 = base64.b64encode(f.read()).decode()
 
    # Step 1: Create task
    create_resp = requests.post(
        'https://api.achicaptcha.com/createTask',
        json={
            'clientKey': api_key,
            'task': {
                'type': 'GridCaptcha',
                'subType': 'amzn',
                'image': grid_b64,
                'other': question
            }
        }
    )
    result = create_resp.json()
 
    if result['errorId'] != 0:
        raise Exception(result['errorDescription'])
 
    task_id = result['taskId']
 
    # Step 2: Poll for result
    while True:
        time.sleep(2)
        poll_resp = requests.post(
            'https://api.achicaptcha.com/getTaskResult',
            json={'clientKey': api_key, 'taskId': task_id}
        )
        result = poll_resp.json()
 
        if result['errorId'] != 0:
            raise Exception(result['errorDescription'])
 
        if result['status'] == 'ready':
            return result['solution']['click']  # e.g. "0,2,5"
 
# Usage
indices = solve_amzn('grid.png', 'the curtains', 'YOUR_API_KEY')
print('Cells to click:', indices)

Common Error Codes

Error CodeDescriptionNotes
0successSuccess
1processingProcessing
2missing required fieldsMissing required fields, check parameters again
3task not supportedTask type not supported
4task creation failedTask creation failed
5client key does not existAPI key does not exist, check API key again
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

For best results when using Achicaptcha API for Amazon Grid Captcha, follow these principles:

1. Image Encoding

  • Send only the grid image as a single Base64 string
  • Do not include the data:image/...;base64, prefix — raw Base64 only
  • Ensure the image is fully loaded and encoded before sending

2. task.other Parameter

  • Pass the exact question text displayed to the user (e.g. "the curtains")
  • This field is required — omitting it will cause incorrect results
  • Copy the question string verbatim from the captcha challenge

3. Polling Interval

  • Wait at least 2 seconds between result checks
  • Do not spam the API with consecutive requests
  • Set a timeout to avoid infinite loops (recommended: 60 seconds)

4. Result Processing

  • solution.click is a comma-separated string of 0-based cell indices (row-major, left-to-right, top-to-bottom)
  • Split by , and convert to integers before clicking the corresponding grid cells

5. Retry Logic

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

6. API Key Security

  • Do not hardcode your API key in source code
  • Use environment variables or a secrets manager
  • Never expose the API key on the client side

Useful links: