CAPSOLVER
Blog
How to solve reCaptcha v3 with Node.JS

How to Solve reCAPTCHA v3 with Node.JS

Logo of CapSolver

Lucas Mitchell

Automation Engineer

15-Sep-2023

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

🤖 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

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.

Compliance Disclaimer: The information provided on this blog is for informational purposes only. CapSolver is committed to compliance with all applicable laws and regulations. The use of the CapSolver network for illegal, fraudulent, or abusive activities is strictly prohibited and will be investigated. Our captcha-solving solutions enhance user experience while ensuring 100% compliance in helping solve captcha difficulties during public data crawling. We encourage responsible use of our services. For more information, please visit our Terms of Service and Privacy Policy.

More

How to Identify and Obtain reCAPTCHA “s” Parameter Data
How to Identify and Obtain reCAPTCHA “s” Parameter Data

Learn to identify and obtain reCaptcha 's' data for effective captcha solving. Follow our step-by-step guide on using Capsolver's tools and techniques.

reCAPTCHA
Logo of CapSolver

Ethan Collins

25-Nov-2025

How to identify the extra parameters required for solve Google ReCaptcha
How to Identify and Submit reCAPTCHA Extra Parameters (v2/v3/Enterprise) | CapSolver Guide

Learn how to detect and submit extra reCAPTCHA parameters using CapSolver to improve accuracy and solve complex challenges.

reCAPTCHA
Logo of CapSolver

Rajinder Singh

10-Nov-2025

 How to Solve reCAPTCHA When Scraping Search Results with Puppeteer
How to Solve reCAPTCHA When Scraping Search Results with Puppeteer

Master the art of Puppeteer web scraping by learning how to reliably solve reCAPTCHA v2 and v3. Discover the best puppeteer recaptcha solver techniques for large-scale data harvesting and SEO automation.

reCAPTCHA
Logo of CapSolver

Lucas Mitchell

04-Nov-2025

AI Powered SEO Automation: How to Solve Captcha for Smarter SERP Data Collection
AI Powered SEO Automation: How to Solve Captcha for Smarter SERP Data Collection

Discover how AI Powered SEO Automation overcomes CAPTCHA challenges for smarter SERP data collection and learn about reCAPTCHA v2/v3 solutions

reCAPTCHA
Logo of CapSolver

Emma Foster

23-Oct-2025

Recaptcha Solver
reCAPTCHA Solver Auto Recognition and Solve Methods

Learn how to automatically recognize and solve Google reCAPTCHA v2, v3, invisible, and enterprise challenges using advanced AI and OCR techniques

reCAPTCHA
Logo of CapSolver

Sora Fujimoto

22-Oct-2025

Solve reCAPTCHA v2 Guide
How to Solve reCAPTCHA v2: Solve reCAPTCHA v2 Guide

Learn how to automate solving Google reCAPTCHA v2 using CapSolver. Discover API and SDK integration, step-by-step guides, and bonus codes to streamline captcha solving for web scraping, automation, and development projects.

reCAPTCHA
Logo of CapSolver

Aloísio Vítor

21-Oct-2025