ProductsIntegrationsResourcesDocumentationPricing
Start Now

© 2026 CapSolver. All rights reserved.

CONTACT US

Slack: lola@capsolver.com

Products

  • reCAPTCHA v2
  • reCAPTCHA v3
  • Cloudflare Turnstile
  • Cloudflare Challenge
  • AWS WAF
  • Browser Extension
  • Many more CAPTCHA types

Integrations

  • Selenium
  • Playwright
  • Puppeteer
  • n8n
  • Partners
  • View All Integrations

Resources

  • Referral System
  • Documentation
  • API Reference
  • Blog
  • FAQs
  • Glossary
  • Status

Legal

  • Terms & Conditions
  • Privacy Policy
  • Refund Policy
  • Don't Sell My Info
Blog/reCAPTCHA/How to Solve reCAPTCHA v3 with Node.JS
Sep15, 2023

How to Solve reCAPTCHA v3 with Node.JS

Lucas Mitchell

Lucas Mitchell

Automation Engineer

Automating SEO tools, Google Search scraping, bot workflows, or browserless crawlers often requires interacting with websites protected by reCAPTCHA v3. Unlike reCAPTCHA v2, version 3 does not show image challenges—it assigns a silent risk score from 0.0 to 1.0, and bots typically receive scores below 0.3.
To achieve human-like behavior and obtain stable scores 0.7–0.9, your automation script must:

  • Send proper headers
  • Use correct pageAction
  • Generate a realistic token with a reliable solver

In this guide, you'll learn how to solve reCAPTCHA v3 using Node.js + CapSolver, with a ready-to-run script, configuration tips, and best practices for maximizing score quality.

⚙️ Prerequisites

  • Node.JS Installed
  • CapSolver API key

🤖 Step 1: Install Necessary Packages

Execute the following commands to install the required packages:

JS Copy
npm install axios

👨‍💻 Step 2: Node.JS Code for solve reCaptcha v3 and get 0.7-0.9 score

Here's a Node.JS sample script to accomplish the task:

js Copy
const PAGE_URL = "https://antcpt.com/score_detector";
const PAGE_KEY = "6LcR_okUAAAAAPYrPe-HK_0RULO1aZM15ENyM-Mf";
const PAGE_ACTION = "homepage";
const CAPSOLVER_KEY = "YourKey"

async function createTask(url, key, pageAction) {
    try {
      // Define the API endpoint and payload as per the service documentation.
      const apiUrl = "https://api.capsolver.com/createTask";
      const payload = {
        clientKey: CAPSOLVER_KEY,
        task: {
          type: "ReCaptchaV3TaskProxyLess",
          websiteURL: url,
          websiteKey: key,
          pageAction: pageAction
        }
      };
      const headers = {
        'Content-Type': 'application/json',
      };
      const response = await axios.post(apiUrl, payload, { headers });
      return response.data.taskId;
  
    } catch (error) {
      console.error("Error creating CAPTCHA task: ", error);
      throw error;
    }
  }
  
  async function getTaskResult(taskId) {
    try {
      const apiUrl = "https://api.capsolver.com/getTaskResult";
      const payload = {
        clientKey: CAPSOLVER_KEY,
        taskId: taskId,
      };
      const headers = {
        'Content-Type': 'application/json',
      };
      let result;
      do {
        const response = await axios.post(apiUrl, payload, { headers });
        result = response.data;
        if (result.status === "ready") {
          return result.solution;
        }
        await new Promise(resolve => setTimeout(resolve, 5000)); // wait 5 seconds before retrying
      } while (true);
  
    } catch (error) {
      console.error("Error getting CAPTCHA result: ", error);
      throw error;
    }
  }
  

function setSessionHeaders() {
  return {
    'cache-control': 'max-age=0',
    'sec-ch-ua': '"Not/A)Brand";v="99", "Google Chrome";v="107", "Chromium";v="107"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': 'Windows',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'sec-fetch-site': 'same-origin',
    'sec-fetch-mode': 'navigate',
    'sec-fetch-user': '?1',
    'sec-fetch-dest': 'document',
    'accept-encoding': 'gzip, deflate',
    'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,en-US;q=0.7',
  };
}

async function main() {
    
    const headers = setSessionHeaders();
    console.log("Creating CAPTCHA task...");
    const taskId = await createTask(PAGE_URL, PAGE_KEY, PAGE_ACTION);
    console.log(`Task ID: ${taskId}`);

    console.log("Retrieving CAPTCHA result...");
    const solution = await getTaskResult(taskId);
    const token = solution.gRecaptchaResponse;
    console.log(`Token Solution ${token}`);


  const res = await axios.post("https://antcpt.com/score_detector/verify.php", { "g-recaptcha-response": token }, { headers });
  const response = res.data;
  console.log(`Score: ${response.score}`);
}

main().catch(err => {
  console.error(err);
});

⚠️ Change these variables

  • capsolver.api_key: Obtain your API key from the Capsolver Dashboard.
  • PAGE_URL: Replace with the URL of the website for which you wish to solve the reCaptcha v3.
  • PAGE_KEY: Update with the specific key of the site with recaptcha.
  • PAGE_ACTION: Replace with the pageAction of the page. You can read this blog

👀 More information

  • How to solve reCaptcha v3 and get a score 0.7-0.9 like a human
  • Solve all types of reCaptcha v2 / v2 invisible / v2 enterprise / v3 / v3 enterprise

✅ Conclusion

Solving Google reCAPTCHA v3 is essential for modern automation tasks such as SEO monitoring, SERP scraping, account workflows, and backend verification systems. Using Node.js + CapSolver, you can reliably generate high-score reCAPTCHA tokens and avoid being flagged as automated traffic.

By correctly setting sitekey, pageAction, headers, and following the CapSolver task structure, your automation pipeline becomes stable, scalable, and resistant to reCAPTCHA detection.

❓ FAQ

1. What is reCAPTCHA v3 and how is it different from v2?

reCAPTCHA v3 assigns a behavior-based score (0.0–1.0) instead of showing image challenges. It runs invisibly in the background and evaluates user interactions to detect bots.

2. How do I find the reCAPTCHA v3 sitekey on a website?

You can locate the sitekey in the HTML (data-sitekey attribute) or inside the JavaScript that loads https://www.google.com/recaptcha/api.js.

3. What does pageAction mean in reCAPTCHA v3?

pageAction tells Google what activity the user is performing, such as login, search, or submit. Using the wrong value can drastically reduce your score.

4. Why is my reCAPTCHA v3 score still low after solving?

Common reasons include: incorrect pageAction, low-quality IP, invalid headers, or sitekey mismatch. CapSolver provides optimized scoring models that help achieve higher scores.

5. Can I use this Node.js solution with Puppeteer, Playwright, or Selenium?

Yes. After obtaining the token, you can inject it into your browser session’s form or call the verification endpoint directly.

More

reCAPTCHAApr 16, 2026

reCAPTCHA Score Explained: Range, Meaning, and How to Improve It

Understand reCAPTCHA v3 score range (0.0 to 1.0), its meaning, and how to improve your score. Learn how to handle low scores and optimize user experience.

Rajinder Singh
Rajinder Singh
reCAPTCHAApr 16, 2026

reCAPTCHA Invalid Site Key or Token? Causes & Fix Guide

Facing "reCAPTCHA Invalid Site Key" or "invalid reCAPTCHA token" errors? Discover common causes, step-by-step fixes, and troubleshooting tips to resolve reCAPTCHA verification failed issues. Learn how to fix reCAPTCHA verification failed please try again.

Contents

Aloísio Vítor
Aloísio Vítor
reCAPTCHAApr 15, 2026

reCAPTCHA Verification Failed? How to Fix "Please Try Again" Errors

Fix reCAPTCHA verification failed errors fast. Step-by-step manual fixes for users and a Python API guide for developers using CapSolver. Covers v2, v3, and Enterprise.

Adélia Cruz
Adélia Cruz
reCAPTCHAApr 15, 2026

reCAPTCHA v2 vs v3: Key Differences Every Developer Should Know

Understand the difference between reCAPTCHA v2 and v3 — how each works, when to use them, and how automated workflows handle both. A clear, technical comparison for developers.

Nikolai Smirnov
Nikolai Smirnov