PopularCaptcha
PopularCaptcha Captcha Recognition API
Section titled “PopularCaptcha Captcha Recognition API”POST https://api.captchasonic.com/createTaskHost: api.captchasonic.comContent-Type: application/json
Request Sample
Section titled “Request Sample”{"apiKey": "YOUR_API_KEY","task": {"type": "PopularClassification","queries": [ "image1_base64", "image2_base64"],"question": "Please click, hold, and drag all the missing pieces to complete the image.","questionType": "objectClick","examples": [ "example1_base64", "example2_base64"],"websiteURL": "https://your-website.com","websiteKEY": "website-key","choices": []}}
{"apiKey": "YOUR_API_KEY","task": {"type": "PopularClassification","queries": [ "image1_base64", "image2_base64"],"question": "Please click, hold, and drag all the missing pieces to complete the image.","questionType": "objectDrag","examples": [ "example1_base64", "example2_base64"],"websiteURL": "https://your-website.com","websiteKEY": "website-key","choices": []}}
{"apiKey": "YOUR_API_KEY","task": {"type": "PopularClassification","queries": [ "image1_base64", "image2_base64"],"question": "Please click, hold, and drag all the missing pieces to complete the image.","questionType": "objectClassify","examples": [ "example1_base64", "example2_base64"],"websiteURL": "https://your-website.com","websiteKEY": "website-key","choices": []}}
Payload
Section titled “Payload”{ "apiKey": "YOUR_API_KEY", "task": { "type": "GeetestImage", "queries": [ "iVBORw0KGgoAAAANSUhEUgAAASwAAADICAIAAADdvUsCAAAgAElEQVR4AezBCZRd9X0n...." ], "examples": [ "iVBORw0KGgoAAAANSUhEUgAAASwAAADICAIAAADdvUsCAAAgAElEQVR4AezBCZRd9X0n...." ], "question": "slide", "websiteURL": "https://your-website.com", "websiteKEY": "website-key" }}
Response
Section titled “Response”{ "errorId": 0, "solution": { "result": "success" }, "status": "ready"}
Example Scripts
Section titled “Example Scripts”async function fetch_recaptchaV2_result() {const url = "https://api.captchasonic.com/createTask";
const data = {"apiKey": "sonic_xxxxxxxxxxxxxxxxxxxxxxxxxxx","task": {"type": "PopularClassification","queries": [ "image1_base64", "image2_base64"],"question": "Please click, hold, and drag all the missing pieces to complete the image.","questionType": "objectClick","examples": [ "example1_base64", "example2_base64"],"websiteURL": "https://your-website.com","websiteKEY": "website-key","choices": []}}
try {const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data)});
if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`);}
const result = await response.json();console.log("Response:", result);return result;} catch (error) {console.error("Error fetching OCR result:", error);return null;}}
// Example usage:fetch_recaptchaV2_result();
import requests
def fetch_recaptchaV2_result(): url = "https://api.captchasonic.com/createTask" headers = {"Content-Type": "application/json"}
data = { "apiKey": "sonic_xxxxxxxxxxxxxxxxxxxxxxxxxxx", "task": { "type": "PopularClassification", "queries": [ "image1_base64", "image2_base64" ], "question": "Please click, hold, and drag all the missing pieces to complete the image.", "questionType": "objectClick", "examples": [ "example1_base64", "example2_base64" ], "websiteURL": "https://your-website.com", "websiteKEY": "website-key", "choices": [] } }
try: response = requests.post(url, json=data, headers=headers) response.raise_for_status() # Raise an error for HTTP error responses (4xx, 5xx) return response.json() # Return JSON responseexcept requests.exceptions.RequestException as e: print(f"Error fetching OCR result: {e}") return None
# Example usage:result = fetch_recaptchaV2_result()if result: print("Response:", result)