Get API Key at anti-captcha.com
Modern Node.js library for the Anti-Captcha.com API. Clean, typed, and easy to use.
npm install node-anticaptcha
# or
pnpm install node-anticaptcha
# or
yarn add node-anticaptcha- 🎯 Clean, modern API design
- đź§ Built-in TypeScript declarations
- 🔄 Automatic task polling
- 🎨 Verbose logging support
- đź’° Revenue sharing support
- đź”§ Fully configurable
const { AntiCaptcha } = require('node-anticaptcha');
const client = new AntiCaptcha('YOUR_API_KEY', {
verbose: true,
verboseIdentifier: 'MyBot',
delay: 2000,
});import { AntiCaptcha } from 'node-anticaptcha';
const client = new AntiCaptcha('YOUR_API_KEY', {
verbose: true,
verboseIdentifier: 'MyBot',
delay: 2000,
});import { AntiCaptcha, type RecaptchaV2TaskProxyless } from 'node-anticaptcha';
const client = new AntiCaptcha('YOUR_API_KEY', {
verbose: true,
});
const task: RecaptchaV2TaskProxyless = {
type: 'RecaptchaV2TaskProxyless',
websiteURL: 'https://example.com',
websiteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
};
const result = await client.solve(task);softId- Your developer softId from developer center to earn 10% commissionverbose- Enable verbose logging (default:false)verboseIdentifier- Custom identifier for logsapiUrl- API endpoint URL (default:https://api.anti-captcha.com)delay- Delay between status checks in milliseconds (default:2000)callbackUrl- Optional web address where we can send the results of captcha task processing. Contents are sent by AJAX POST request and are identical to the contents of getTaskResult method.
const balance = await client.getBalance();
console.log(`Balance: $${balance.balance}`);const result = await client.solve({
type: 'RecaptchaV2TaskProxyless',
websiteURL: 'https://example.com',
websiteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
});
console.log('Token:', result.solution.gRecaptchaResponse);const result = await client.solve({
type: 'RecaptchaV3TaskProxyless',
websiteURL: 'https://example.com',
websiteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
minScore: 0.7,
pageAction: 'submit',
});
console.log('Token:', result.solution.gRecaptchaResponse);const result = await client.solve({
type: 'TurnstileTaskProxyless',
websiteURL: 'https://example.com',
websiteKey: '0x4AAAAAAADnPIDROzbs0Ajs',
});
console.log('Token:', result.solution.token);const fs = require('node:fs');
const imageBuffer = fs.readFileSync('captcha.png');
const result = await client.solve({
type: 'ImageToTextTask',
body: imageBuffer, // Can be Buffer or base64 string
phrase: false,
case: false,
numeric: 0,
math: false,
minLength: 0,
maxLength: 0,
languagePool: 'en',
});
console.log('Text:', result.solution.text);const result = await client.solve({
type: 'GeeTestTaskProxyless',
websiteURL: 'https://example.com',
gt: 'gt_value_here',
challenge: 'challenge_value_here',
});
console.log('Solution:', result.solution);const result = await client.solve({
type: 'FunCaptchaTaskProxyless',
websiteURL: 'https://example.com',
websitePublicKey: 'public_key_here',
});
console.log('Token:', result.solution.token);const result = await client.solve({
type: 'AntiGateTask',
websiteURL: 'https://example.com/login',
templateName: 'Login and fetch session',
variables: {
login: 'user@example.com',
password: 'strong-password',
twoFactorCode: '_WAIT_FOR_IT_', // send later via pushAntiGateVariable
},
domainsOfInterest: ['example.com'],
// Optional HTTPS proxy fields
proxyAddress: '1.2.3.4',
proxyPort: 8080,
proxyLogin: 'proxyUser',
proxyPassword: 'proxyPass',
});
console.log('Cookies:', result.solution.cookies);const result = await client.solve({
type: 'RecaptchaV2Task', // Note: Not "Proxyless"
websiteURL: 'https://example.com',
websiteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
proxyType: 'http',
proxyAddress: '1.2.3.4',
proxyPort: 8080,
proxyLogin: 'username',
proxyPassword: 'password',
userAgent: 'Mozilla/5.0...',
});
console.log('Token:', result.solution.gRecaptchaResponse);Get account balance.
Returns: Promise<AntiCaptchaBalanceResponse>
Create a new captcha task.
Parameters:
task- Task object (see task types below)callbackUrl- Optional web address where we can send the results of captcha task processing. Contents are sent by AJAX POST request and are identical to the contents of getTaskResult method. If not provided, will use the callbackUrl from constructor options if set.
Returns: Promise<AntiCaptchaCreateTaskResponse>
Get result of a task.
Parameters:
taskId- Task ID fromcreateTask()
Returns: Promise<AntiCaptchaGetTaskResultResponse>
Create and automatically poll for task completion.
Parameters:
task- Task object (see task types below)
Returns: Promise<AntiCaptchaSolveTaskResult>
Report incorrect image captcha result.
Parameters:
taskId- Task ID to report
Returns: Promise<AntiCaptchaReportResponse>
Report incorrect recaptcha result.
Parameters:
taskId- Task ID to report
Returns: Promise<AntiCaptchaReportResponse>
Report correct recaptcha result (for statistics and worker whitelisting).
Parameters:
taskId- Task ID to report
Returns: Promise<AntiCaptchaReportResponse>
Push variable to AntiGate task during execution.
Parameters:
taskId- Task IDname- Variable namevalue- Variable value
Returns: Promise<AntiCaptchaReportResponse>
Get queue load statistics to determine a suitable time for uploading tasks.
Parameters:
queueId- Queue identifier (1-29). See documentation for queue IDstemplateName- Optional template name for AntiGate queue (ID 25)
Returns: Promise<AntiCaptchaQueueStatsResponse>
Retrieve account spending statistics for a 24 hour period.
Parameters:
date- Unix timestamp of the hour from which to grab 24 hour stats (optional)queue- Queue name to filter by (optional)softId- Filter by softId from Developer Center (optional)ip- Filter by IP address used for API calls (optional)
Returns: Promise<AntiCaptchaSpendingStatsResponse>
Retrieve daily statistics for your registered application.
Parameters:
softId- The ID of your app from the Developer Centermode- Type of stats: 'errors', 'views', 'downloads', 'users', 'money' (default: 'errors')
Returns: Promise<AntiCaptchaAppStatsResponse>
Test method for debugging API requests. Returns parsed and raw POST data.
Parameters:
data- Any data object to test with (optional)
Returns: Promise<unknown>
ImageToTextTask- Solve image captchaImageToCoordinatesTask- Click coordinates on image
RecaptchaV2TaskProxyless- ReCaptcha V2 without proxyRecaptchaV2Task- ReCaptcha V2 with proxyRecaptchaV2EnterpriseTaskProxyless- ReCaptcha V2 Enterprise without proxyRecaptchaV2EnterpriseTask- ReCaptcha V2 Enterprise with proxyRecaptchaV3TaskProxyless- ReCaptcha V3 (supports Enterprise)
FunCaptchaTaskProxyless- FunCaptcha without proxyFunCaptchaTask- FunCaptcha with proxy
GeeTestTaskProxyless- GeeTest without proxy (V3 and V4)GeeTestTask- GeeTest with proxy (V3 and V4)
TurnstileTaskProxyless- Turnstile without proxyTurnstileTask- Turnstile with proxy
AntiGateTask- Custom tasks with templatesProsopoTaskProxyless- Prosopo captcha without proxyProsopoTask- Prosopo captcha with proxyFriendlyCaptchaTaskProxyless- Friendly Captcha without proxyFriendlyCaptchaTask- Friendly Captcha with proxyAmazonTaskProxyless- Amazon WAF without proxyAmazonTask- Amazon WAF with proxyAltchaTaskProxyless- Altcha without proxyAltchaTask- Altcha with proxy
The library is authored in TypeScript and ships first-class type declarations for every task, option, and response. Editors such as VS Code provide rich IntelliSense out of the box.
try {
const result = await client.solve({
type: 'RecaptchaV2TaskProxyless',
websiteURL: 'https://example.com',
websiteKey: 'invalid_key',
});
console.log(result.solution);
} catch (error) {
if (error.response) {
// API error
console.error('API Error:', error.response.data);
} else {
// Network or other error
console.error('Error:', error.message);
}
}ISC