{
  "id": "Ajv5AZ9AUZPqT5Od",
  "name": "Solve Any CAPTCHA with CapSolver",
  "tags": [],
  "nodes": [
    {
      "id": "16bca665-5bf9-41b0-9d58-24921346903c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        -512
      ],
      "parameters": {
        "width": 480,
        "height": 896,
        "content": "## Solve Any CAPTCHA with CapSolver\n\n### How it works\n\n1. The workflow waits for a CAPTCHA request via a webhook trigger. 2. The request is validated and directed to the appropriate CAPTCHA solver node via a multi-way router. 3. Various types of CAPTCHA solvers are deployed based on the incoming CAPTCHA type. 4. The solver results are formatted into a standard response format. 5. The formatted solution is delivered back via a webhook response. 6. Unsupported CAPTCHA types are managed and reported using a different webhook response.\n\n### Setup steps\n\n- [ ] Set up the webhook trigger URL in 'Trigger on CAPTCHA Request'.\n- [ ] Configure the CAPTCHA type routing logic in 'Route to Solver'.\n- [ ] Ensure each solver node is correctly configured to handle its specific CAPTCHA type.\n- [ ] Define the response format in 'Format CAPTCHA Response'.\n- [ ] Confirm that the deliver nodes (deliver solution and manage unsupported) have correct response endpoints.\n\n### Customization\n\nYou can customize the CAPTCHA solving logic by adding new solver nodes or modifying the format of responses."
      },
      "typeVersion": 1
    },
    {
      "id": "7413db10-727c-43e6-bfce-a60a5c6f195b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 272,
        "content": "## Initial request handling\n\nManages incoming CAPTCHA requests and validation."
      },
      "typeVersion": 1
    },
    {
      "id": "944408ee-6fae-4dfe-9832-025983e6f466",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        -160
      ],
      "parameters": {
        "color": 7,
        "height": 576,
        "content": "## CAPTCHA routing\n\nRoutes the request to the appropriate CAPTCHA processing node based on type."
      },
      "typeVersion": 1
    },
    {
      "id": "97884818-29da-4c79-b0df-fd5d211700e0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -912
      ],
      "parameters": {
        "color": 7,
        "height": 992,
        "content": "## Primary CAPTCHA processing\n\nProcesses various types of CAPTCHAs using capSolver nodes."
      },
      "typeVersion": 1
    },
    {
      "id": "4178be3b-b135-4b43-8222-6e7bc25ee090",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        112
      ],
      "parameters": {
        "color": 7,
        "height": 832,
        "content": "## Extended CAPTCHA processing\n\nHandles additional CAPTCHA types and image-based CAPTCHA processing."
      },
      "typeVersion": 1
    },
    {
      "id": "830f5ba8-0e8e-44a9-893c-c19e9de5105b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 464,
        "height": 480,
        "content": "## Response formatting and delivery\n\nFormats the CAPTCHA response and delivers it to the requester."
      },
      "typeVersion": 1
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000001",
      "name": "Webhook CAPTCHA Trigger",
      "type": "n8n-nodes-base.webhook",
      "onError": "continueRegularOutput",
      "position": [
        -496,
        0
      ],
      "parameters": {
        "path": "capsolver-solve",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000003",
      "name": "Validate Request",
      "type": "n8n-nodes-base.code",
      "position": [
        -208,
        0
      ],
      "parameters": {
        "jsCode": "const input = $input.first().json;\nconst body = input.body;\n\nif (!body || typeof body !== 'object') {\n  return [{ json: { _outputIndex: 9, _error: 'Request body must be a JSON object' } }];\n}\nif (!body.type || typeof body.type !== 'string' || !body.type.trim()) {\n  return [{ json: { _outputIndex: 9, _error: 'Missing required field: type. Supported: recaptchav2, recaptchav3, turnstile, awswaf, geetestv3, geetestv4, mtcaptcha, imagetotext, visionengine' } }];\n}\n\nconst type = body.type.trim().toLowerCase();\n\nconst types = {\n  recaptchav2:  { idx: 0, required: ['websiteURL', 'websiteKey'], optional: ['taskType', 'proxy', 'pageAction', 'isInvisible', 'apiDomain', 'enterprisePayload', 'isSession'] },\n  recaptchav3:  { idx: 1, required: ['websiteURL', 'websiteKey'], optional: ['taskType', 'proxy', 'pageAction', 'enterprisePayload', 'apiDomain', 'isSession'] },\n  turnstile:    { idx: 2, required: ['websiteURL', 'websiteKey'], optional: ['proxy', 'action', 'cdata'] },\n  awswaf:       { idx: 3, required: ['websiteURL'], optional: ['taskType', 'proxy', 'awsKey', 'awsIv', 'awsContext', 'awsChallengeJS', 'awsApiJs', 'awsProblemUrl', 'awsApiKey', 'awsExistingToken'] },\n  geetestv3:    { idx: 4, required: ['websiteURL', 'gt', 'challenge'], optional: ['proxy', 'geetestApiServerSubdomain'] },\n  geetestv4:    { idx: 5, required: ['websiteURL', 'captchaId'], optional: ['proxy', 'geetestApiServerSubdomain'] },\n  mtcaptcha:    { idx: 6, required: ['websiteURL', 'websiteKey'], optional: ['taskType', 'proxy'] },\n  imagetotext:  { idx: 7, required: ['image'], optional: ['module', 'websiteURL'] },\n  visionengine: { idx: 8, required: ['module', 'image'], optional: ['imageBackground', 'question', 'websiteURL'] },\n};\n\nconst config = types[type];\nif (!config) {\n  return [{ json: { _outputIndex: 9, _error: 'Unsupported type: ' + body.type + '. Supported: ' + Object.keys(types).join(', ') } }];\n}\n\nconst missing = config.required.filter(f => !body[f] && body[f] !== false && body[f] !== 0);\nif (missing.length > 0) {\n  return [{ json: { _outputIndex: 9, _error: 'Type \"' + type + '\" requires: ' + missing.join(', ') + '. Optional: ' + (config.optional.join(', ') || 'none') } }];\n}\n\nif (type === 'visionengine') {\n  const validModules = ['slider_1', 'rotate_1', 'rotate_2', 'shein', 'ocr_gif'];\n  if (!validModules.includes(body.module)) {\n    return [{ json: { _outputIndex: 9, _error: 'Invalid module \"' + body.module + '\". Valid: ' + validModules.join(', ') } }];\n  }\n}\n\nconst allValid = ['type', ...config.required, ...config.optional];\nconst unknown = Object.keys(body).filter(k => !allValid.includes(k));\nif (unknown.length > 0) {\n  const typos = unknown.filter(k => {\n    const kl = k.toLowerCase().replace(/[-_ ]/g, '');\n    return allValid.some(v => v.toLowerCase().replace(/[-_ ]/g, '') === kl);\n  });\n  if (typos.length > 0) {\n    const suggestions = typos.map(t => {\n      const kl = t.toLowerCase().replace(/[-_ ]/g, '');\n      const match = allValid.find(v => v.toLowerCase().replace(/[-_ ]/g, '') === kl);\n      return '\"' + t + '\" -> \"' + match + '\"';\n    });\n    return [{ json: { _outputIndex: 9, _error: 'Wrong field name(s): ' + suggestions.join(', ') + '. Check camelCase spelling.' } }];\n  }\n}\n\nreturn [{ json: { ...input, body: { ...body, type }, _outputIndex: config.idx } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "route-solver-001",
      "name": "Select CAPTCHA Solver",
      "type": "n8n-nodes-base.switch",
      "position": [
        160,
        0
      ],
      "parameters": {
        "mode": "expression",
        "output": "={{ $json._outputIndex }}",
        "numberOutputs": 10
      },
      "typeVersion": 3.4
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000010",
      "name": "Solve reCAPTCHA v2",
      "type": "n8n-nodes-capsolver.capSolver",
      "onError": "continueRegularOutput",
      "position": [
        528,
        -720
      ],
      "parameters": {
        "type": "={{ $json.body.taskType || 'ReCaptchaV2TaskProxyLess' }}",
        "proxy": "={{ $json.body.proxy || '' }}",
        "optional": {
          "apiDomain": "={{ $json.body.apiDomain || '' }}",
          "isSession": "={{ $json.body.isSession || false }}",
          "pageAction": "={{ $json.body.pageAction || '' }}",
          "isInvisible": "={{ $json.body.isInvisible || false }}",
          "enterprisePayload": "={{ $json.body.enterprisePayload || '' }}"
        },
        "websiteKey": "={{ $json.body.websiteKey }}",
        "websiteURL": "={{ $json.body.websiteURL }}"
      },
      "credentials": {
        "capSolverApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000011",
      "name": "Solve reCAPTCHA v3",
      "type": "n8n-nodes-capsolver.capSolver",
      "onError": "continueRegularOutput",
      "position": [
        528,
        -560
      ],
      "parameters": {
        "type": "={{ $json.body.taskType || 'ReCaptchaV3TaskProxyLess' }}",
        "proxy": "={{ $json.body.proxy || '' }}",
        "optional": {
          "apiDomain": "={{ $json.body.apiDomain || '' }}",
          "isSession": "={{ $json.body.isSession || false }}",
          "pageAction": "={{ $json.body.pageAction || '' }}",
          "enterprisePayload": "={{ $json.body.enterprisePayload || '' }}"
        },
        "operation": "reCAPTCHA v3",
        "websiteKey": "={{ $json.body.websiteKey }}",
        "websiteURL": "={{ $json.body.websiteURL }}"
      },
      "credentials": {
        "capSolverApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000012",
      "name": "Solve Turnstile CAPTCHA",
      "type": "n8n-nodes-capsolver.capSolver",
      "onError": "continueRegularOutput",
      "position": [
        528,
        -400
      ],
      "parameters": {
        "optional": {
          "cdata": "={{ $json.body.cdata || '' }}",
          "action": "={{ $json.body.action || '' }}"
        },
        "operation": "Cloudflare Turnstile",
        "websiteKey": "={{ $json.body.websiteKey }}",
        "websiteURL": "={{ $json.body.websiteURL }}"
      },
      "credentials": {
        "capSolverApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000014",
      "name": "Solve AWS WAF CAPTCHA",
      "type": "n8n-nodes-capsolver.capSolver",
      "onError": "continueRegularOutput",
      "position": [
        528,
        -240
      ],
      "parameters": {
        "optional": {
          "awsIv": "={{ $json.body.awsIv || '' }}",
          "awsKey": "={{ $json.body.awsKey || '' }}",
          "awsContext": "={{ $json.body.awsContext || '' }}",
          "awsChallengeJS": "={{ $json.body.awsChallengeJS || '' }}"
        },
        "operation": "AWS WAF",
        "websiteURL": "={{ $json.body.websiteURL }}"
      },
      "credentials": {
        "capSolverApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000015",
      "name": "Solve GeeTest v3",
      "type": "n8n-nodes-capsolver.capSolver",
      "onError": "continueRegularOutput",
      "position": [
        528,
        -80
      ],
      "parameters": {
        "gt": "={{ $json.body.gt }}",
        "optional": {
          "geetestApiServerSubdomain": "={{ $json.body.geetestApiServerSubdomain || '' }}"
        },
        "challenge": "={{ $json.body.challenge }}",
        "operation": "GeeTest V3",
        "websiteURL": "={{ $json.body.websiteURL }}"
      },
      "credentials": {
        "capSolverApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000016",
      "name": "Solve GeeTest v4",
      "type": "n8n-nodes-capsolver.capSolver",
      "onError": "continueRegularOutput",
      "position": [
        544,
        336
      ],
      "parameters": {
        "optional": {
          "geetestApiServerSubdomain": "={{ $json.body.geetestApiServerSubdomain || '' }}"
        },
        "captchaId": "={{ $json.body.captchaId }}",
        "operation": "GeeTest V4",
        "websiteURL": "={{ $json.body.websiteURL }}"
      },
      "credentials": {
        "capSolverApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000018",
      "name": "Solve MTCaptcha",
      "type": "n8n-nodes-capsolver.capSolver",
      "onError": "continueRegularOutput",
      "position": [
        528,
        464
      ],
      "parameters": {
        "optional": {},
        "operation": "MTCaptcha",
        "websiteKey": "={{ $json.body.websiteKey }}",
        "websiteURL": "={{ $json.body.websiteURL }}"
      },
      "credentials": {
        "capSolverApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000019",
      "name": "Image Text Extraction",
      "type": "n8n-nodes-capsolver.capSolver",
      "onError": "continueRegularOutput",
      "position": [
        528,
        624
      ],
      "parameters": {
        "optional": {},
        "resource": "recognition"
      },
      "credentials": {
        "capSolverApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000020",
      "name": "Vision Engine Execution",
      "type": "n8n-nodes-capsolver.capSolver",
      "onError": "continueRegularOutput",
      "position": [
        528,
        784
      ],
      "parameters": {
        "image": "={{ $json.body.image }}",
        "module": "={{ $json.body.module }}",
        "optional": {},
        "question": "={{ $json.body.question || '' }}",
        "resource": "Recognition",
        "operation": "Vision Engine",
        "websiteURL": "={{ $json.body.websiteURL || '' }}",
        "imageBackground": "={{ $json.body.imageBackground || '' }}"
      },
      "credentials": {
        "capSolverApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000030",
      "name": "Format Solution",
      "type": "n8n-nodes-base.code",
      "position": [
        864,
        16
      ],
      "parameters": {
        "jsCode": "const input = $input.first().json;\nif (input.error || !input.data) {\n  const errorMsg = input.error\n    ? (typeof input.error === 'string' ? input.error : (input.error.message || JSON.stringify(input.error)))\n    : 'No solution returned';\n  return [{ json: { success: false, error: errorMsg } }];\n}\nreturn [{ json: {\n  success: true,\n  type: $('Webhook CAPTCHA Trigger').item.json.body.type,\n  solution: input.data.solution || input.data,\n  solvedAt: new Date().toISOString()\n}}];"
      },
      "typeVersion": 2
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000040",
      "name": "Handle Unsupported CAPTCHA",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1120,
        128
      ],
      "parameters": {
        "options": {
          "responseCode": 400
        },
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ error: $json._error || 'Unknown error', supportedTypes: ['recaptchav2','recaptchav3','turnstile','awswaf','geetestv3','geetestv4','mtcaptcha','imagetotext','visionengine'] }) }}"
      },
      "typeVersion": 1.5
    },
    {
      "id": "f0a1b2c3-d4e5-4f67-8901-abcdef000050",
      "name": "Provide CAPTCHA Solution",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1120,
        -48
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($json) }}"
      },
      "typeVersion": 1.5
    }
  ],
  "active": true,
  "settings": {
    "binaryMode": "separate",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "cfc5cc25-bbae-41fb-bc08-6731724929c3",
  "connections": {
    "Format Solution": {
      "main": [
        [
          {
            "node": "Provide CAPTCHA Solution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Solve MTCaptcha": {
      "main": [
        [
          {
            "node": "Format Solution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Solve GeeTest v3": {
      "main": [
        [
          {
            "node": "Format Solution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Solve GeeTest v4": {
      "main": [
        [
          {
            "node": "Format Solution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Request": {
      "main": [
        [
          {
            "node": "Select CAPTCHA Solver",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Solve reCAPTCHA v2": {
      "main": [
        [
          {
            "node": "Format Solution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Solve reCAPTCHA v3": {
      "main": [
        [
          {
            "node": "Format Solution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Text Extraction": {
      "main": [
        [
          {
            "node": "Format Solution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select CAPTCHA Solver": {
      "main": [
        [
          {
            "node": "Solve reCAPTCHA v2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Solve reCAPTCHA v3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Solve Turnstile CAPTCHA",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Solve AWS WAF CAPTCHA",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Solve GeeTest v3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Solve GeeTest v4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Solve MTCaptcha",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Image Text Extraction",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Vision Engine Execution",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Unsupported CAPTCHA",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Solve AWS WAF CAPTCHA": {
      "main": [
        [
          {
            "node": "Format Solution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Solve Turnstile CAPTCHA": {
      "main": [
        [
          {
            "node": "Format Solution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vision Engine Execution": {
      "main": [
        [
          {
            "node": "Format Solution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook CAPTCHA Trigger": {
      "main": [
        [
          {
            "node": "Validate Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}