Skip to content

Image Coordinates

Image Coordinates tasks identify specific objects within an image and return their click positions as x/y coordinate pairs. This is used for CAPTCHAs that ask users to click on particular items, such as “Click on all traffic lights” or “Click the center of the object.”

TypeDescription
ImageCoordinatesTaskClick objects in an image and return coordinates
ParameterTypeRequiredDescription
typestringYesImageCoordinatesTask
bodystringYesBase64-encoded image
commentstringNoInstructions (e.g., “Click on all traffic lights”)
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "ImageCoordinatesTask",
"body": "iVBORw0KGgoAAAANSUhEUg...",
"comment": "Click on all traffic lights"
}
}
{
"errorId": 0,
"status": "ready",
"solution": {
"coordinates": [
{ "x": 120, "y": 45 },
{ "x": 230, "y": 180 }
]
}
}
{
"coordinates": [
{ "x": 120, "y": 45 },
{ "x": 230, "y": 180 }
]
}
FieldTypeDescription
coordinatesarrayArray of {x, y} coordinate pairs representing click positions

Each coordinate object contains:

FieldTypeDescription
xintegerHorizontal pixel position from the left edge
yintegerVertical pixel position from the top edge
import requests
import base64
API_KEY = "YOUR_API_KEY"
with open("captcha.png", "rb") as f:
image_data = base64.b64encode(f.read()).decode()
response = requests.post("https://api.ucaptcha.net/createTask", json={
"clientKey": API_KEY,
"task": {
"type": "ImageCoordinatesTask",
"body": image_data,
"comment": "Click on all traffic lights"
}
}).json()
if response.get("status") == "ready":
coords = response["solution"]["coordinates"]
for point in coords:
print(f"Click at ({point['x']}, {point['y']})")
else:
import time
task_id = response["taskId"]
while True:
result = requests.post("https://api.ucaptcha.net/getTaskResult", json={
"clientKey": API_KEY,
"taskId": task_id
}).json()
if result["status"] == "ready":
coords = result["solution"]["coordinates"]
for point in coords:
print(f"Click at ({point['x']}, {point['y']})")
break
elif result["status"] == "failed":
print("Error:", result.get("errorDescription"))
break
time.sleep(5)
import { readFileSync } from "fs";
const API_KEY = "YOUR_API_KEY";
const imageData = readFileSync("captcha.png").toString("base64");
const response = await fetch("https://api.ucaptcha.net/createTask", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
clientKey: API_KEY,
task: {
type: "ImageCoordinatesTask",
body: imageData,
comment: "Click on all traffic lights"
}
})
}).then(r => r.json());
if (response.status === "ready") {
for (const point of response.solution.coordinates) {
console.log(`Click at (${point.x}, ${point.y})`);
}
} else {
const taskId = response.taskId;
while (true) {
const result = await fetch("https://api.ucaptcha.net/getTaskResult", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ clientKey: API_KEY, taskId })
}).then(r => r.json());
if (result.status === "ready") {
for (const point of result.solution.coordinates) {
console.log(`Click at (${point.x}, ${point.y})`);
}
break;
} else if (result.status === "failed") {
console.error("Error:", result.errorDescription);
break;
}
await new Promise(r => setTimeout(r, 5000));
}
}
Terminal window
IMAGE_BASE64=$(base64 -w 0 captcha.png)
curl -X POST https://api.ucaptcha.net/createTask \
-H "Content-Type: application/json" \
-d "{
\"clientKey\": \"YOUR_API_KEY\",
\"task\": {
\"type\": \"ImageCoordinatesTask\",
\"body\": \"$IMAGE_BASE64\",
\"comment\": \"Click on all traffic lights\"
}
}"
# Poll for result if not immediately ready (replace TASK_ID)
curl -X POST https://api.ucaptcha.net/getTaskResult \
-H "Content-Type: application/json" \
-d '{
"clientKey": "YOUR_API_KEY",
"taskId": "TASK_ID"
}'
  • 2Captcha
  • Anti-Captcha

The following legacy type names are also accepted for backward compatibility:

  • CoordinatesTask
  • ImageToCoordinatesTask