API Tutorials

Solve reCAPTCHA Invisible with Node.js and CaptchaAI

Invisible reCAPTCHA v2 operates without user interaction — no checkbox, no image challenge (unless suspicious behavior is detected). It executes programmatically on form submit or button click. When submitting to CaptchaAI, you must include the invisible=1 parameter.


Prerequisites

Item Value
CaptchaAI API key From captchaai.com
Node.js 14+
Libraries axios, puppeteer

Step 1: Detect the site key

const puppeteer = require('puppeteer');
const axios = require('axios');

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com/login');

// Extract site key and check if invisible
const siteKey = await page.$eval('[data-sitekey]', (el) => el.getAttribute('data-sitekey'));
const isInvisible = await page.$eval('[data-sitekey]', (el) => el.getAttribute('data-size') === 'invisible');
console.log(`Site key: ${siteKey}, Invisible: ${isInvisible}`);

Step 2: Submit to CaptchaAI

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

const { data: submitData } = await axios.get('https://ocr.captchaai.com/in.php', {
  params: {
    key: API_KEY,
    method: 'userrecaptcha',
    googlekey: siteKey,
    pageurl: page.url(),
    invisible: 1,
    json: 1,
  },
});

if (submitData.status !== 1) throw new Error(submitData.request);
const taskId = submitData.request;
console.log(`Task submitted: ${taskId}`);

Step 3: Poll for the token

await sleep(15000);

let token;
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) {
    token = pollData.request;
    console.log(`Token: ${token.slice(0, 50)}...`);
    break;
  }
  if (pollData.request !== 'CAPCHA_NOT_READY') {
    throw new Error(pollData.request);
  }
  await sleep(5000);
}

Step 4: Inject and submit

// Inject the token
await page.evaluate((t) => {
  document.getElementById('g-recaptcha-response').innerHTML = t;
}, token);

// Check for callback and execute if present
const hasCallback = await page.evaluate(() => {
  const el = document.querySelector('[data-callback]');
  return el ? el.getAttribute('data-callback') : null;
});

if (hasCallback) {
  await page.evaluate((cb, t) => window[cb](t), hasCallback, token);
}

// Submit the form
await page.click('form [type="submit"]');
console.log('Form submitted with solved invisible reCAPTCHA');
await browser.close();

Complete working example

const puppeteer = require('puppeteer');
const axios = require('axios');

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

async function solveInvisibleRecaptcha() {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com/login');

  // 1. Get site key
  const siteKey = await page.$eval('[data-sitekey]', (el) => el.getAttribute('data-sitekey'));

  // 2. Submit to CaptchaAI
  const { data: submit } = await axios.get('https://ocr.captchaai.com/in.php', {
    params: {
      key: API_KEY, method: 'userrecaptcha', googlekey: siteKey,
      pageurl: page.url(), invisible: 1, json: 1,
    },
  });
  const taskId = submit.request;

  // 3. Poll for token
  await sleep(15000);
  let token;
  for (let i = 0; i < 30; i++) {
    const { data: poll } = await axios.get('https://ocr.captchaai.com/res.php', {
      params: { key: API_KEY, action: 'get', id: taskId, json: 1 },
    });
    if (poll.status === 1) { token = poll.request; break; }
    if (poll.request !== 'CAPCHA_NOT_READY') throw new Error(poll.request);
    await sleep(5000);
  }

  // 4. Inject and submit
  await page.evaluate((t) => {
    document.getElementById('g-recaptcha-response').innerHTML = t;
  }, token);
  await page.click('form [type="submit"]');
  console.log('Solved invisible reCAPTCHA');
  await browser.close();
}

solveInvisibleRecaptcha().catch(console.error);

FAQ

Is the invisible=1 flag required?

Yes. Without it, CaptchaAI may process the request as standard reCAPTCHA v2, which can lead to failed solves.

How do I know if a site uses invisible reCAPTCHA?

Look for data-size="invisible" on the reCAPTCHA div, or check if the widget is positioned off-screen in the CSS.

Can I solve this without a browser?

Yes. If you know the site key and page URL, you can submit directly with requests/axios and use the token in your HTTP requests.



Start solving reCAPTCHA Invisible 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.

Related Posts

Tutorials Building a CAPTCHA Solving Queue in Node.js
Build a production CAPTCHA solving queue in Node.js.

Build a production CAPTCHA solving queue in Node.js. Promise-based concurrency, p-queue, Event Emitter pattern...

Automation All CAPTCHA Types DevOps
Mar 24, 2026
Tutorials Node.js Playwright + CaptchaAI Complete Integration
Complete guide to integrating Captcha AI with Node.js Playwright.

Complete guide to integrating Captcha AI with Node.js Playwright. Solve re CAPTCHA, Turnstile, and image CAPTC...

Automation Cloudflare Turnstile Node.js
Apr 05, 2026
Tutorials Node.js CAPTCHA Solving with Retry and Error Handling
Build robust CAPTCHA solving in Node.js with retry logic, exponential backoff, circuit breakers, and proper error classification for Captcha AI.

Build robust CAPTCHA solving in Node.js with retry logic, exponential backoff, circuit breakers, and proper er...

Automation All CAPTCHA Types Node.js
Apr 04, 2026
Tutorials Solving Cloudflare Turnstile with Node.js and CaptchaAI
Complete Node.js tutorial for solving Cloudflare Turnstile using Captcha AI.

Complete Node.js tutorial for solving Cloudflare Turnstile using Captcha AI. Extract sitekey, solve via API, s...

Automation Cloudflare Turnstile Node.js
Jan 25, 2026
Explainers reCAPTCHA v2 Invisible: Trigger Detection and Solving
Detect and solve re CAPTCHA v 2 Invisible challenges with Captcha AI — identify triggers, extract parameters, and handle auto-invoked CAPTCHAs.

Detect and solve re CAPTCHA v 2 Invisible challenges with Captcha AI — identify triggers, extract parameters,...

Automation Python reCAPTCHA v2
Apr 07, 2026
Tutorials Solving GeeTest v3 with Node.js and CaptchaAI API
Complete Node.js tutorial for solving Gee Test v 3 slide puzzles with Captcha AI.

Complete Node.js tutorial for solving Gee Test v 3 slide puzzles with Captcha AI. Extract gt/challenge paramet...

Automation Testing GeeTest v3
Apr 01, 2026
API Tutorials How to Solve Cloudflare Challenge with Node.js
Solve Cloudflare Challenge pages using Node.js and Captcha AI API.

Solve Cloudflare Challenge pages using Node.js and Captcha AI API. Complete guide with proxy setup, cf_clearan...

Automation Cloudflare Challenge Node.js
Mar 31, 2026
API Tutorials Solve Image CAPTCHA with Node.js and CaptchaAI
Step-by-step Node.js tutorial for solving distorted text image CAPTCHAs using the Captcha AI OCR API.

Step-by-step Node.js tutorial for solving distorted text image CAPTCHAs using the Captcha AI OCR API. Includes...

Automation Image OCR Node.js
Mar 21, 2026
Tutorials Node.js Worker Threads for Parallel CAPTCHA Solving
Use Node.js Worker Threads for true parallel CAPTCHA solving with Captcha AI.

Use Node.js Worker Threads for true parallel CAPTCHA solving with Captcha AI. Offload solving to separate thre...

Automation Image OCR DevOps
Mar 11, 2026
API Tutorials Solve BLS CAPTCHA with Node.js and CaptchaAI
Step-by-step Node.js tutorial for solving BLS grid CAPTCHAs using the Captcha AI API.

Step-by-step Node.js tutorial for solving BLS grid CAPTCHAs using the Captcha AI API. Includes grid extraction...

Automation BLS CAPTCHA Node.js
Mar 07, 2026
API Tutorials How to Solve reCAPTCHA v2 Enterprise Using API
Step-by-step guide to solving re CAPTCHA v 2 Enterprise using Captcha AI API.

Step-by-step guide to solving re CAPTCHA v 2 Enterprise using Captcha AI API. Detect Enterprise vs standard, e...

Automation reCAPTCHA v2 reCAPTCHA Enterprise
Jan 26, 2026
API Tutorials Case-Sensitive CAPTCHA API Parameter Guide
How to use the regsense parameter for case-sensitive CAPTCHA solving with Captcha AI.

How to use the regsense parameter for case-sensitive CAPTCHA solving with Captcha AI. Covers when to use, comm...

Python Web Scraping Image OCR
Apr 09, 2026
API Tutorials reCAPTCHA Data-S Parameter Explained
Understand the re CAPTCHA data-s parameter: what it is, when it appears, why it matters for solving, and how to extract and include it in API solver requests.

Understand the re CAPTCHA data-s parameter: what it is, when it appears, why it matters for solving, and how t...

Automation reCAPTCHA v2
Jan 23, 2026