API Tutorials

Solve BLS CAPTCHA with Node.js and CaptchaAI

BLS CAPTCHA presents a 3×3 grid of images with a numeric instruction code specifying which cells to select. This tutorial shows you how to solve BLS CAPTCHAs from Node.js using the CaptchaAI API.


Prerequisites

Item Value
CaptchaAI API key From captchaai.com
Node.js 14+
Library axios (npm install axios)

How BLS CAPTCHA works

A 3×3 grid numbered left-to-right, top-to-bottom:

1 | 2 | 3
---------
4 | 5 | 6
---------
7 | 8 | 9

A numeric instruction (e.g., "664") specifies what to select. CaptchaAI returns the indices of matching cells.


Step 1: Extract grid images

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

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

// Get instruction code
const instruction = await page.$eval('.bls-instruction', (el) => el.textContent.trim());

// Get all 9 cell image URLs and convert to base64
const cellImages = await page.$$eval('.bls-grid img', (imgs) =>
  imgs.map((img) => img.src)
);

const images = [];
for (const src of cellImages) {
  if (src.startsWith('data:')) {
    images.push(src);
  } else {
    const { data } = await axios.get(src, { responseType: 'arraybuffer' });
    const b64 = Buffer.from(data).toString('base64');
    images.push(`data:image/png;base64,${b64}`);
  }
}

Step 2: Submit to CaptchaAI

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

const params = new URLSearchParams({
  key: API_KEY,
  method: 'bls',
  instructions: instruction,
  json: '1',
});

// Add all 9 images
images.forEach((img, i) => {
  params.append(`image_base64_${i + 1}`, img);
});

const { data: submitData } = await axios.post(
  'https://ocr.captchaai.com/in.php',
  params.toString()
);

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

Step 3: Poll for the solution

await sleep(5000);

let selectedCells;
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) {
    selectedCells = JSON.parse(pollData.request);
    console.log('Selected cells:', selectedCells);
    break;
  }
  if (pollData.request !== 'CAPCHA_NOT_READY') {
    throw new Error(pollData.request);
  }
  await sleep(5000);
}

Step 4: Click the correct cells

// Click each identified cell
const gridCells = await page.$$('.bls-grid img');
for (const cellNum of selectedCells) {
  await gridCells[cellNum - 1].click();
}

// Submit the form
await page.click('.bls-submit');
console.log(`Solved: clicked cells ${JSON.stringify(selectedCells)}`);
await browser.close();

Expected output:

Selected cells: [1, 4, 7, 8]
Solved: clicked cells [1,4,7,8]

Common errors

Error Cause Fix
ERROR_BAD_PARAMETERS Missing images or instruction Send all 9 images and the instruction code
CAPCHA_NOT_READY Still processing Keep polling every 5 seconds
ERROR_ZERO_BALANCE No funds Top up your CaptchaAI account

FAQ

Does BLS CAPTCHA support 4×4 grids?

BLS CAPTCHA uses 3×3 grids (9 cells). For 4×4 grids, use the Grid Image method instead.

How fast is BLS solving?

Typically 5–15 seconds.

Can I use Playwright instead of Puppeteer?

Yes. The API interaction is the same — just change the browser automation calls.



Start solving BLS CAPTCHAs with CaptchaAI →

Discussions (0)

No comments yet.

Related Posts

Explainers How BLS CAPTCHA Works: Grid Logic and Image Selection
Deep dive into BLS CAPTCHA grid logic — how images are arranged, how instructions map to selections, and how Captcha AI processes BLS challenges.

Deep dive into BLS CAPTCHA grid logic — how images are arranged, how instructions map to selections, and how C...

Automation BLS CAPTCHA
Apr 09, 2026
Use Cases Government Portal Automation with CAPTCHA Solving
Automate government portal interactions (visa applications, permit filings, records requests) with Captcha AI handling CAPTCHA challenges.

Automate government portal interactions (visa applications, permit filings, records requests) with Captcha AI...

Automation Python reCAPTCHA v2
Jan 30, 2026
Troubleshooting BLS CAPTCHA Errors and Troubleshooting
BLS CAPTCHA solving has unique challenges because it uses a custom implementation.

BLS CAPTCHA solving has unique challenges because it uses a custom implementation. Here are the most common er...

Automation BLS CAPTCHA
Mar 05, 2026
Explainers How BLS CAPTCHA Works
Understand how BLS CAPTCHA works on visa appointment systems.

Understand how BLS CAPTCHA works on visa appointment systems. Learn about its image selection mechanism, how i...

Automation BLS CAPTCHA
Apr 06, 2026
Tutorials BLS CAPTCHA: Understanding Instructions Codes and Solving
how BLS CAPTCHA instruction codes work, how to extract grid images, and how to solve BLS CAPTCHAs with Captcha AI's API.

Learn how BLS CAPTCHA instruction codes work, how to extract grid images, and how to solve BLS CAPTCHAs with C...

Automation Python BLS CAPTCHA
Mar 15, 2026
Comparisons BLS CAPTCHA vs reCAPTCHA Grid — Comparison
Compare BLS CAPTCHA and re CAPTCHA grid challenges.

Compare BLS CAPTCHA and re CAPTCHA grid challenges. Learn the differences in format, solving approach, and Cap...

Automation Migration BLS CAPTCHA
Feb 12, 2026
API Tutorials Solve GeeTest v3 CAPTCHA with Node.js and CaptchaAI
Step-by-step Node.js tutorial for solving Gee Test v 3 slide puzzle CAPTCHAs using the Captcha AI API.

Step-by-step Node.js tutorial for solving Gee Test v 3 slide puzzle CAPTCHAs using the Captcha AI API. Include...

Automation Testing GeeTest v3
Mar 04, 2026
API Tutorials Solve BLS CAPTCHA with Python and CaptchaAI
Step-by-step Python tutorial for solving BLS grid CAPTCHAs using the Captcha AI API.

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

Automation Python BLS CAPTCHA
Mar 29, 2026
API Tutorials How to Solve BLS CAPTCHA Step by Step
Complete guide to solving BLS CAPTCHAs with Captcha AI API.

Complete guide to solving BLS CAPTCHAs with Captcha AI API. Includes image extraction, multi-image submission,...

Automation BLS CAPTCHA
Feb 04, 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
API Tutorials How to Solve reCAPTCHA v2 Callback Using API
how to solve re CAPTCHA v 2 callback implementations using Captcha AI API.

Learn how to solve re CAPTCHA v 2 callback implementations using Captcha AI API. Detect the callback function,...

Automation reCAPTCHA v2 Webhooks
Mar 01, 2026
API Tutorials Solve GeeTest v3 CAPTCHA with Python and CaptchaAI
Step-by-step Python tutorial for solving Gee Test v 3 slide puzzle CAPTCHAs using the Captcha AI API.

Step-by-step Python tutorial for solving Gee Test v 3 slide puzzle CAPTCHAs using the Captcha AI API. Includes...

Automation Python Testing
Mar 23, 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