In this article, we have tried to answer all the key questions. The first step in solving the task is to determine which protection system is being used. To do this, you can refer to the list of popular captchas and anti-bot protection systems, where you will find visual examples and key indicators that help you quickly understand what you are dealing with.
If you discover that your site uses ImageToText, the next step is to study its properties and operation in more detail. In this article, you can also review the instructions on how to integrate ImageToText so that you fully understand how it functions on your site. This will help you not only understand the current protection, but also properly plan its maintenance.
Working with CapMonster Cloud via API typically involves the following steps:
type - ImageToTextTask
body - the captcha file content encoded in base64. Make sure the value is sent as a single line, without line breaks;
capMonsterModule (optional) - module name, for example “yandex”. An alternative way to pass the module name and a list of all available modules can be found here;
You can also set other optional parameters:
recognizingThreshold - captcha recognition threshold with a possible value from 0 to 100;
case - whether to consider letter case when solving. Possible values: true, false;
numeric - 1 — if the captcha consists of digits only. Possible values: 0, 1;
math - false — not set by default;
true — the captcha requires performing a mathematical operation (for example, captcha 2 + 6 will return the value 8).
Important: for the captcha_math module, do not use the math: true parameter.
https://api.capmonster.cloud/createTask{
"clientKey":"API_KEY",
"task": {
"type":"ImageToTextTask",
"body":"BASE64_BODY_HERE!"
}
}
{
"errorId":0,
"taskId":407533072
}https://api.capmonster.cloud/getTaskResult{
"clientKey":"API_KEY",
"taskId": 407533072
}
{
"errorId":0,
"status":"ready",
"solution": {
"text":"answer"
}
}
// npm install playwright @zennolab_com/capmonstercloud-client
// npx playwright install chromium
import { CapMonsterCloudClientFactory, ClientOptions, ImageToTextRequest, CapMonsterModules } from '@zennolab_com/capmonstercloud-client';
import { chromium } from 'playwright';
const API_KEY = "YOUR_API_KEY"; // Specify your CapMonster Cloud API key
async function solveImageToTextAndFillField() {
const cmcClient = CapMonsterCloudClientFactory.Create(
new ClientOptions({ clientKey: API_KEY })
);
// You can optionally check your balance
const balance = await cmcClient.getBalance();
console.log("Balance:", balance);
// 1. Launch Playwright and open the page with the form
const browser = await chromium.launch({ headless: false });
const context = await browser.newContext();
const page = await context.newPage();
await page.goto("https://example.com/form"); // 2. Get the captcha URL from the page (example via <img> selector)
// 2. Get the captcha URL from the page (example via <img> selector)
const captchaUrl = await page.getAttribute("#captcha-img", "src");
// 3. Download the image and convert it to Base64
const response = await fetch(captchaUrl);
const imageBuffer = await response.arrayBuffer();
const imageBase64 = Buffer.from(imageBuffer).toString('base64');
// 4. Create a request to solve ImageToText
const imageToTextRequest = new ImageToTextRequest({
body: imageBase64,
CapMonsterModule: CapMonsterModules.YandexWave, // or another module
Case: true,
numeric: 0,
recognizingThreshold: 65,
math: false
});
// 5. Get the captcha solution
const result = await cmcClient.Solve(imageToTextRequest);
console.log("Captcha solution:", result.solution.text);
// 6. Insert the solution into the form field and submit
await page.fill("#captcha-input", result.solution.text); // Replace with your selector
await page.click("#submit-button"); // Replace with your button selector
await page.waitForLoadState("networkidle");
console.log("Form submitted with captcha solution");
// 7. Close the browser
await browser.close();
}
solveImageToTextAndFillField().catch(console.error);
Step 1. Choose an Approach
First, you need to decide how exactly you will use the captcha:
Option 1 — Third-party vendor
Suitable if fast implementation and minimal maintenance are important.
Pros:
Cons:
Option 2 — Custom text CAPTCHA
Suitable if you need full control and integration tailored to your needs.
Pros:
Cons:
Step 2. Implement CAPTCHA Generation
For a vendor
For a custom captcha
Step 3. Display the CAPTCHA to the User
Important: each load must generate a new code.
Step 4. Send Data to the Server
When submitting the form, send:
For a custom captcha, the code must not be stored on the client — only on the server.
Step 5. Verify the CAPTCHA on the Server
Vendor
Custom captcha
Step 6. Make a Decision
Step 7. Strengthen Protection (Recommended)
Even for a text captcha, it is worth adding:
Make sure that:
If you inherited a website with an already installed captcha or another protection system and do not have access to the code — no problem! Determining which technology is used is quite easy. And to verify correct operation, you can use the CapMonster Cloud recognition service in an isolated test environment to ensure that token handling and validation logic work correctly.
In the case of an image-based captcha, it is enough to recognize the system, study its behavior, and ensure that the protection functions correctly. In this article, we showed how to identify an image captcha (ComplexImage) and how to connect or reconfigure it to confidently maintain and control the protection.