@2captcha/captcha-solver

中文文档
1.4.0发布于 2026/10/20MITTypeScriptCommonJS近 30 天下载 13.1万

JavaScript library for easy integration with the API of 2captcha captcha solving service to bypass reCAPTCHA, funcaptcha, geetest and solve any other captchas.

原始使用文档
文档目录57 节
  1. Installation
  2. Configuration
  3. TwoCaptcha instance options
  4. Solve captcha
  5. Captcha options
  6. Image captcha
  7. reCAPTCHA V2
  8. reCAPTCHA V3
  9. FunCaptcha
  10. GeeTest Captcha
  11. GeeTest V4 Captcha
  12. Yandex Smart Captcha
  13. Lemin Cropped Captcha
  14. Cloudflare Turnstile
  15. Amazon WAF
  16. Capy
  17. DataDome CAPTCHA
  18. CyberSiARA
  19. MTCaptcha
  20. Friendly Captcha
  21. ClickCaptcha
  22. Bounding Box Method
  23. Grid
  24. Text Captcha
  25. Canvas
  26. Rotate
  27. KeyCaptcha
  28. Cutcaptcha
  29. Tencent
  30. atbCAPTCHA
  31. Prosopo
  32. CaptchaFox
  33. VkImage
  34. VkCaptcha
  35. Temu
  36. Altcha
  37. Binance
  38. Audio Captcha
  39. Yidun NECaptcha
  40. Alibaba Captcha
  41. TSPD
  42. Basilisk
  43. Hunt
  44. Drag and Drop
  45. Imperva (Incapsula)
  46. Other methods
  47. goodReport
  48. badReport
  49. balance
  50. Proxies
  51. Examples
  52. Examples using Puppeteer
  53. Useful articles
  54. Get in touch
  55. Join the team 👪
  56. License
  57. Graphics and Trademarks

JavaScript module for 2Captcha API (captcha solver)

The easiest way to quickly integrate the 2Captcha captcha-solving service into your code and automate the solving of any type of captcha. Examples of API requests for different captcha types are available on the JavaScript captcha solver page.

Installation

This package can be installed with NPM:

npm install @2captcha/captcha-solver

or Yarn:

yarn add @2captcha/captcha-solver

Configuration

TwoCaptcha instance can be created like this:

const TwoCaptcha = require("@2captcha/captcha-solver")
const solver = new TwoCaptcha.Solver("<Your 2captcha api key>")

Also, there are a few options that can be configured:

const apiKey = 'YOUR_API_KEY'
const pollingInterval = 10

const solver = new TwoCaptcha.Solver(apiKey, pollingInterval)

TwoCaptcha instance options

OptionDefault valueDescription
apiKey-Your API key
pollingInterval5000Interval in milliseconds between requests to the res.php API endpoint. Setting values less than 5 seconds is not recommended

Solve captcha

When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.

Captcha options

OptionDefault ValueDescription
numeric0Defines if the captcha contains numeric or other symbols see more info in the API docs
min_len0minimal answer length
max_len0maximum answer length
phrase0defines if the answer contains multiple words or not
regsense0defines if the answer is case sensitive
calc0defines captcha requires calculation
lang-defines the captcha language; see the list of supported languages
textinstructions-hint or task text shown to workers with the captcha

Below you can find basic examples for every captcha type, check out the code below.

Image captcha

API method description.

To bypass a normal captcha (distorted text on an image) use the following method. This method can also be used to recognize any text in an image.

const imageBase64 = fs.readFileSync("./examples/media/imageCaptcha_6e584.png", "base64")

solver.imageCaptcha({
    body: imageBase64,
    numeric: 4,
    min_len: 5,
    max_len: 5
})
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.log(err);
})

reCAPTCHA V2

API method description.

Use the following method to solve reCAPTCHA V2 and obtain a token to bypass the protection.

solver.recaptcha({
  pageurl: 'https://2captcha.com/demo/recaptcha-v2',
  googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u'
})
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.log(err);
})

reCAPTCHA V3

API method description.

This method provides a reCAPTCHA V3 solver and returns a token.

solver.recaptcha({
    pageurl: 'https://2captcha.com/demo/recaptcha-v3',
    googlekey: '6Lcyqq8oAAAAAJE7eVJ3aZp_hnJcI6LgGdYD8lge',
    version: "v3",
    min_score: "0.4",
    action: 'demo_action'
})
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.log(err);
})

FunCaptcha

API method description.

FunCaptcha (Arkoselabs) solving method. Returns a token.

solver.funCaptcha({
  pageurl: "https://funcaptcha.com/tile-game-lite-mode/fc/api/nojs/?pkey=804380F4-6844-FFA1-ED4E-5877CA1F1EA4&lang=en",
  publickey: "804380F4-6844-FFA1-ED4E-5877CA1F1EA4"
})
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.log(err);
})

GeeTest Captcha

API method description.

Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.

// Read more about `challenge` on the page https://2captcha.com/p/geetest
solver.geetest({ 
  pageurl: 'https://2captcha.com/demo/geetest',
  gt: '81388ea1fc187e0c335c0a8907ff2625',
  challenge: '<you need to get a new challenge value each time>'
})
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.log(err);
})

GeeTest V4 Captcha

API method description.

Use this method to solve GeeTest v4. Returns the response in JSON.

solver.geetestV4({
  pageurl: 'https://2captcha.com/demo/geetest-v4',
  captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73'
})
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.log(err);
})

Yandex Smart Captcha

Use this method to solve Yandex Smart Captcha and obtain a token to bypass the protection.

solver.yandexSmart({ 
  pageurl: "https://captcha-api.yandex.ru/demo",
  sitekey: "FEXfAbHQsToo97VidNVk3j4dC74nGW1DgdxjtNB9"
 })
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.log(err);
})

Lemin Cropped Captcha

API method description.

Use this method to solve Lemin and obtain a token to bypass the protection.

solver.lemin({
  pageurl:'https://2captcha.com/demo/lemin', 
  captcha_id: 'CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b',
  div_id: 'lemin-cropped-captcha',
  api_server: 'api.leminnow.com'
})
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.log(err);
})

Cloudflare Turnstile

API method description.

Use this method to solve Cloudflare Turnstile. Returns JSON with the token.

Turnstile captcha has two types, one of them is Cloudflare Turnstile Challenge page. For Turnstile Challenge page cases, we have a demo. Try this demo if you need to solve Cloudflare Turnstile Challenge page captcha.

solver.cloudflareTurnstile({
    pageurl: "https://app.nodecraft.com/login",
    sitekey: "0x4AAAAAAAAkg0s3VIOD10y4"    
})
.then((res) => {
    console.log(res);
})
.catch((err) => {
    console.log(err);
})

Amazon WAF

API method description.

Use this method to solve Amazon WAF Captcha also known as AWS WAF Captcha is a part of Intelligent threat mitigation for Amazon AWS. Returns JSON with the token.

//INFO: The `context` value is dynamic, it is necessary to take the actual value from the page each time.
solver.amazonWaf({
  pageurl: "https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest",
  sitekey: "AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AHMDLodoefdvyOnsHMRt...",
  context: "9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ...",
  iv: "CgAHbCe2GgAAAAAj",
})
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.log(err);
})

Capy

API method description.

Token-based method to bypass Capy puzzle captcha.

solver.capyPuzzle({
    pageurl: "https://www.capy.me/account/register/",
    captchakey: "PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w"
})
.then((res) => {
    console.log(res);
})
.catch((err) => {
    console.log(err);
})

DataDome CAPTCHA

API method description.

Use this method to solve DataDome and obtain a token to bypass the protection.

[!IMPORTANT]
To solve the DataDome captcha, you must use a proxy. It is recommended to use residential proxies.

solver.dataDome({
    pageurl: "https://rendezvousparis.hermes.com/client/register",
    captcha_url: "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMAEuQtkf4k1c0ABZhYZA%3D%3D&hash=789361B674144528D0B7EE76B35826&cid=mY4z7GNmh7Nt1lAFwpbNHAOcWPhyPgjHD2K1Pm~Od1iEKYLUnK3t7N2ZGUj8OqDK65cnwJHtHwd~t902vlwpSBA5l4ZHbS1Qszv~jEuEUJNQ_jMAjar2Kj3kq20MRJYh&t=fe&referer=https%3A%2F%2Frendezvousparis.hermes.com%2Fclient%2Fregister&s=40119&e=67fef144ac1a54dbd7507776367d2f9d5e36ec3add17fa22f3cb881db8385838",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
    proxy: "login:[email protected]:8888", // The (Username : Password @ Address : Port) of our chosen proxy
    proxytype: "http" // The 'Type' of proxy, http, https, socks, ect.
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

CyberSiARA

API method description.

Use this method to solve CyberSiARA and obtain a token to bypass the protection.

solver.cyberSiARA({
    pageurl: "https://www.cybersiara.com/book-a-demo",
    master_url_id: "OXR2LVNvCuXykkZbB8KZIfh162sNT8S2",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

MTCaptcha

API method description.

Use this method to solve MTCaptcha and obtain a token to bypass the protection.

solver.mtCaptcha({
    pageurl: "https://service.mtcaptcha.com/mtcv1/demo/index.html",
    sitekey: "MTPublic-DemoKey9M"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Friendly Captcha

API method description.

Use this method to solve Friendly Captcha and obtain a token to bypass the protection.

[!IMPORTANT]
To successfully use the received token, the captcha widget must not be loaded on the page. To do this, you need to abort request to /friendlycaptcha/...module.min.js on the page. When the captcha widget is already loaded on the page, there is a high probability that the received token will not work.

solver.friendlyCaptcha({
    pageurl: "https://geizhals.de/?liftban=1&from=/455973138?fsean=5901747021356",
    sitekey: "FCMST5VUMCBOCGQ9"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

ClickCaptcha

API method description.

The ClickCaptcha method returns the coordinates of points on the captcha image. It can be used if you need to click on particular points in the image.

const imageBase64 = fs.readFileSync("./tests/media/coordinates.jpg", "base64")

solver.coordinates({
    body: imageBase64,
    textinstructions: 'Select all photos containing the boat'
 })
.then((res) => {
    console.log(res);
})
.catch((err) => {
    console.log(err);
})

Bounding Box Method

API method description.

Use Bounding Box Method when you need to select objects on the image. To do this, you need to pass the markup instructions and image for markup. The instructions can be sent as text or as an image encoded in base64 format.

[!IMPORTANT]
You must to send instruction imginstructions or textinstructions.

solver.boundingBox({ 
  image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAR4AAACwCAIAAAB...",
  textinstructions: "Circle all the cars in the image.",
})
.then((res) => {
    console.log(res);
})
.catch((err) => {
    console.log(err);
})

Grid

API method description.

This method allows to solve any captcha where image can be divided into equal parts like reCAPTCHA V2. A grid is applied above the image. And you receive the numbers clicked boxes.

[!IMPORTANT]
You must to send instruction imginstructions or textinstructions.

solver.grid({ 
  body: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAR4AAACwCAIAAAB...",
  textinstructions: "Select cars in the image"
})
.then((res) => {
    console.log(res);
})
.catch((err) => {
    console.log(err);
})

Text Captcha

API method description.

This method can be used to bypass a captcha that requires answering a question provided in clear text.

solver.textCaptcha({
  textcaptcha: "If tomorrow is Saturday, what day is today?",
  lang: 'en'
})
.then((res) => {
    console.log(res);
})
.catch((err) => {
    console.log(err);
})

Canvas

API method description.

The canvas method can be used when you need to draw a line around an object on an image. Returns a set of points' coordinates to draw a polygon.

solver.canvas({
    body: 'iVBORw0KGgoAAAANSgAAAcIA...',
    imginstructions: '/9j/4AAQSkZJRgABAQEA...',
    textinstructions: 'Highlight the red CIRCLE'
})
.then((res) => {
    console.log(res);
})
.catch((err) => {
    console.log(err);
})

Rotate

API method description.

This method can be used to solve a captcha that asks to rotate an object. It is mostly used to bypass FunCaptcha. Returns the rotation angle.

solver.rotate({
  body: imageBase64,
  textinstructions: "Rotate the object to the correct position"
})
.then((res) => {
    console.log(res);
})
.catch((err) => {
    console.log(err);
})

KeyCaptcha

API method description.

Token-based method to solve KeyCaptcha.

solver.keyCaptcha({
    pageurl: "https://2captcha.com/demo/keycaptcha",
    userId: '184015',
    sessionId: '0917788cad24ad3a69813c4fcd556061',
    webServerSign: '02f7f9669f1269595c4c69bcd4a3c52e',
    webServerSign2: 'd888700f6f324ec0f32b44c32c50bde1'
})
.then((res) => {
    console.log(res);
})
.catch((err) => {
    console.log(err);
})

Cutcaptcha

API method description.

Use this method to solve Cutcaptcha. Returns the response in JSON.

solver.cutCaptcha({
    pageurl: "https://mysite.com/page/with/cutcaptcha",
    misery_key: "098e6a849af406142e3150dbf4e6d0538db2b51f", 
    api_key: "SAs61IAI",
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Tencent

API method description.

Use this method to solve Tencent captcha. Returns the response in JSON.

solver.tencent({
    pageurl: "https://mysite.com/page/with/tencent",
    appId: "189956587"  
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

atbCAPTCHA

API method description.

Use this method to solve atbCAPTCHA challenge. Returns a token to bypass the captcha.

solver.atbCaptcha({
    pageurl: "https://mysite.com/page/with/atbCAPTCHA",
    appId: "af25e409b33d722a95e56a230ff8771c",
    apiServer: "https://cap.aisecurius.com"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Prosopo

API method description.

Use this method to solve Prosopo and obtain a token to bypass the protection.

solver.prosopo({
    pageurl: "https://mysite.com/page/with/prosopo",
    sitekey: "5DWvYfCSGqbUiQ..."
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

CaptchaFox

API method description.

Use this method to solve CaptchaFox and obtain a token to bypass the protection.

[!IMPORTANT]
To solve the CaptchaFox, you must use a proxy. It is recommended to use residential proxies.

solver.captchaFox({
    pageurl: "https://mysite.com/page/with/captchafox",
    sitekey: "sk_ILKWN...",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit...",
    proxy: "login:[email protected]:8888", // The (Username : Password @ Address : Port) of our chosen proxy
    proxytype: "http" // The 'Type' of proxy, http, https, socks, ect.
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

VkImage

API method description.

This method can be used to solve VK captcha using graphical captcha. Returns the number of steps and solution value in the target site's API format.

solver.vkimage({
    body: "iVBORw0KGgoAAAANSUhEUgAAAcIA...",
    steps: "[5,19,4,3,23,8,20,4,18,10,6,10,5,12,13,18,9,14,9,15,12,19,3,12,...]",
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

VkCaptcha

API method description.

Use this method to solve VkCaptcha and obtain a token to bypass the protection.

[!IMPORTANT]
To solve the VkCaptcha, you must use a proxy. It is recommended to use residential proxies.

solver.vkcaptcha({
    redirect_uri: "https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJhbGciOiJBM...",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit...",
    proxy: "login:[email protected]:8888", // The (Username : Password @ Address : Port) of our chosen proxy
    proxytype: "http" // The 'Type' of proxy, http, https, socks, ect.
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Temu

API method description.

This method can be used to solve Temu captcha. Returns a coordinates.

solver.temu({
    body: "data:image/png;base64,iVBORw0KG...",
    part1: "data:image/png;base64,iVBORw0KG...",
    part2: "data:image/png;base64,iVBORw0KG...",
    part3: "data:image/png;base64,iVBORw0KG...",
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Altcha

API method description.

This method can be used to solve Altcha captcha. Returns a token.

solver.altcha({
    pageurl: "https://mysite.com/page/with/altcha",
    challenge_url: "https://example/altcha",
    challenge_json: '{"algorithm":"SHA-256","challenge":"a4c9d8e7f1b23a6c...",..."signature":"7b3e2a9d5c8f1046e2d91c3a..."}'
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Binance

API method description.

This method can be used to solve Binance captcha. Returns a token.

solver.binance({
    pageurl: "https://mysite.com/page/with/binance",
    sitekey: "register",
    validateId: "0a05453c44e2411195c0d0c15654d966",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36",
    proxy: "login:[email protected]:8888",
    proxytype: "HTTP"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Audio Captcha

API method description.

Use the following method to bypass an audio captcha (mp3 formats only). You must provide the language as lang = 'en'. Supported languages are "en", "ru", "de", "el", "pt", "fr".

solver.audio({
  body: "SUQzBAAAAAAAHFRTU0UAAAA...",
  lang: "en"
})
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.log(err);
})

Yidun NECaptcha

API method description.

This method can be used to solve Yidun NECaptcha. Returns a token.

solver.yidun({
    pageurl: "https://mysite.com/page/with/yidun",
    sitekey: "your_site_key",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
    yidunGetLib: "https://cstaticdun.126.net/load.min.js",
    yidunApiServerSubdomain: "cstaticdun.126.net",
    challenge: "12345678abc90123d4567ef8a9012345",
    hcg: "your_hcg_value",
    hct: 1234567890,
    proxy: "login:[email protected]:8888",
    proxytype: "HTTP"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Alibaba Captcha

API method description.

This method can be used to solve Alibaba captcha (Aliyun). Returns a token.

Required parameters: pageurl, sceneId, prefix.

solver.alibaba({
    pageurl: "https://www.example.com",
    sceneId: "abc123xyz4",
    prefix: "dlw3kug",
    user_id: "Abc123Def456Ghi789Jkl012Mno345Pqr678Stu901=",
    user_user_id: "Xyz987Abc654Def321Ghi098Jkl765Mno432Pqr109=",
    verifyType: "1.0",
    region: "sgp",
    userCertifyId: "abc123def456ghi789jkl012mno345pq",
    apiGetLib: "https://o.example.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js?t=2041",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

TSPD

API method description.

Cookie-based method for automatic solving of TSPD captcha. Returns cookies that can be used to access the target page.

Required parameters: pageurl, tspdCookie, htmlPageBase64, proxy, proxytype.

Important: tspdCookie and htmlPageBase64 are dynamic — extract them immediately before creating the task. A proxy with a static session and the same IP must be used at all stages.

solver.tspd({
    pageurl: "https://example.com/login",
    tspdCookie: "TS386a400d029=082670...010245; TS386a400d078=082670...dbb3b0c",
    htmlPageBase64: "PCFET0NUWVBFIGh0bWw+...",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
    proxy: "login:[email protected]:8080",
    proxytype: "HTTP"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Basilisk

API method description.

This method can be used to solve Basilisk captcha. Returns a token.

Required parameters: pageurl, sitekey.

solver.basilisk({
    pageurl: "https://example.com/login",
    sitekey: "b7890h...19fb2600897",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
    proxy: "login:[email protected]:8080",
    proxytype: "HTTP"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Hunt

API method description.

This method can be used to solve Hunt captcha.

Hunt captcha uses a two-step workflow:

  1. Create a task without data to get the X-HD value.
  2. Send a request to the target site with the received X-HD header, get meta.token, then create a second task with data to get the final solution token.

Required parameters: pageurl, apiGetLib.

// Step 1: get X-HD
solver.hunt({
    pageurl: "https://example.com/page-with-hunt",
    apiGetLib: "https://example.com/hd-api/external/apps/app-id/api.js",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"
})
.then((res) => {
console.log(res.data); // X-HD
})
.catch((err) => {
console.log(err);
})

// Step 2: solve captcha with meta.token
solver.hunt({
    pageurl: "https://example.com/page-with-hunt",
    apiGetLib: "https://example.com/hd-api/external/apps/app-id/api.js",
    data: "META_TOKEN_VALUE",
    proxy: "login:[email protected]:8080",
    proxytype: "HTTP"
})
.then((res) => {
console.log(res.data); // solution token
})
.catch((err) => {
console.log(err);
})

Drag and Drop

API method description.

A method for solving captcha where one or more images need to be dragged onto specific positions on a background image.

Required parameters: body, images.

The result (data) is a pipe-separated string of coordinates, for example "120,340|null|210,90". The order matches the order of the images array you sent. null means the corresponding image wasn't moved — it does not mean an error or coordinates (0,0).

solver.dragAndDrop({
    body: "BASE64_BACKGROUND_IMAGE",
    images: ["BASE64_IMAGE_1", "BASE64_IMAGE_2"],
    textinstructions: "Drag the images to proper position"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Imperva (Incapsula)

API method description.

Cookie-based method for automatic solving of Imperva (Incapsula) captcha. Returns cookies that can be used to access the target page.

Required parameters: pageurl, incapsulaScriptUrl, incapsulaCookies, proxy, proxytype.

Important: a proxy is required for this captcha type. Some parameters are generated dynamically and may differ with each load of a page protected by Imperva (Incapsula).

The result (data) is an object. The cookies from data.domains must be passed to the target site. If data.headers["User-Agent"] is present, use the same User-Agent in requests to the site.

solver.imperva({
    pageurl: "https://example.com/login",
    incapsulaScriptUrl: "/_Incapsula_Resource?SWUDNSAI=31&xinfo=1",
    incapsulaCookies: "visid_incap_123456=sample; incap_ses_123_123456=sample",
    reese84UrlEndpoint: "https://example.com/_Incapsula_Resource?reese84=1",
    userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
    proxy: "login:[email protected]:8080",
    proxytype: "HTTP"
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})

Other methods

goodReport

API method description.

Use this method to report good captcha answer.

solver.goodReport('7031846604')

badReport

API method description.

Use this method to report bad captcha answer.

solver.badReport('7031854546')

balance

API method description.

Use this method to get your account's balance.

solver.balance()
.then((res) => {
    console.log(res)
})

Proxies

You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, keycaptcha, capy puzzle, lemin, turnstile, amazon waf, DataDome, CyberSiARA, MTCaptcha, Friendly Captcha and etc. The proxy will be forwarded to the API to solve the captcha.

We have our own proxies that we can offer you. Buy residential proxies for avoid restrictions and blocks. Quick start.

Solving reCAPTCHA V2 using proxy:

solver.recaptcha({
    pageurl: 'https://2captcha.com/demo/recaptcha-v2',
    googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u',
    proxy: 'HTTPS',
    proxytype: 'login:[email protected]:3128'
})

Examples

Examples of solving all supported captcha types are located in the examples directory.

Examples using Puppeteer

Also we have a separate repositories you can find examples of solving captcha using Puppeteer. At the moment we have implemented examples of bypassing Cloudflare Challenge page and reCAPTCHA. Links:

Useful articles

Get in touch

Join the team 👪

There are many ways to contribute, of which development is only one! Find your next job. Open positions: AI experts, scrapers, developers, technical support, and much more! 😍

License

The code in this repository is licensed under the MIT License. See the LICENSE file for more details.

Graphics and Trademarks

The graphics and trademarks included in this repository are not covered by the MIT License. Please contact support for permissions regarding the use of these materials.

版本与发布记录

@2captcha/captcha-solver 共发布 19 个版本,首次发布于 2024/03/29;过去 12 个月发布了 10 个版本。

版本发布日期距今
1.4.0latest2026/10/2018 天前
1.3.92026/08/282 个月前
1.3.82026/06/254 个月前
1.3.72026/06/224 个月前
1.3.62026/06/015 个月前
1.3.52026/04/037 个月前

关于 @2captcha/captcha-solver 的常见问题

@2captcha/captcha-solver 是什么?

JavaScript library for easy integration with the API of 2captcha captcha solving service to bypass reCAPTCHA, funcaptcha, geetest and solve any other captchas.

如何安装 @2captcha/captcha-solver?

在项目目录运行 npm install @2captcha/captcha-solver,或使用 pnpm add / yarn add / bun add。

@2captcha/captcha-solver 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@2captcha/captcha-solver 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@2captcha/captcha-solver 可以商用吗?

@2captcha/captcha-solver 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@2captcha/captcha-solver 的下载量有多少?

根据 npm 官方下载统计,@2captcha/captcha-solver 在 2026/10/05 – 2026/11/03 这 30 天内被下载 131,311 次,日均约 4,377 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@2captcha/captcha-solver 还在维护吗?

最新版本 1.4.0 发布于 2026/10/20(18 天前);至今共发布 19 个版本,其中过去 12 个月发布了 10 个;首次发布于 2024/03/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。