reCAPTCHA Grid (Image Click)
This is a type of reCAPTCHA V2 where users need to select all images matching a given instruction (for example, "Select all squares with bicycles"). The image is divided into a grid (usually 3×3 or 4×4), and the appropriate cells are selected via the API GridTask method.
Returns an array of tile indices, where 0 corresponds to the top-left tile.
Supported image formats: JPEG, PNG, GIF
Maximum file size: 600 kB
Maximum image dimensions: 1000px on any side
GridTask Specification
| Property | Type | Required | Description |
|---|---|---|---|
| type | String | Yes | Task type: GridTask |
| body | String | Yes | Image encoded in Base64. Data-URI format (with data:content/type prefix) is also supported |
| rows | Integer | No | Number of rows in the grid |
| columns | Integer | No | Number of columns in the grid |
| comment | String | Yes* | Instruction text shown to workers to solve the captcha correctly |
| imgInstructions | String | Yes* | Instruction image displayed to workers. Must be Base64-encoded. Maximum file size: 100 kB |
| minClicks | Integer | No | Minimum number of tiles to be selected (default: 1). Cannot exceed rows * columns |
| maxClicks | Integer | No | Maximum number of tiles to be selected (default: rows * columns) |
| canNoAnswer | Integer | No | 0 — not allowed1 — image may not contain any tiles matching the instruction. Set to 1 only if some images may have no correct tiles. Workers will see a "No matching images" button, and the response will contain No_matching_images. |
| previousId | String | No | ID of your previous request for the same reCAPTCHA task |
| imgType | String | No | Image will be processed via Computer Vision to speed up solving. Supported values: funcaptcha — FunCaptcha version requiring a tile click. More info.funcaptcha_compare — FunCaptcha version with arrow-based selection. More info.recaptcha — reCAPTCHA. More info.Important: when using imgType, always provide the comment parameter containing the original instruction in English and send the original image files rather than screenshots. |
- Either
commentorimgInstructionsmust be provided.
Example Request
Method: createTask
API endpoint: https://api.2captcha.com/createTask
json
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "GridTask",
"body": "/9j/4AAQSkZJRgABAQAAAQ..HIAAAAAAQwAABtbnRyUkdCIFhZ.wc5GOGSRF//Z",
"imgType": "recaptcha",
"comment": "select all vehicles",
"rows": 4,
"columns": 4
}
}
Example Response
Method: getTaskResult
API endpoint: https://api.2captcha.com/getTaskResult
json
{
"errorId": 0,
"status": "ready",
"solution": {
"click": [
4,
8,
12,
16
]
},
"cost": "0.0012",
"ip": "1.2.3.4",
"createTime": 1692863536,
"endTime": 1692863556,
"solveCount": 1
}
Examples
php
// https://github.com/2captcha/2captcha-php
require(__DIR__ . '/../src/autoloader.php');
$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
try {
$result = $solver->grid('path/to/captcha.jpg', ['imgType' => 'recaptcha']);
} catch (\Exception $e) {
die($e->getMessage());
}
die('Captcha solved: ' . $result->code);
python
# https://github.com/2captcha/2captcha-python
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from twocaptcha import TwoCaptcha
api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')
solver = TwoCaptcha(api_key)
try:
result = solver.grid('path/to/captcha.jpg', imgType='recaptcha')
except Exception as e:
sys.exit(e)
else:
sys.exit('solved: ' + str(result))
csharp
// https://github.com/2captcha/2captcha-csharp
using System;
using System.Linq;
using TwoCaptcha.Captcha;
namespace TwoCaptcha.Examples
{
public class GridExample
{
public static void Main()
{
var solver = new TwoCaptcha("YOUR_API_KEY");
Grid captcha = new Grid("path/to/captcha.jpg");
captcha.ImgType = "recaptcha";
try
{
solver.Solve(captcha).Wait();
Console.WriteLine("Captcha solved: " + captcha.Code);
}
catch (AggregateException e)
{
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
}
}
}
}
java
// https://github.com/2captcha/2captcha-java
package examples;
import com.twocaptcha.TwoCaptcha;
import com.twocaptcha.captcha.Grid;
public class GridExample {
public static void main(String[] args) {
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
Grid captcha = new Grid("path/to/captcha.jpg");
captcha.setImgType("recaptcha");
try {
solver.solve(captcha);
System.out.println("Captcha solved: " + captcha.getCode());
} catch (Exception e) {
System.out.println("Error occurred: " + e.getMessage());
}
}
}
go
// https://github.com/2captcha/2captcha-go
package main
import (
"fmt"
"log"
"github.com/2captcha/2captcha-go"
)
func main() {
client := api2captcha.NewClient("API_KEY")
captcha := api2captcha.Grid{
File: "/path/to/captcha.jpg",
ImgType: "recaptcha",
}
code, err := client.Solve(captcha.ToRequest())
if err != nil {
log.Fatal(err);
}
fmt.Println("code "+code)
}
ruby
require 'api_2captcha'
client = Api2Captcha.new("YOUR_API_KEY")
result = client.grid({
image: 'path/to/captcha.jpg',
imgType: 'recaptcha'
})