Developers / SDKs
JavaScript SDK.
Node.js 18+, no dependencies. One file. Give it a page address, get the token.
1. Add the client
Save the client as captora.js. Use ES modules ("type": "module" in package.json, or the .mjs extension).
captora.js
// captora.js: zero-dependency Captora client for Node.js 18+ (uses built-in fetch).const BASE_URL = "https://api.captora.me";export class Captora { constructor(apiKey, { baseUrl = BASE_URL, pollMs = 3000, timeoutMs = 180000 } = {}) { this.apiKey = apiKey; this.baseUrl = baseUrl; this.pollMs = pollMs; this.timeoutMs = timeoutMs; } async request(method, path, body) { const res = await fetch(this.baseUrl + path, { method, headers: { Authorization: `Bearer ${this.apiKey}`, "Content-Type": "application/json", "User-Agent": "captora-js/1.0", }, body: body ? JSON.stringify(body) : undefined, }); const data = await res.json().catch(() => ({})); if (!res.ok) throw new Error(`Captora error ${res.status}: ${data.error ?? "unknown"}`); return data; } /** Returns { balance_paise } (100 paise = ₹1). */ balance() { return this.request("GET", "/v1/balance"); } /** * The simple way: give the address of a page with a captcha. Captora recognises the captcha, solves it, * and returns its `result` (usually { token }). Pass `html` (the page's source) for pages that add the * captcha with JavaScript or need a login. Throws if it can't be solved (you are not charged). */ solveUrl(websiteURL, extra = {}) { return this.#wait(this.request("POST", "/v1/solve", { websiteURL, ...extra })); } /** Advanced: you already know the captcha type. Waits for the task and returns its `result`. */ solve(type, params) { return this.#wait(this.request("POST", "/v1/tasks", { type, ...params })); } async #wait(creating) { let task = await creating; const deadline = Date.now() + this.timeoutMs; while (task.status === "processing" && Date.now() < deadline) { await new Promise((resolve) => setTimeout(resolve, this.pollMs)); task = await this.request("GET", `/v1/tasks/${task.taskId}`); } if (task.status === "completed") return task.result; throw new Error(task.status === "failed" ? "Could not be solved (refunded)" : "Timed out"); }}2. Solve a captcha with one call
Put your API key in the CAPTORA_API_KEY environment variable (create one in your dashboard).
example.js
import { Captora } from "./captora.js";const captora = new Captora(process.env.CAPTORA_API_KEY);// Give it the page with the captcha. Captora finds the captcha and solves it.const result = await captora.solveUrl("https://example.com/login");console.log(result.token); // submit this token with your form// Know the type already? captora.solve("recaptcha_v2", { websiteURL, websiteKey })3. That's it. No captcha type to pick
Captora recognises the captcha on the page. For pages that add it with JavaScript or sit behind a login, pass the page's HTML as well (see the docs). If you already know the type, the client has a second method for that. Every captcha we support, and its price, is on the captchas page.
Keep in mind
- Keep your API key on your server. Never ship it in a browser or mobile app.
- Solving can take from a few seconds to a minute or more, so run it in the background of your app.
- Unsolved tasks raise an error and are refunded automatically.