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.”
Task Type
Section titled “Task Type”| Type | Description |
|---|---|
ImageCoordinatesTask | Click objects in an image and return coordinates |
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | ImageCoordinatesTask |
body | string | Yes | Base64-encoded image |
comment | string | No | Instructions (e.g., “Click on all traffic lights”) |
Create Task
Section titled “Create Task”Request
Section titled “Request”{ "clientKey": "YOUR_API_KEY", "task": { "type": "ImageCoordinatesTask", "body": "iVBORw0KGgoAAAANSUhEUg...", "comment": "Click on all traffic lights" }}Response
Section titled “Response”{ "errorId": 0, "status": "ready", "solution": { "coordinates": [ { "x": 120, "y": 45 }, { "x": 230, "y": 180 } ] }}Solution Object
Section titled “Solution Object”{ "coordinates": [ { "x": 120, "y": 45 }, { "x": 230, "y": 180 } ]}| Field | Type | Description |
|---|---|---|
coordinates | array | Array of {x, y} coordinate pairs representing click positions |
Each coordinate object contains:
| Field | Type | Description |
|---|---|---|
x | integer | Horizontal pixel position from the left edge |
y | integer | Vertical pixel position from the top edge |
Code Examples
Section titled “Code Examples”Python
Section titled “Python”import requestsimport 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)JavaScript
Section titled “JavaScript”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)); }}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" }'Provider Coverage
Section titled “Provider Coverage”- 2Captcha
- Anti-Captcha
Aliases
Section titled “Aliases”The following legacy type names are also accepted for backward compatibility:
CoordinatesTaskImageToCoordinatesTask