TypeScript / JavaScript

Official CapBypass SDK for Node.js and TypeScript

Installation

npm install @capbypass/sdk
pnpm add @capbypass/sdk
yarn add @capbypass/sdk
bun add @capbypass/sdk

Requirements: Node.js 18.12.0 or later.

Quick Start

import { CapBypassClient, TaskType } from '@capbypass/sdk';

const client = new CapBypassClient({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'https://api.capbypass.pro',
});

// One-step solve (recommended)
const solution = await client.solve({
  type: TaskType.RECAPTCHA_V3_PROXYLESS,
  websiteURL: 'https://example.com',
  websiteKey: '6LdyC2cUAAAAACGuDKpXeDorzUDWXmdqeg-xy696',
  pageAction: 'login',
});

console.log('Token:', solution.gRecaptchaResponse);

Constructor Options

const client = new CapBypassClient({
  apiKey: 'YOUR_API_KEY',           // Required (or set CAPBYPASS_API_KEY env var)
  baseURL: 'https://api.capbypass.pro', // API base URL
  developerKey: 'DEV_KEY',         // Optional, for affiliate tracking
});
OptionTypeDefaultDescription
apiKeystringCAPBYPASS_API_KEY envYour API key
baseURLstring-API base URL
developerKeystringCAPBYPASS_DEVELOPER_KEY envAffiliate developer key

Methods

solve(task, timeout?) - One-Step Solve

Recommended approach

Use solve() for most integrations. It handles task creation and polling automatically, so you don't need to manage the polling loop yourself.

Creates a task and polls until completion.

const solution = await client.solve({
  type: TaskType.RECAPTCHA_V3_PROXYLESS,
  websiteURL: 'https://example.com',
  websiteKey: '6LdyC2cUAAAAACGuDKpXeDorzUDWXmdqeg-xy696',
  pageAction: 'login',
}, 120); // timeout in seconds (default: 120)

createTask(task) - Create Task

Returns a task ID for manual polling.

const taskId = await client.createTask({
  type: TaskType.ANTI_AWS_WAF_PROXYLESS,
  websiteURL: 'https://example.com',
});

getTaskResult(taskId) - Get Result

Poll for a task's result. If you poll yourself, call it every 1 to 3 seconds, not faster, starting about 1 second after createTask.

const result = await client.getTaskResult(taskId);

if (result.status === 'ready') {
  console.log(result.solution);
} else if (result.status === 'processing') {
  // Still working, poll again
}

getBalance() - Check Balance

const balance = await client.getBalance();
console.log(`Balance: $${balance}`);

getPricing() - Get Pricing

Public endpoint, no API key required.

const pricing = await client.getPricing();
// [{ task_type: 'ReCaptchaV3TaskProxyLess', user_cost: 0.0006, status: 'active' }, ...]

Task Types

import { TaskType } from '@capbypass/sdk';

TaskType.RECAPTCHA_V2                    // 'ReCaptchaV2Task'
TaskType.RECAPTCHA_V2_PROXYLESS          // 'ReCaptchaV2TaskProxyLess'
TaskType.RECAPTCHA_V3                    // 'ReCaptchaV3Task'
TaskType.RECAPTCHA_V3_PROXYLESS          // 'ReCaptchaV3TaskProxyLess'
TaskType.RECAPTCHA_V3_ENTERPRISE         // 'ReCaptchaV3EnterpriseTask'
TaskType.RECAPTCHA_V3_ENTERPRISE_PROXYLESS // 'ReCaptchaV3EnterpriseTaskProxyLess'
TaskType.ANTI_AWS_WAF                    // 'AntiAwsWafTask'
TaskType.ANTI_AWS_WAF_PROXYLESS          // 'AntiAwsWafTaskProxyLess'
TaskType.GEETEST                         // 'GeetestTask'
TaskType.GEETEST_PROXYLESS               // 'GeetestTaskProxyLess'
TaskType.HCAPTCHA                        // 'HCaptchaTask'
TaskType.HCAPTCHA_PROXYLESS              // 'HCaptchaTaskProxyless'
TaskType.CAPTCHA_FOX                     // 'CaptchaFoxTask'
TaskType.CAPTCHA_FOX_PROXYLESS           // 'CaptchaFoxTaskProxyLess'

Cloudflare Turnstile and CaptchaFox

CaptchaFox is typed: TaskType.CAPTCHA_FOX and TaskType.CAPTCHA_FOX_PROXYLESS.

import { CapBypassClient, TaskType } from '@capbypass/sdk';

const client = new CapBypassClient({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'https://api.capbypass.pro',
});

const solution = await client.solve({
  type: TaskType.CAPTCHA_FOX_PROXYLESS,
  websiteURL: 'https://signup.gmx.com/',
  websiteKey: 'sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
});

console.log('Token:', solution.token);

Turnstile is not typed yet

TaskType has no Turnstile entry. solve() and createTask() send the task object as you build it, so pass the plain type string and cast it to TaskTypeValue to satisfy the compiler.

import { CapBypassClient, type TaskTypeValue } from '@capbypass/sdk';

const client = new CapBypassClient({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'https://api.capbypass.pro',
});

const solution = await client.solve({
  type: 'TurnstileTaskProxyLess' as TaskTypeValue,
  websiteURL: 'https://example.com/login',
  websiteKey: '0x4AAAAAAAxxxxxxxxxxxxxx',
});

console.log('Token:', solution.token);

Both answer with solution.token. For the proxy variants, the extra action / cData fields and the per-key availability of the Turnstile types, see Cloudflare Turnstile and CaptchaFox.

Error Handling

The SDK throws typed errors you can catch:

import {
  CapBypassError,
  AuthenticationError,
  InsufficientBalanceError,
  TimeoutError,
  SolverError,
} from '@capbypass/sdk';

try {
  const solution = await client.solve(task);
} catch (error) {
  if (error instanceof AuthenticationError) {
    // Invalid API key
  } else if (error instanceof InsufficientBalanceError) {
    // Need to top up
  } else if (error instanceof TimeoutError) {
    // Task took too long
  } else if (error instanceof SolverError) {
    // Challenge unsolvable
  } else if (error instanceof CapBypassError) {
    // Other API error
    console.error(error.code, error.message);
  }
}

Full Example - AWS WAF

import { CapBypassClient, TaskType } from '@capbypass/sdk';

const client = new CapBypassClient({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'https://api.capbypass.pro',
});

const solution = await client.solve({
  type: TaskType.ANTI_AWS_WAF_PROXYLESS,
  websiteURL: 'https://example.com/protected',
  awsChallengeJS: 'https://xxx.token.awswaf.com/xxx/challenge.js',
});

// Use the cookie in your requests
const cookie = solution.cookie;

Next Steps