Skip to content

Recaptcha V2

Create Task

POST https://api.captchasonic.com/createTask
Host: api.captchasonic.com
Content-Type: application/json


Request Example

Payload
{
"apiKey": "YOUR_API_KEY",
"task": {
"type": "ReCaptchaV2Image",
"questionType": "33",
"queries": [
"iVBORw0KGgoAAAANSUhEUgAAASwAAADICAIAAADdvUsCAAAgAElEQVR4AezBCZRd9X0n...."
],
"question": "cars",
"websiteURL": "https://your-website.com",
"metadata": {
"pageURL": "www.website.com",
"title": "reCAPTCHA"
}
}
}


Response

{
"code": 200,
"msg": "",
"answers": [
0,
1,
6
]
}


API Testing Example Scripts

async function fetch_recaptchaV2_result() {
const url = "https://api.captchasonic.com/createTask";
const data = {
"apiKey": "sonic_xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"task": {
"type": "ReCaptchaV2Image",
"questionType": "33",
"queries": [
"iVBORw0KGgoAAAANSUhEUgAAASwAAADICAIAAADdvUsCAAAgAElEQVR4AezBCZRd9X0n...."
],
"question": "cars",
"websiteURL": "https://your-website.com",
"metadata": {
"pageURL": "www.website.com",
"title": "reCAPTCHA"
}
}
}
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();