AWS WAF and other CAPTCHAs
How to solve GeeTest v3 and v4
GeeTest has two generations in wide use, and each one needs different inputs and returns different fields. One task type covers both at $0.84 per 1,000, as long as you send the right values.
Which GeeTest version is on the page
Look at the scripts and the initialisation call. GeeTest v3 pages load gt.js and call initGeetest() with a gt and a challenge value. GeeTest v4 pages load a v4 script (commonly gt4.js from static.geetest.com at the time of writing) and call initGeetest4() with a captchaId. The visible puzzle can look alike in both, a slider, an icon click or a nine square grid, so the code is a better guide than the picture.
| GeeTest v3 | GeeTest v4 | |
|---|---|---|
| Init call | initGeetest({gt, challenge, ...}) | initGeetest4({captchaId, ...}) |
| Task inputs | gt and challenge | captchaId |
| Single use input | challenge (fetch a new one each time) | none; the id is fixed per site |
| Fields returned | challenge, validate and seccode values | captcha_id, lot_number, pass_token, gen_time, captcha_output |
The GeeTest glossary entry covers the vendor and its puzzle styles if you meet it for the first time.
Collect the inputs for v3
For v3 the gt value is a 32 character hex string that stays the same for a site. The challenge is different every time: the page gets it from the site's own back end, usually from an endpoint the page calls just before rendering the puzzle. Open DevTools, filter the Network panel by "gt" or "register", reload, and you will see a JSON response similar to {"success": 1, "gt": "...", "challenge": "...", "new_captcha": true}.
Your script has to call that same endpoint right before each task, because a challenge that has already been used or shown elsewhere will not validate. Never copy a challenge from DevTools into a script and reuse it; it works at most once.
Collect the input for v4
For v4 you only need the captchaId. It appears in the page source or a bundled script as the argument to initGeetest4, and it also shows up as the captcha_id query parameter in requests to GeeTest's servers. The value is fixed per site integration, so you can store it in your configuration and reuse it for every task.
One function for both versions
The task type is GeeTestTaskProxyLess for both generations. Which optional fields you fill decides the version: gt plus challenge for v3, or captchaId for v4. The Python function below accepts either set and returns the full solution dictionary, because the site needs all of its fields.
import time
import requests
GT_ROOT = "https://gatesolver.com"
def geetest_answer(page_url, api_key, *, gt=None, challenge=None, captcha_id=None):
task = {"type": "GeeTestTaskProxyLess", "websiteURL": page_url}
if captcha_id:
task["captchaId"] = captcha_id
elif gt and challenge:
task.update(gt=gt, challenge=challenge)
else:
raise ValueError("send gt and challenge (v3) or captcha_id (v4)")
first = requests.post(f"{GT_ROOT}/createTask",
json={"clientKey": api_key, "task": task}, timeout=30).json()
if first.get("errorId"):
raise RuntimeError(first.get("errorCode"))
for tick in range(40):
time.sleep(3)
check = requests.post(f"{GT_ROOT}/getTaskResult", timeout=30,
json={"clientKey": api_key, "taskId": first["taskId"]}).json()
if check.get("errorId"):
raise RuntimeError(check.get("errorCode"))
if check["status"] == "ready":
return check["solution"]
if check["status"] == "failed":
raise RuntimeError("GeeTest task failed; nothing was billed")
raise TimeoutError("GeeTest task did not finish")
A task that cannot be solved comes back with status failed or an error code such as ERROR_CAPTCHA_UNSOLVABLE, and nothing is charged for it. For v3 that usually means the challenge was stale: fetch a new one and try again.
Send the v3 result to the site
A v3 puzzle completed in the browser produces three values that the page posts along with its form, under the names geetest_challenge, geetest_validate and geetest_seccode. The solution gives you the same three values, so your request only has to map them.
register = web.get("https://example.com/api/captcha/register", timeout=20).json()
v3 = geetest_answer("https://example.com/signin", "YOUR_API_KEY",
gt=register["gt"], challenge=register["challenge"])
web.post("https://example.com/api/signin/check", data={
"geetest_challenge": v3["challenge"],
"geetest_validate": v3["validate"],
"geetest_seccode": v3["seccode"],
}, timeout=20)
Here web is a requests.Session that already loaded the page. Watch a real submit in DevTools once to confirm the field names; most v3 sites use the three names above, but some wrap them in JSON or prefix them.
Send the v4 result to the site
V4 returns five values and the site's back end checks them with GeeTest, so pass every one of them exactly as received. Sites differ in how they carry them: as form fields, as a JSON object or as query parameters on a verify call.
v4 = geetest_answer("https://example.com/signup", "YOUR_API_KEY",
captcha_id="e392e1d7fd421dc63325744d5a2b9c73")
proof = {name: v4[name] for name in
("captcha_id", "lot_number", "pass_token", "gen_time", "captcha_output")}
web.post("https://example.com/api/signup/verify", json=proof, timeout=20)
Do not reformat or decode captcha_output; it is an opaque string and a single changed character makes the check fail. The same goes for gen_time, which looks like a number but should be passed as the string you received.
Timing and reuse
GeeTest results are meant for one verification. Send them to the site as soon as the task is ready, and solve again for the next form. With v3, the gap between fetching the challenge and creating the task matters most, so keep those two calls next to each other in your code and avoid queueing challenges for later.
If you drive a real browser, you can also feed the result into the page's own flow instead of building the request by hand. Watch which request the page sends after a manual solve, and reproduce that one. Browser based guides for GeeTest in Python and GeeTest in Node.js go deeper into that route.
Troubleshooting
- ERROR_INVALID_TASK_DATA: the description names the missing field. For v3 it is usually an empty
challengebecause the register call failed. - Unsolvable v3 tasks in a row: the challenge is being reused or fetched from a different session than the one that posts the result.
- Site says verification failed: a field was renamed, missing or changed. Compare your request with a manual one field by field.
- Using the in.php interface: the methods
geetestandgeetest_v4are available if your existing code is built on that style.
Current price and speed for this type are on the GeeTest solver page.
Common questions
How do I know if a site uses GeeTest v3 or v4?
Check the init call: initGeetest with gt and challenge is v3, initGeetest4 with captchaId is v4. The puzzle picture alone is not a reliable sign.
Can I reuse a GeeTest v3 challenge value?
No. Each challenge validates at most once, so request a fresh one from the site right before creating every task.
Is captchaId the same for every visitor?
Yes, for a given site integration it is fixed, so it can live in your configuration.
Should I convert gen_time to a number?
No. Pass every returned field exactly as received, as strings, so the site's check with GeeTest sees the original values.
Is there a separate task type for v4?
No. GeeTestTaskProxyLess handles both; sending captchaId marks the task as v4.
Keep reading
- GeeTest v3 / v4 solver$0.84 per 1,000 tasks, answers under 5 seconds.
- GeeTestGeeTest v3 and v4 slide and click puzzles, the gt, challenge and captcha_id inputs, and the values a solve hands back.
- Solve GeeTest in PythonAn async Python flow for GeeTest v3 and v4 using httpx and dataclasses, with the site verification request built from the result.
- CAPTCHA types comparedAll fourteen CAPTCHA types GateSolver solves in one comparison: looks, answers, proxy needs, speed and price.