← nocaptchaai.comDocs
    DocsChangelog

    Get Started

    Start Here
    QuickstartAuthenticationError Codes
    Browser Extension

    Captcha Types

    Token Tasks
    Cloudflare Turnstile Task
    Image Tasks
    ReCaptcha v2GeeTest V4ImageToTextBLS CaptchaBinanceAWS WAFTikTokDB-betMTCaptchaTencentProSOPO

    API Reference

    Overview
    Solver
    Create async captcha solving taskPoll task result (GET)Poll task resultSolve captchaGet response statusCollect endpoint (reserved)Report accuracy feedbackGet accuracy report
    Balance
    Check balance & plan infoLegacy balance formatList all error codes
    System
    Health check

    SDKs

    OverviewPythonJavaScript / Node.jsGo

    Agents

    OverviewModel Context Protocol (MCP)Claude CodeOpenAI CodexCursorClineOpenClaw

    Guides

    Browser ExtensionError HandlingChoosing a Task Type
    ← nocaptchaai.com
    Get API key
    Sign inGet API key

    JavaScript / Node.js

    Solve captchas from Node.js.

    Loading…

    PreviousPythonNextGo
    [ ] Docs[ ] Extension[ ] Pricing[ ] Changelog[ ] Partners[ ] Terms[ ] Privacy[ ] Cookies[ ] Refunds[ ] Contact

    Spicrawl

    Free web scraping API for AI agents.

    spicrawl.com

    Spicrawl

    © 2026 NoCaptchaAI

    The helper below uses the native fetch API (built into Node.js 18+, no dependencies). It submits a task with POST /createTask, polls POST /getTaskResult until the status is ready, and throws if the API reports an error or the timeout is exceeded. The example solves a Cloudflare Turnstile challenge.

    Keep your key out of source control

    Read the API key from an environment variable rather than hardcoding it. Set it once with export NOCAPTCHAAI_KEY="your-key" (get one at nocaptchaai.com/app/api-keys).

    js
    const BASE_URL = "https://api.nocaptchaai.com";
    const API_KEY = process.env.NOCAPTCHAAI_KEY;
    
    const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
    
    async function post(path, body) {
      const res = await fetch(`${BASE_URL}${path}`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(body),
      });
      return res.json();
    }
    
    /**
     * Create a task, poll until it is ready, and return the solution.
     * Throws on an API error or if the timeout is reached.
     */
    async function solve(task, { pollInterval = 3000, timeout = 120000 } = {}) {
      const created = await post("/createTask", { clientKey: API_KEY, task });
      if (created.errorId) {
        throw new Error(`createTask failed: ${JSON.stringify(created)}`);
      }
    
      const taskId = created.taskId;
      const deadline = Date.now() + timeout;
    
      while (true) {
        const result = await post("/getTaskResult", { clientKey: API_KEY, taskId });
    
        if (result.status === "ready") return result.solution;
        if (result.status === "failed" || result.errorId) {
          throw new Error(`task failed: ${JSON.stringify(result)}`);
        }
        if (Date.now() >= deadline) {
          throw new Error(`timed out waiting for task ${taskId}`);
        }
    
        await sleep(pollInterval);
      }
    }
    
    const solution = await solve({
      type: "AntiTurnstileTask",
      websiteURL: "https://example.com",
      websiteKey: "0x4AAAAAAA...",
    });
    console.log(solution);
    

    Call solve() with any task object — swap the type, websiteURL, and websiteKey for the captcha you need to solve. The returned solution object contains the token (and any other fields) you submit back to the target site.