Node.js Captcha Solver

Solve image captchas in Node.js with axios or node-fetch. FastCaptcha returns the answer in 0.3–0.7 seconds — works with Puppeteer, Playwright, and any Node.js HTTP client.

Node.js Captcha Solver — Quick Start

Two options: axios (CommonJS) or native fetch (Node 18+)

Using axios (recommended)

# Install dependencies
npm install axios form-data
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

async function solveCaptcha(imagePath) {
  const form = new FormData();
  form.append('image', fs.createReadStream(imagePath));

  const { data } = await axios.post(
    'https://fastcaptcha.org/api/v1/ocr/',
    form,
    {
      headers: {
        'X-API-Key': 'YOUR_API_KEY',
        ...form.getHeaders()
      }
    }
  );

  return data.text; // "XK92B" in 0.3s
}

solveCaptcha('captcha.png').then(console.log);

Using native fetch (Node 18+)

# No extra packages needed (Node 18+)
import { readFile } from 'fs/promises';

async function solveCaptcha(imagePath) {
  const imageBuffer = await readFile(imagePath);
  const blob = new Blob([imageBuffer]);

  const form = new FormData();
  form.append('image', blob, 'captcha.png');

  const res = await fetch(
    'https://fastcaptcha.org/api/v1/ocr/',
    {
      method: 'POST',
      headers: { 'X-API-Key': 'YOUR_API_KEY' },
      body: form
    }
  );

  const data = await res.json();
  return data.text; // "XK92B" in 0.3s
}

console.log(await solveCaptcha('captcha.png'));

Integration with Puppeteer & Playwright

Automate captcha solving in your browser automation scripts

Puppeteer

const puppeteer = require('puppeteer');
const axios = require('axios');
const FormData = require('form-data');

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

// Screenshot captcha element
const captchaEl = await page.$('#captcha-img');
const imgBuffer = await captchaEl.screenshot();

// Solve with FastCaptcha
const form = new FormData();
form.append('image', imgBuffer, 'captcha.png');

const { data } = await axios.post(
  'https://fastcaptcha.org/api/v1/ocr/',
  form,
  { headers: { 'X-API-Key': 'YOUR_KEY', ...form.getHeaders() } }
);

// Type solution into captcha field
await page.type('#captcha-input', data.text);
await page.click('#submit-btn');

Playwright

const { chromium } = require('playwright');
const axios = require('axios');
const FormData = require('form-data');

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

// Screenshot captcha element
const captchaEl = page.locator('#captcha-img');
const imgBuffer = await captchaEl.screenshot();

// Solve with FastCaptcha (0.3s)
const form = new FormData();
form.append('image', imgBuffer, 'captcha.png');

const { data } = await axios.post(
  'https://fastcaptcha.org/api/v1/ocr/',
  form,
  { headers: { 'X-API-Key': 'YOUR_KEY', ...form.getHeaders() } }
);

// Fill in and submit
await page.fill('#captcha-input', data.text);
await page.click('#submit-btn');

Node.js Captcha Solver FAQ

For Node.js <18: npm install axios form-data. For Node.js 18+: nothing extra — native fetch and FormData are built in.

Yes. FastCaptcha returns results synchronously (no polling). Just await the axios/fetch call and you have the answer in 0.3–0.7 seconds.

We recommend server-side usage to keep your API key secure. For browser extensions, the extension context can safely use the API. Direct browser usage would expose your API key.

Start Solving Captchas in Node.js

Free API key. 100 credits. No credit card.