API Tutorials

Solve GeeTest v3 CAPTCHA with Node.js and CaptchaAI

GeeTest v3 uses interactive challenges — slide puzzles, click sequences, or gap fills — that return three values (challenge, validate, seccode) instead of a single token. This tutorial shows you how to solve GeeTest v3 from Node.js using the CaptchaAI API.


Prerequisites

Item Value
CaptchaAI API key From captchaai.com
Node.js 14+
Library axios (npm install axios)
Target page A page with GeeTest v3 CAPTCHA

Step 1: Extract GeeTest parameters

Locate the gt (public key) and challenge (dynamic token) from the target page.

const axios = require('axios');

// Many sites expose GeeTest params via an API endpoint
const { data } = await axios.get('https://example.com/api/geetest/register');

const gt = data.gt;               // e.g., "f1ab2cdefa3456116012345b6c78d99e"
const challenge = data.challenge;  // e.g., "12345678abc90123d45678ef90123a456b"
const apiServer = data.api_server || 'api.geetest.com';

Step 2: Submit to CaptchaAI

const API_KEY = 'YOUR_API_KEY';

const submitRes = await axios.get('https://ocr.captchaai.com/in.php', {
  params: {
    key: API_KEY,
    method: 'geetest',
    gt: gt,
    challenge: challenge,
    api_server: apiServer,
    pageurl: 'https://example.com/login',
    json: 1,
  },
});

if (submitRes.data.status !== 1) {
  throw new Error(`Submit failed: ${submitRes.data.request}`);
}

const taskId = submitRes.data.request;
console.log(`Task submitted: ${taskId}`);

Step 3: Poll for the solution

const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

await sleep(15000);

let solution;
for (let i = 0; i < 30; i++) {
  const pollRes = await axios.get('https://ocr.captchaai.com/res.php', {
    params: {
      key: API_KEY,
      action: 'get',
      id: taskId,
      json: 1,
    },
  });

  if (pollRes.data.status === 1) {
    solution = JSON.parse(pollRes.data.request);
    console.log('Challenge:', solution.challenge);
    console.log('Validate:', solution.validate);
    console.log('Seccode:', solution.seccode);
    break;
  }

  if (pollRes.data.request !== 'CAPCHA_NOT_READY') {
    throw new Error(`Error: ${pollRes.data.request}`);
  }

  await sleep(5000);
}

Step 4: Inject the solution

// Submit the solved values to the target site
const loginRes = await axios.post('https://example.com/api/login', {
  username: 'user@example.com',
  password: 'your_password',
  geetest_challenge: solution.challenge,
  geetest_validate: solution.validate,
  geetest_seccode: solution.seccode,
});

console.log(`Login status: ${loginRes.status}`);

Complete working example

const axios = require('axios');

const API_KEY = 'YOUR_API_KEY';
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

async function solveGeeTestV3() {
  // 1. Get fresh GeeTest parameters
  const { data: geeData } = await axios.get('https://example.com/api/geetest/register');

  // 2. Submit to CaptchaAI
  const { data: submitData } = await axios.get('https://ocr.captchaai.com/in.php', {
    params: {
      key: API_KEY,
      method: 'geetest',
      gt: geeData.gt,
      challenge: geeData.challenge,
      pageurl: 'https://example.com/login',
      json: 1,
    },
  });
  const taskId = submitData.request;

  // 3. Poll for result
  await sleep(15000);
  for (let i = 0; i < 30; i++) {
    const { data: pollData } = await axios.get('https://ocr.captchaai.com/res.php', {
      params: { key: API_KEY, action: 'get', id: taskId, json: 1 },
    });
    if (pollData.status === 1) {
      const solution = JSON.parse(pollData.request);
      console.log('Challenge:', solution.challenge);
      console.log('Validate:', solution.validate);
      console.log('Seccode:', solution.seccode);
      return solution;
    }
    if (pollData.request !== 'CAPCHA_NOT_READY') throw new Error(pollData.request);
    await sleep(5000);
  }
  throw new Error('Timeout waiting for solution');
}

solveGeeTestV3().catch(console.error);

Expected output:

Challenge: 1a2b3456cd67890e12345fab678901c2de
Validate:  09fe8d7c6ba54f32e1dcb0a9fedc8765
Seccode:   12fe3d4c56789ba01f2e345d6789c012|jordan

Common errors

Error Cause Fix
ERROR_BAD_PARAMETERS Missing gt or challenge Verify both parameters are present
ERROR_CAPTCHA_UNSOLVABLE Challenge expired Get a fresh challenge and retry
CAPCHA_NOT_READY Still processing Keep polling every 5 seconds
ERROR_ZERO_BALANCE No funds Top up your CaptchaAI account

FAQ

How long does GeeTest v3 solving take?

Typically 15–30 seconds. The challenge must remain valid during this window.

Can I use fetch instead of axios?

Yes. Replace axios.get() with fetch() and parse the JSON response manually. The API parameters are the same.

What if the challenge token expires before CaptchaAI solves it?

You'll get ERROR_CAPTCHA_UNSOLVABLE. Request a new challenge from the target site and resubmit.



Start solving GeeTest v3 with CaptchaAI →

Full Working Code

Complete runnable examples for this article in Python, Node.js, PHP, Go, Java, C#, Ruby, Rust, Kotlin & Bash.

View on GitHub →

Discussions (0)

No comments yet.