muaraicaptcha
v1.1.0
Published
Official JavaScript/TypeScript SDK for the MuaraiCaptcha solving API
Maintainers
Readme
MuaraiCaptcha — JavaScript / TypeScript SDK
Official Node.js & TypeScript client for the MuaraiCaptcha solving API.
Zero dependencies — uses the built-in fetch (Node 18+). Ships with TypeScript types.
Install
npm install muaraicaptchaQuick start
import { MuaraiCaptcha } from "muaraicaptcha";
// or: const { MuaraiCaptcha } = require("muaraicaptcha");
const client = new MuaraiCaptcha("YOUR_API_KEY");
const solution = await client.solve({
type: "TurnstileTaskProxyless",
websiteURL: "https://example.com",
websiteKey: "0x4AAAAAAA...",
});
console.log(solution.token);⚠️ Call MuaraiCaptcha from your backend only. Never expose your API key in browser code.
API
const client = new MuaraiCaptcha(clientKey, { baseUrl?, timeout? });
client.getBalance(): Promise<number>
client.createTask(task): Promise<number> // taskId
client.getTaskResult(taskId): Promise<Solution | null> // null while processing
client.reportIncorrect(taskId): Promise<void> // auto-refund
client.solve(task, { pollInterval?, timeout? }): Promise<Solution>Manual create + poll
const taskId = await client.createTask({
type: "RecaptchaV2TaskProxyless",
websiteURL: "https://example.com/login",
websiteKey: "6Lc_a...",
});
let solution = null;
while (!solution) {
await new Promise((r) => setTimeout(r, 5000));
solution = await client.getTaskResult(taskId);
}
console.log(solution.gRecaptchaResponse);Error handling
import { ApiError, TimeoutError } from "muaraicaptcha";
try {
await client.solve({ ... });
} catch (e) {
if (e instanceof ApiError) console.error(e.code, e.description);
else if (e instanceof TimeoutError) console.error("gave up");
}Documentation
License
MIT © MuaraiCaptcha
