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.
Task Type
Section titled “Task Type”| Type | Description |
|---|---|
RotateTask | Determine the correct rotation angle for an image |
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | RotateTask |
body | string | Yes | Base64-encoded image to rotate |
comment | string | No | Instructions for the solver |
Create Task
Section titled “Create Task”Request
Section titled “Request”{ "clientKey": "YOUR_API_KEY", "task": { "type": "RotateTask", "body": "iVBORw0KGgoAAAANSUhEUg...", "comment": "Rotate the image to its correct orientation" }}Response
Section titled “Response”{ "errorId": 0, "status": "ready", "solution": { "angle": 45 }}Solution Object
Section titled “Solution Object”{ "angle": 45}| Field | Type | Description |
|---|---|---|
angle | number | Rotation angle in degrees (clockwise) |
Code Examples
Section titled “Code Examples”Python
Section titled “Python”import requestsimport 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)JavaScript
Section titled “JavaScript”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)); }}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" }'Provider Coverage
Section titled “Provider Coverage”- 2Captcha