Skip to content

Rotate

Rotate tasks determine the correct rotation angle needed to orient an image properly. Some CAPTCHAs present a rotated image and ask the user to rotate it to its correct orientation. The solution returns the angle in degrees.

TypeDescription
RotateTaskDetermine the correct rotation angle for an image
ParameterTypeRequiredDescription
typestringYesRotateTask
bodystringYesBase64-encoded image to rotate
commentstringNoInstructions for the solver
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "RotateTask",
"body": "iVBORw0KGgoAAAANSUhEUg...",
"comment": "Rotate the image to its correct orientation"
}
}
{
"errorId": 0,
"status": "ready",
"solution": {
"angle": 45
}
}
{
"angle": 45
}
FieldTypeDescription
anglenumberRotation angle in degrees (clockwise)
import requests
import base64
API_KEY = "YOUR_API_KEY"
with open("rotated_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": "RotateTask",
"body": image_data,
"comment": "Rotate the image to its correct orientation"
}
}).json()
if response.get("status") == "ready":
angle = response["solution"]["angle"]
print(f"Rotate by {angle} degrees")
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":
angle = result["solution"]["angle"]
print(f"Rotate by {angle} degrees")
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("rotated_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: "RotateTask",
body: imageData,
comment: "Rotate the image to its correct orientation"
}
})
}).then(r => r.json());
if (response.status === "ready") {
console.log(`Rotate by ${response.solution.angle} degrees`);
} 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") {
console.log(`Rotate by ${result.solution.angle} degrees`);
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 rotated_captcha.png)
curl -X POST https://api.ucaptcha.net/createTask \
-H "Content-Type: application/json" \
-d "{
\"clientKey\": \"YOUR_API_KEY\",
\"task\": {
\"type\": \"RotateTask\",
\"body\": \"$IMAGE_BASE64\",
\"comment\": \"Rotate the image to its correct orientation\"
}
}"
# 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