Solve GeeTest Captcha in Python: The v3 Challenge Flow
Solve GeeTest captcha in Python: find gt, fetch a fresh v3 challenge for every solve, call the API and submit challenge, validate and seccode correctly.
To solve GeeTest captcha in Python, you don't drag the slider at all. You read the site's static gt key, ask the site's own register endpoint for a fresh challenge, send both to a solving API, and post back the three fields GeeTest's server checks: geetest_challenge, geetest_validate and geetest_seccode. This guide builds that flow for GeeTest v3 with requests and with Playwright, using the request format of our GeeTest v3 solver.
We run CaptchaNo, so the code calls our API. The parts that usually break, finding the register endpoint, keeping the challenge fresh and submitting the right values, work the same whichever service you use.
How GeeTest v3 works, in four requests
GeeTest v3 is a two-server handshake: the site gets a one-time challenge from GeeTest, the browser earns a result for that challenge, and the site checks the result with GeeTest again. A solver only replaces the middle step.
- Register (GeeTest calls it API1). The page asks the site's own backend for a challenge. The backend registers with GeeTest's cloud and returns JSON with
success,gt,challengeandnew_captcha. - Initialise. The page loads
gt.jsand callsinitGeetest({ gt, challenge, ... }), which draws the slide, click or icon puzzle. - Solve. When the puzzle is passed, the widget's
getValidate()returnsgeetest_challenge,geetest_validateandgeetest_seccode. - Verify (API2). The page posts those three fields to the site, and the site's server confirms them with GeeTest before it accepts the login, search or form.
Two rules from GeeTest's v3 glossary shape everything below. A challenge identifies one verification, can be used only once and expires after 10 minutes. And the secondary verification in step 4 invalidates the challenge so it can't be replayed. That's why you can't copy a challenge out of DevTools and reuse it, and why every solve needs a challenge nobody has used yet.
GeeTest v3 or v4? Check before you write code
If the page calls initGeetest with a gt and a challenge, it's v3. If it calls initGeetest4 with a captchaId, it's v4, and this guide's register step doesn't apply. The two versions take different inputs and return different fields, so sending one as the other always fails.
| Signal | GeeTest v3 | GeeTest v4 |
|---|---|---|
| Init function | initGeetest(config, callback) | initGeetest4(config, callback) |
| Keys in the config | gt (static) and challenge (new every load) | captchaId only |
| Where the challenge comes from | The site's own register endpoint | GeeTest issues it inside the widget |
| API host setting | api_server (default api.geetest.com) | apiServers (default gcaptcha4.geetest.com) |
| Fields the site verifies | geetest_challenge, geetest_validate, geetest_seccode | lot_number, captcha_output, pass_token, gen_time |
Our API type | geetest | geetest_v4 |
The v3 column comes from GeeTest's v3 web client reference, and the v4 column from its v4 reference (both read on 20 November 2026). Our captcha detector runs the same checks on a URL for you. If you land on v4, follow our GeeTest v4 solving guide instead.
Step 1: Find gt, the register endpoint and api_server
All three inputs are in the page's network traffic, and the register response hands you two of them. Open DevTools, go to the Network tab, reload, and filter by gt, geetest or register.
Here is what that looked like on GeeTest's own public demo (demos.geetest.com/slide-float.html) on 20 November 2026. The page sends GET gt/register-slide?t=<timestamp>, where the timestamp is a cache-buster. The response:
{"success":1,"challenge":"3137b9c4fc2917f33b374391d1522b5e","gt":"019924a82c70bb123aae90d483087f94","new_captcha":true}
We called the endpoint twice in a row. gt was the same both times and challenge was different, which is the pattern you're looking for. Then read the page's initGeetest call, either in the page source or in a script it loads. On the demo it passes offline: !data.success and api_server: "apiv6.geetest.com". Finally, click through the puzzle once by hand and note the request that carries geetest_challenge. On the demo that's POST gt/validate-slide, with the username and password in the same form body.
Write down four things before moving on:
gt: 32 hex characters, the same on every load. It's the public captcha ID, safe to keep in config.- The register URL: real sites use paths such as
/api/geetest/register,/gt/register-slideor a query string that includesgt=. Copy whatever the page actually calls. api_server: only if theinitGeetestconfig sets one. Leave it out when the page uses the default.- The submit request: its URL, method, content type and every field it sends besides the three
geetest_*values.
If the register response says "success": 0, GeeTest's cloud is unreachable for that site and the widget is running in failback mode, which verifies locally instead. There's nothing for a solver to do in that state, so retry later instead of paying for a solve.
Step 2: Fetch a fresh challenge, in the same session, every time
Call the register endpoint yourself right before each solve, using the same cookie jar you'll submit with. Fetching the challenge is cheap; reusing one fails every time.
The session part is easy to miss. GeeTest's integration guide has the site's register step store GeeTest's server status in the visitor's session, and the verify step read it back. If you register with one cookie jar and submit with another, the site's server may not find that state and reject a correct answer. In Python that means one requests.Session() for the whole sequence: load the page, register, solve, submit. In Playwright it means context.request, which shares the browser's cookies.
Don't lift the challenge from a widget that has already rendered on the page. Solver providers' documentation warns that a challenge is no longer usable once the page has loaded its own puzzle with it, and GeeTest only promises one use per challenge. Your own register call gives you one nobody has touched.
Step 3: Send gt and the challenge to the API
The solve is one POST with type: "geetest", the page URL, gt as sitekey, and the fresh challenge. Everything else is optional. The full field list for every type is in our captcha solver API reference.
POST https://api.captchano.com/v1/solve?wait=60
Authorization: Bearer $CAPTCHANO_API_KEY
Content-Type: application/json
{
"type": "geetest",
"url": "https://example.com/login",
"sitekey": "019924a82c70bb123aae90d483087f94",
"challenge": "3137b9c4fc2917f33b374391d1522b5e",
"apiServer": "apiv6.geetest.com",
"userAgent": "Mozilla/5.0 ..."
}
With ?wait=60 the call blocks for up to 60 seconds and returns the finished task. A ready response carries the three values under solution.geetest:
{
"id": "...",
"status": "ready",
"type": "geetest",
"solution": {
"geetest": {
"challenge": "...",
"validate": "...",
"seccode": "..."
}
},
"cost": "0.00598"
}
If the solve is still running when the wait ends, you get HTTP 202 with "status": "solving" and an id. Poll GET https://api.captchano.com/v1/task/{id} every five seconds until it says ready or failed. Add proxy (a string like http://user:pass@host:port) when the target ties its checks to the IP your client uses.
Step 4: Submit challenge, validate and seccode
Post the three values to the site exactly as its own JavaScript would, and use the challenge the API returned, not the one you sent. GeeTest's glossary notes that slide-captcha challenges get two extra random characters appended, so the returned value can be longer than your original. Sending your original is a common cause of a "correct" solve being refused.
Here's the complete requests version. Replace the four URLs and settings with what you found in Step 1.
import os
import time
import requests
API = "https://api.captchano.com/v1"
KEY = os.environ["CAPTCHANO_API_KEY"]
PAGE_URL = "https://example.com/login" # page that shows the captcha
REGISTER_URL = "https://example.com/gt/register-slide" # API1, from DevTools
VALIDATE_URL = "https://example.com/gt/validate-slide" # where the page posts the result
API_SERVER = "apiv6.geetest.com" # from initGeetest({ api_server }), or None
USER_AGENT = (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36"
)
def fresh_challenge(session):
"""Call the site's register endpoint. One call, one single-use challenge."""
r = session.get(REGISTER_URL, params={"t": int(time.time() * 1000)}, timeout=15)
r.raise_for_status()
data = r.json()
if not data.get("success"):
raise RuntimeError("GeeTest failback mode (success=0): nothing to solve, retry later")
return data["gt"], data["challenge"]
def solve_geetest(gt, challenge, user_agent=USER_AGENT):
headers = {"Authorization": f"Bearer {KEY}"}
body = {"type": "geetest", "url": PAGE_URL, "sitekey": gt,
"challenge": challenge, "userAgent": user_agent}
if API_SERVER:
body["apiServer"] = API_SERVER
task = requests.post(f"{API}/solve?wait=60", json=body, headers=headers, timeout=75).json()
deadline = time.time() + 120
while task.get("status") in ("queued", "solving") and time.time() < deadline:
time.sleep(5)
task = requests.get(f"{API}/task/{task['id']}", headers=headers, timeout=30).json()
if task.get("status") != "ready":
error = task.get("error", {})
raise RuntimeError(f"{error.get('code', 'timeout')}: {error.get('message', '')}")
return task["solution"]["geetest"]
def login(username, password, max_attempts=2):
with requests.Session() as s:
s.headers["User-Agent"] = USER_AGENT
s.get(PAGE_URL, timeout=15) # pick up the site's session cookie first
for _ in range(max_attempts):
gt, challenge = fresh_challenge(s) # a new challenge on every attempt
g = solve_geetest(gt, challenge)
r = s.post(VALIDATE_URL, data={
"username": username,
"password": password,
"geetest_challenge": g["challenge"], # the returned value, not yours
"geetest_validate": g["validate"],
"geetest_seccode": g["seccode"],
}, timeout=15)
if r.ok and r.json().get("status") == "success":
return s
raise RuntimeError("Site refused the GeeTest result twice: check fields and session")
The success check matches GeeTest's demo, which answers {"status": "success"} or {"status": "fail"}. Your target will answer differently, so change that line to whatever its own handler looks for. The loop is capped at two attempts on purpose: if two fresh solves are refused, the problem is in the request, and more solves won't fix it.
The same flow with Playwright
Use Playwright when the page sets cookies or headers in JavaScript that a plain requests session can't reproduce. The steps don't change: register through the browser's own cookie jar, solve, then submit the fields the way the page does. This is the same keep-one-session rule as in our DataDome solver tutorial in Python, applied to three form fields instead of a cookie.
import time
from playwright.sync_api import sync_playwright
# Reuses PAGE_URL, REGISTER_URL, VALIDATE_URL and solve_geetest() from the script above.
def submit_with_playwright(username, password):
with sync_playwright() as p:
browser = p.chromium.launch()
context = browser.new_context()
page = context.new_page()
page.goto(PAGE_URL, wait_until="networkidle")
user_agent = page.evaluate("navigator.userAgent")
# context.request shares the page's cookies, so register and submit are one session.
data = context.request.get(REGISTER_URL, params={"t": str(int(time.time() * 1000))}).json()
if not data.get("success"):
raise RuntimeError("GeeTest failback mode: nothing to solve")
g = solve_geetest(data["gt"], data["challenge"], user_agent=user_agent)
fields = {
"username": username,
"password": password,
"geetest_challenge": g["challenge"],
"geetest_validate": g["validate"],
"geetest_seccode": g["seccode"],
}
# Post from inside the page, so origin, cookies and headers match the site's own call.
result = page.evaluate("""async ({ url, fields }) => {
const r = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams(fields),
});
return { status: r.status, body: await r.text() };
}""", {"url": VALIDATE_URL, "fields": fields})
browser.close()
return result
Some sites don't post with AJAX. They use GeeTest's bindForm, which puts the three values in hidden inputs and submits a normal form. In that case, set inputs named geetest_challenge, geetest_validate and geetest_seccode on the form, creating them if they're missing, then click the page's own submit button. Either way, copy what the page's handler sends, including any CSRF token, and leave the rest alone.
Why a GeeTest v3 solve fails, and what to fix
Almost every failure is an input problem, and the response tells you which one. A failed solve isn't billed, so the cost of getting this wrong is time, not money.
| What you see | Likely cause | Fix |
|---|---|---|
invalid_sitekey: "GeeTest gt values are 32 hex characters" | You sent something other than gt, often a v4 captcha_id from a different widget or a truncated value | Copy gt from the register response. If the page calls initGeetest4, switch to geetest_v4 |
| 400: "challenge is required for geetest" | No challenge in the body | Call the register endpoint first and pass its value |
Register returns "success": 0 | GeeTest's cloud is unreachable, so the site is in failback mode | Don't solve. Retry later |
Task ends failed, for example unsolvable | The challenge was already used or expired, or the wrong api_server was used | Register again for a new challenge, and send apiServer if the page sets one |
HTTP 202, "status": "solving" | The solve outlasted ?wait=60 | Poll /v1/task/{id} every five seconds |
Task is ready but the site says fail | You sent your original challenge, used a different cookie jar, or left out a field the site expects | Submit the returned challenge, keep one session, and mirror the page's request exactly |
| Accepted locally, refused from your server | The site ties the result to the client's IP or user agent | Send proxy and userAgent, and use the same pair when you submit |
The last two rows are the same session-mismatch problem that breaks reCAPTCHA and Turnstile tokens. Our guide to why solved captcha tokens still get rejected walks through it field by field.
How CaptchaNo handles GeeTest v3
We solve GeeTest v3 on our own solving infrastructure through the geetest type. You send gt and a fresh challenge, and you get challenge, validate and seccode back with GeeTest's own field names, so the values drop straight into the site's form. The API rejects a missing challenge or a malformed gt before any work starts, so you aren't charged for a request that could never succeed.
- Billing: $0.00598 per successful GeeTest solve, v3 or v4. Failed solves are never billed, and credit doesn't expire. All rates are on our pricing page.
- Try before you code: the solver playground takes a
gtand a challenge and shows the raw response, which is a quick way to check you've found the right register endpoint. - Support: if a target refuses a solved result, write to support@captchano.com with the page URL and the request you send. Replies come from the engineers who run the service.
When not to automate GeeTest
If the form is your own, don't solve your captcha in tests at all. Give the test environment its own captcha settings or a server-side flag, and test the cases that matter: a missing, reused or expired challenge must be refused. Our checklist of CAPTCHA test cases lists those cases. GeeTest's guide also shows how to force failback mode, by entering an invalid captcha ID, so you can test that path. On someone else's site, read the terms first, and look for an official API or data feed, which is usually steadier than any form flow. Our acceptable use policy sets out what CaptchaNo may be used for.
Frequently Asked Questions
What is the gt value in GeeTest?
The gt value is the site's public GeeTest v3 captcha ID, a 32-character hexadecimal string that stays the same on every page load. GeeTest pairs it with a private key that only the site's server holds. You can read gt from the register endpoint's JSON response or from the page's initGeetest call, and it's safe to keep in your configuration.
Can a GeeTest challenge be reused?
No. GeeTest's own glossary says a v3 challenge identifies a single verification, can be used only once and expires after 10 minutes. The site's verification step also invalidates it after use. Call the site's register endpoint immediately before every solve, ideally in the same session that will submit the result, and never cache a challenge between attempts.
How can I tell GeeTest v3 from v4?
Look at how the page starts the widget. GeeTest v3 calls initGeetest with a gt and a challenge that the site fetches from its own register endpoint. GeeTest v4 calls initGeetest4 with a single captchaId and talks to gcaptcha4.geetest.com by default. v3 returns three fields to verify, while v4 returns lot_number, captcha_output, pass_token and gen_time.
What is api_server in GeeTest, and do I need to send it?
api_server is the GeeTest host the v3 widget sends its requests to. GeeTest's web reference gives api.geetest.com as the default, but sites can set another, such as the apiv6.geetest.com that GeeTest's own demo uses. Send it as apiServer only when the page's initGeetest config sets one, so the solve talks to the same GeeTest host as the page.
Why does the site reject my GeeTest validate and seccode?
Usually the values are fine and the request around them is wrong. The common causes are submitting your original challenge instead of the one the solver returned, using a different cookie session from the one that registered the challenge, leaving out a field the page normally sends, or changing IP address or user agent between the solve and the submission.
Run your first GeeTest v3 solve
Find the register endpoint in DevTools, set CAPTCHANO_API_KEY, and run the script against a page you're allowed to automate. Create a CaptchaNo account to get a key. GeeTest solves cost $0.00598 each on our pricing page, and you're only billed when a solve succeeds.