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 GeeTest CAPTCHA v4, 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 GeeTest CAPTCHA v4 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.
When testing forms that include GeeTest CAPTCHA v4, you often need to verify that the captcha works and is integrated correctly.
You can verify the captcha embedded on your site manually.
For automatic solving you can use tools like CapMonster Cloud, which accepts captcha parameters, processes them on its servers, and returns a ready-to-use token. Insert this token into the form to pass the check without user interaction.
Working with CapMonster Cloud via API typically involves the following steps:
In the request for solving GeeTest CAPTCHA v4 you must pass the following parameters:
type - GeeTestTask;
websiteURL - page address where the captcha is solved;
gt - GeeTest domain identifier key – parameter captcha_id;
version - 4;
geetestApiServerSubdomain - GeeTest API server subdomain (must be different from api.geetest.com);
geetestGetLib - path to the captcha script used to display it on the page. May be required for some websites;
initParameters - extra parameters for version 4 used together with “riskType” (captcha type / verification characteristics).
https://api.capmonster.cloud/createTask{
"clientKey": "YOUR_CAPMONSTER_CLOUD_API_KEY",
"task": {
"type": "GeeTestTask",
"websiteURL": "https://gt4.geetest.com/",
"gt": "54088bb07d2df3c46b79f80300b0abbe",
"version": 4,
"initParameters": {
"riskType": "slide"
}
}
}{
"errorId":0,
"taskId":407533072
}https://api.capmonster.cloud/getTaskResult{
"clientKey":"API_KEY",
"taskId": 407533072
}{
"errorId": 0,
"status": "ready",
"solution": {
"captcha_id": "f5c2ad5a8a3cf37192d8b9c039950f79",
"lot_number": "bcb2c6ce2f8e4e9da74f2c1fa63bd713",
"pass_token": "edc7a17716535a5ae624ef4707cb6e7e478dc557608b068d202682c8297695cf",
"gen_time": "1683794919",
"captcha_output": "XwmTZEJCJEnRIJBlvtEAZ662T...[cut]...SQ3fX-MyoYOVDMDXWSRQig56"
}
}
// npm install playwright @zennolab_com/capmonstercloud-client
import { chromium } from "playwright";
import {
CapMonsterCloudClientFactory,
ClientOptions,
GeeTestRequest
} from "@zennolab_com/capmonstercloud-client";
const CAPMONSTER_API_KEY = "YOUR_CAPMONSTER_API_KEY";
async function solveGeetestV4(pageUrl) {
const browser = await chromium.launch({ headless: false });
const context = await browser.newContext({ viewport: null });
const page = await context.newPage();
let detected = null;
let solutionObj = null;
// 1. Intercept the /load response (detect captcha_id, challenge, etc.)
page.on("response", async (response) => {
const url = response.url();
if (!url.startsWith("https://gcaptcha4.geetest.com/load?")) return;
const params = new URLSearchParams(url.split("?")[1] || "");
const captchaId = params.get("captcha_id");
const challenge = params.get("challenge");
const captchaType = params.get("captcha_type");
if (captchaId && challenge) {
detected = { captchaId, challenge, captchaType };
console.log("Detected GeeTest v4 load:", detected);
}
});
// 2. Load the page
console.log("Opening page:", pageUrl);
await page.goto(pageUrl, { waitUntil: "domcontentloaded" });
// 3. Wait until /load is captured
console.log("Waiting for GeeTest /load...");
while (!detected) {
await page.waitForTimeout(500);
}
// 4. Send the task to CapMonster Cloud
console.log("Sending task to CapMonster...");
const cmc = CapMonsterCloudClientFactory.Create(
new ClientOptions({ clientKey: CAPMONSTER_API_KEY })
);
const task = new GeeTestRequest({
websiteURL: pageUrl,
gt: detected.captchaId,
challenge: detected.challenge,
version: "4",
initParameters: {
riskType: detected.captchaType || "slide"
}
});
const solveRes = await cmc.Solve(task);
const sol = solveRes.solution || solveRes;
solutionObj = {
captcha_id: sol.captcha_id || detected.captchaId,
captcha_output: sol.captcha_output,
lot_number: sol.lot_number,
pass_token: sol.pass_token
};
console.log("Got solution from CapMonster:", solutionObj);
// 5. Substitute your values into /verify to get a successful response
await page.route("https://gcaptcha4.geetest.com/verify*", async (route) => {
console.log("Intercepted /verify, injecting fake success...");
const body = `geetest_${Date.now()}(${JSON.stringify({
status: "success",
data: {
result: "success",
seccode: {
captcha_id: solutionObj.captcha_id,
captcha_output: solutionObj.captcha_output,
lot_number: solutionObj.lot_number,
pass_token: solutionObj.pass_token
}
}
})})`;
await route.fulfill({
status: 200,
contentType: "application/javascript",
body
});
});
// 6. Imitate a user action (for example, click the captcha button)
console.log("Waiting for captcha interaction...");
await page.waitForTimeout(3000);
// Example of a verification call:
try {
await page.click('.geetest_btn'); // captcha button
console.log("Clicked captcha button");
} catch {
console.log("Captcha button not found");
}
// Sometimes you need to call verify() manually:
await page.evaluate(() => {
if (window.initGeetest4 && typeof verify === "function") {
verify();
}
});
console.log("Waiting for verification request...");
await page.waitForTimeout(3000);
await browser.close();
return { detected, solution: solutionObj };
}
(async () => {
const url = "https://example.com"; // replace with a page that has GeeTest v4
const res = await solveGeetestV4(url);
console.log("FINISHED:", res);
})();
1. Sign up or log in to your GeeTest account.
2. Go to the Captcha Dashboard and select Behavior Verification v4:

3. In the dashboard click + Create application.
4. Specify APP/website name (the name of the site or application where the captcha will be used), Address (the main domain of the site where the captcha will be installed, for example https://example.com), Industry (the site category, for example “E-commerce”, “Social Media”, etc.), then click Confirm.
5. Click Add events next to the newly created application. Set Event – the name of the specific scenario (event) where the captcha will be used, for example login, register, etc.; Device – the platform (for example Web/Wap); Business types – the type of captcha usage scenario (for example, Sign-up / Sign-in — registration / login). Click Add.
6. Now you will see the ID (used on the client and on the server) and Key (used on the server for verification) of the created captcha in your dashboard:

7. Connect the client side
Include the script:
<script src="https://static.geetest.com/v4/gt4.js"></script>Initialize the CAPTCHA:
initGeetest4(
{ captchaId: "Your CaptchaId" },
function (captcha) {
captcha.appendTo("#captcha"); // insert into a page element
}
);Important:
<!-- Include the CAPTCHA script -->
<script src="https://static.geetest.com/v4/gt4.js"></script>
</head>
<body>
<h1>CAPTCHA Demo</h1>
<!-- Container for the CAPTCHA -->
<div id="captcha"></div>
<script>
// CAPTCHA initialization
initGeetest4(
{
captchaId: "YOUR_CAPTCHA_ID" // replace with your CaptchaId
},
function (captcha) {
// Insert the CAPTCHA into a page element
captcha.appendTo("#captcha");
// You can handle a successful pass here
captcha.onSuccess(function() {
const validate = captcha.getValidate();
console.log("CAPTCHA passed!", validate);
// Here you can send validate to the server for verification
});
}
);
</script>
8. Configure the server side.
When a user passes the CAPTCHA on the frontend, a set of parameters is generated. You must send these parameters to the backend and then verify them via GeeTest’s secondary API to confirm that the check was successful.
Secondary verification API:
http://gcaptcha4.geetest.com/validateMain request parameters
{
"status": "success",
"result": "success",
"reason": "",
"captcha_args": {
"used_type": "slide",
"user_ip": "127.0.0.1",
"lot_number": "4dc3cfc2cdff448cad8d13107198d473",
"scene": "anti crawler",
"referer": "http://127.0.0.1:8077/"
}
}<?php
$captcha_id = 'YOUR_CAPTCHA_ID';
$captcha_key = 'YOUR_CAPTCHA_KEY';
$api_server = 'http://gcaptcha4.geetest.com';
// Get parameters from the frontend
$lot_number = $_POST['lot_number'] ?? '';
$captcha_output = $_POST['captcha_output'] ?? '';
$pass_token = $_POST['pass_token'] ?? '';
$gen_time = $_POST['gen_time'] ?? '';
// Generate the signature
$sign_token = hash_hmac('sha256', $lot_number, $captcha_key);
// Build the request payload
$data = [
'lot_number' => $lot_number,
'captcha_output' => $captcha_output,
'pass_token' => $pass_token,
'gen_time' => $gen_time,
'sign_token' => $sign_token
];
// Request to the secondary verification API
$url = $api_server . '/validate?captcha_id=' . $captcha_id;
$options = [
'http' => [
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
'timeout' => 5
]
];
$context = stream_context_create($options);
$result = @file_get_contents($url, false, $context);
if ($result === FALSE) {
$response = ['login' => 'fail', 'reason' => 'request geetest api fail'];
} else {
$gt_msg = json_decode($result, true);
if ($gt_msg['result'] === 'success') {
$response = ['login' => 'success', 'reason' => $gt_msg['reason']];
} else {
$response = ['login' => 'fail', 'reason' => $gt_msg['reason']];
}
}
echo json_encode($response);
?>
If you’ve taken over a website that already has a captcha or another protection system installed, but you don’t have access to the code, don’t worry! It’s quite easy to identify which technology is being used. To verify that everything works correctly, you can use the CapMonster Cloud recognition service in an isolated test environment to make sure that the token processing mechanism and the validation logic are functioning properly.
In the case of GeeTest CAPTCHA v4, it’s enough to detect the system, observe its behavior, and confirm that the protection is working correctly. In this article, we showed how to identify GeeTest CAPTCHA v4 and where to find instructions on how to integrate or reconfigure it, so you can confidently maintain the protection and keep its operation under control.