CAPSOLVER
Blog
How to Solve Cloudflare Turnstile Using CapSolver and n8n: Build Your Own Captcha-Solving API & Scrape Websites

How to Solve Cloudflare Turnstile Using CapSolver and n8n

Logo of CapSolver

Ethan Collins

Pattern Recognition Specialist

10-Mar-2026

Cloudflare Turnstile is quickly becoming the go-to CAPTCHA alternative for modern websites. Unlike traditional CAPTCHAs that force users to solve image puzzles, Turnstile runs silently in the background โ€” making it harder to detect and bypass with standard automation tools.

But what if you could build your own Turnstile-solving API โ€” one that receives a challenge and returns a valid token, all without writing a single line of traditional code?

In this guide, you'll learn how to combine n8n (a visual workflow automation tool) with CapSolver (an AI-powered captcha solving service) to create a powerful API endpoint that solves Cloudflare Turnstile challenges on demand.

What you'll build:

  • A Cloudflare Turnstile solver API
  • A scraping example that solves the Turnstile, submits the token to a website, and extracts the protected data

What is Cloudflare Turnstile?

Cloudflare Turnstile is a smart CAPTCHA alternative designed to verify users without the friction of traditional challenges. Instead of asking users to click checkboxes or identify objects in images, Turnstile validates visitors automatically using browser signals and behavioral analysis.

Feature Cloudflare Turnstile
User interaction None โ€” runs automatically in the background
How it works Uses browser challenges and behavioral signals to verify visitors
Visibility Shows a small widget, but no puzzles to solve
Widget modes Managed, Non-Interactive, Invisible
Common use case Login forms, sign-ups, checkout pages, any page behind Cloudflare
Site key visible? Yes

Widget Modes

Turnstile offers three widget modes that websites can choose:

Mode Description
Managed Cloudflare decides whether to show an interactive challenge or validate silently
Non-Interactive Never shows a challenge โ€” always validates in the background
Invisible Completely hidden โ€” no widget is rendered on the page

From a solving perspective, the mode doesn't change how you configure CapSolver โ€” you always need the same parameters: websiteURL and websiteKey.

Turnstile vs Cloudflare Challenge (Not the Same)

Don't confuse Turnstile with Cloudflare's full-page security challenge โ€” the one that shows "Performing security verification" with a loading spinner before letting you access the site. That is a Cloudflare Challenge (also known as a JS challenge or managed challenge), not Turnstile.

Cloudflare Turnstile Cloudflare Challenge
Where it appears Embedded inside a page (e.g., in a login form) Full-page interstitial before you can access the site
What it looks like A small widget on the page "Performing security verification..." with a loading bar
How it's implemented The website owner adds it to their form Cloudflare automatically adds it based on security rules
Solving approach Use the CapSolver Turnstile operation (this guide) Different โ€” requires a Cloudflare Challenge solver

If you see the full-page "Performing security verification" screen, that's not Turnstile โ€” it's a Cloudflare Challenge and requires a different approach. Check more key differences


Prerequisites

Before getting started, make sure you have the following:

  1. An n8n instance โ€” Either self-hosted or n8n Cloud
  2. A CapSolver account โ€” Sign up here and get your API key
  3. The CapSolver n8n node โ€” Already available as an official node in n8n (no installation needed)

Important: Make sure you have sufficient balance in your CapSolver account. Turnstile solving tasks consume credits based on usage.


Setting Up CapSolver in n8n

CapSolver is available as an official integration in n8n โ€” no community node installation required. You can find it directly in the node panel when building your workflows.

Since it's an official integration, you need to create a credential in n8n so that the CapSolver node can authenticate with your account.

Step 1: Open the Credentials Page

Go to your n8n instance and navigate to Settings โ†’ Credentials. You'll see all your configured credentials here.

n8n credentials page showing CapSolver account

Step 2: Create the CapSolver Credential

  1. Click Create credential (top right)
  2. Search for "CapSolver" and select CapSolver API
  3. Enter your API Key โ€” copy it directly from the CapSolver Dashboard
  4. Leave Allowed HTTP Request Domains set to All (default)
  5. Click Save

n8n will automatically test the connection. You should see a green "Connection tested successfully" banner confirming your API key is valid.

CapSolver credential configuration with successful connection test

Important: Every CapSolver node in your workflows will reference this credential. You only need to create it once โ€” all your solver workflows will share the same credential.

Now you're ready to build your Turnstile solver workflow!


How to Identify Turnstile Parameters

Before you can solve a Turnstile challenge, you need to know its parameters โ€” specifically the websiteURL and websiteKey (also called the site key).

Turnstile only requires two parameters, so finding them is straightforward:

Website URL

This is simply the full URL of the page that has the Turnstile widget. Copy it from your browser's address bar.

Website Key (Site Key)

The site key is embedded in the page's HTML. Here are several ways to find it:

1. Search the page source for data-sitekey

Right-click on the page โ†’ View Page Source (or press Ctrl+U) and search for data-sitekey:

html Copy
<div class="cf-turnstile" data-sitekey="0x4AAAAAAADV8V8V8V8V8V8V"></div>

2. Search for turnstile.render() in JavaScript

Some sites render Turnstile via JavaScript instead of HTML attributes. Search the page source for turnstile.render:

javascript Copy
turnstile.render('#widget', {
  sitekey: '0x4AAAAAAADV8V8V8V8V8V8V',
});

3. Check the Network tab in DevTools

Open DevTools (F12) โ†’ Network tab โ†’ filter by turnstile or challenges.cloudflare.com. The site key often appears in the request URLs or response data.

4. Search for challenges.cloudflare.com in the HTML

Turnstile loads its script from Cloudflare. Search the page source for this domain โ€” the site key is usually nearby:

html Copy
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>

Tips:

  • The site key always starts with 0x and is a long alphanumeric string
  • If the site uses Cloudflare's managed challenge (full-page challenge before accessing the site), the Turnstile widget may not be in the page source โ€” it's served by Cloudflare's challenge page instead

Workflow: Cloudflare Turnstile Solver API

This workflow creates a POST API endpoint that accepts Turnstile parameters and returns a solved token.

Cloudflare Turnstile

How It Works

The workflow consists of three nodes:

  1. Webhook โ€” Receives incoming POST requests with Turnstile parameters
  2. Cloudflare Turnstile โ€” Sends the challenge to CapSolver and waits for a solution
  3. Respond to Webhook โ€” Returns the solution as a JSON response

Node Configuration

1. Webhook Node

Setting Value
HTTP Method POST
Path solver-turnstile
Response Mode Response Node

This creates an endpoint at: https://your-n8n-instance.com/webhook/solver-turnstile

2. CapSolver Cloudflare Turnstile Node

Parameter Value Description
Operation Cloudflare Turnstile Must be set to Cloudflare Turnstile
Type AntiTurnstileTaskProxyLess This task type does not require a proxy
Website URL {{ $json.body.websiteURL }} The URL of the page with the Turnstile widget
Website Key {{ $json.body.websiteKey }} The Turnstile site key
metadata.action (Optional) Some sites require a specific action string for the Turnstile challenge
metadata.cdata (Optional) Custom data that some sites pass to the Turnstile widget for verification

Some sites also require metadata.action and/or metadata.cdata โ€” you can add these under the Optional section in the node. Also select your CapSolver credentials in this node.

3. Respond to Webhook Node

Setting Value
Respond With JSON
Response Body {{ JSON.stringify($json.data) }}

This returns the full CapSolver response, including the solved Turnstile token.

Test It

Send a POST request to your webhook endpoint:

bash Copy
curl -X POST https://your-n8n-instance.com/webhook/solver-turnstile \
  -H "Content-Type: application/json" \
  -d '{
    "websiteURL": "https://example.com/login",
    "websiteKey": "0x4AAAAAAADV8V8V8V8V8V8V"
  }'

Expected Response:

json Copy
{
  "taskId": "abc123...",
  "solution": {
    "token": "0.XXXXXXXXXXXXXXXX..."
  },
  "status": "ready"
}

Import This Workflow

Copy the JSON below and import it into n8n via Menu โ†’ Import from JSON:

Click to expand workflow JSON
json Copy
{
  "name": "Turnstile solver",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "solver-turnstile",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [-208, 0],
      "id": "137be4f0-1762-4f0c-b993-c512d27e35de",
      "name": "Webhook",
      "webhookId": "3d32ad61-d925-4a09-8fe5-7226e6664a98"
    },
    {
      "parameters": {
        "operation": "Cloudflare Turnstile",
        "websiteURL": "={{ $json.body.websiteURL }}",
        "websiteKey": "={{ $json.body.websiteKey }}",
        "optional": {}
      },
      "type": "n8n-nodes-capsolver.capSolver",
      "typeVersion": 1,
      "position": [192, 80],
      "id": "954ff1f0-d5de-4468-b0d1-fbce03676676",
      "name": "Cloudflare Turnstile",
      "credentials": {
        "capSolverApi": {
          "id": "sLg2YDZd7WtYJJJ4",
          "name": "CapSolver account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [400, 0],
      "id": "db264e2b-48ce-4887-9b2b-2b8077993c30",
      "name": "Respond to Webhook"
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Cloudflare Turnstile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cloudflare Turnstile": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  }
}

API Parameter Reference

The Turnstile solver API endpoint accepts the following parameters:

Parameter Required Description
websiteURL Yes The URL of the page hosting the Turnstile widget
websiteKey Yes The Turnstile site key
metadata.action No Action string required by some sites for the Turnstile challenge
metadata.cdata No Custom data passed to the Turnstile widget by some sites

Tip: You can identify the websiteURL and websiteKey by inspecting the page source โ€” see How to Identify Turnstile Parameters.

Compared to reCAPTCHA, Turnstile is simpler โ€” you only need two required parameters. Some sites may also require the optional metadata.action or metadata.cdata fields โ€” add these in the node's Optional section if the token isn't being accepted.


Real-World Example: Submitting a Turnstile Token to a Website

The API workflow above shows how to get a solved Turnstile token. But what do you actually do with it?

In real-world automation, solving the challenge is only half the job. You need to submit the token to the target website โ€” exactly as a browser would โ€” to unlock the data or action behind the Turnstile protection.

Here's the general pattern:

  1. Solve the challenge โ†’ Get the token from CapSolver
  2. Submit the token โ†’ Send it to the target website via an HTTP Request (usually as a cf-turnstile-response form field)
  3. Verify the response โ†’ Check if the website accepted the token
  4. Process the result โ†’ Extract the data you need

Example: Solving & Submitting Turnstile

Example: https://example.com/ โ€” A Turnstile-protected website

Workflow Flow

Copy
Manual Trigger โ†’ CapSolver Turnstile โ†’ HTTP POST Request โ†’ IF (check success) โ†’ Edit Fields (extract data)

How It Works

  1. Manual Trigger โ€” Starts the workflow manually (click "Execute workflow"). You can replace this with any trigger โ€” Webhook, Schedule, App Event, etc.
  2. CapSolver Cloudflare Turnstile โ€” Solves the Turnstile challenge:
    • Operation: Cloudflare Turnstile
    • Website URL: https://example.com/login
    • Website Key: 0x4AAAAAAA... (find it by inspecting the page source โ€” see How to Identify Turnstile Parameters
  3. HTTP POST Request โ€” Submits the solved token to the target website:
    • The token is sent in the cf-turnstile-response form field
    • Include any other form fields the site expects (e.g., username, password)
    • This is what a browser does when you submit the form after Turnstile validates you
  4. IF Node โ€” Checks if the response indicates success (e.g., a redirect, a success message, or specific JSON fields)
  5. Edit Fields โ€” Extracts the data you need from the response. In a real scenario, this is where you'd parse the HTML using the HTML node to pull out specific elements (e.g., user data, product listings, dashboard content) and map them to your output fields

Key concept: Every website handles token submission differently. In this example, the token goes in a cf-turnstile-response form field via POST โ€” but other sites may expect it in a different field name, as a JSON body, as a header, or through a completely different endpoint. Always inspect the site's actual form submission (using DevTools Network tab) to see exactly how the token needs to be sent.

Applying This Pattern to Any Turnstile-Protected Website

  1. Identify the Turnstile parameters โ€” Find the websiteURL and websiteKey by inspecting the page source
  2. Inspect the form submission โ€” Use your browser's DevTools Network tab to see what request the form sends when submitted (URL, method, headers, body fields)
  3. Replicate the request in n8n โ€” Configure the HTTP Request node to match the form submission exactly, inserting the solved token in the correct field (usually cf-turnstile-response, but check the actual form)
  4. Add validation โ€” Use an IF node to check the response and confirm the data was unlocked
  5. Extract the data โ€” Once the site accepts the token, parse the response to extract the data you need. Use the HTML node for HTML responses or Edit Fields for JSON responses

Note: This example uses Manual Trigger for simplicity, but you can replace it with any trigger node โ€” Webhook (to build an API), Schedule (to run every hour), App Event (to react to Telegram messages), or any other. See Ways to Trigger Your Workflows for all options.


Ways to Trigger Your Workflows

The examples in this guide use Manual Trigger (for scraping workflows) and Webhook (for the API workflow), but n8n offers many more ways to start a workflow. You can swap the trigger node to match your use case:

Trigger Description Best for
Trigger manually Click "Execute workflow" in n8n Testing and one-off runs
On a schedule Runs every day, hour, or custom interval (cron) Recurring scraping jobs (e.g., check a site every hour)
On webhook call Runs on receiving an HTTP request Building APIs that other services can call
On app event Runs when something happens in Telegram, Notion, Airtable, etc. Reacting to events (e.g., new Telegram message triggers a solve)
On form submission Generates a web form in n8n and passes responses to the workflow Letting users submit captcha parameters through a form
When executed by another workflow Called by the Execute Workflow node from a different workflow Modular architecture โ€” keep your solver as a reusable sub-workflow
On chat message Runs when a user sends a chat message (AI nodes) Chatbot integrations that need to solve challenges on demand
Other ways Workflow errors, file changes, etc. Advanced automation triggers

For example, to run your scraping workflow every hour, simply replace the Manual Trigger with a Schedule Trigger node and set the interval to 1 hour. The rest of the workflow stays exactly the same.


Storing and Exporting Scraped Data

Once your workflow solves a Turnstile challenge and retrieves data from the target website, you'll want to store or export that data. n8n provides built-in data transformation and output nodes for this.

Data Transformation

Before saving, you can transform the scraped data using n8n's built-in nodes:

Node Description
Merge Combine data from multiple sources
Summarize Sum, count, max, etc. across items
Convert to File Convert JSON data to CSV, Excel, or other binary formats
Extract from File Convert binary data to JSON
HTML Parse and extract data from HTML responses
XML Convert between JSON and XML
Rename Keys Rename fields to match your desired output format
Sort Reorder items before exporting

Output Destinations

After the IF node validates the response, you can add any of these nodes to save the data:

Destination How
Google Sheets Append rows to a spreadsheet โ€” great for tracking results over time
Excel / CSV file Use the Convert to File node to generate .xlsx or .csv, then save with the Write Binary File node or upload to Google Drive
Database (MySQL, PostgreSQL, MongoDB) Insert directly into a database table for structured storage
Airtable / Notion Send data to your project management tools
Google Drive / S3 Upload files to cloud storage
Telegram / Slack / Email Send notifications with the scraped data
Local JSON file Write results to a .json file on disk

Tip: You can combine multiple outputs โ€” for example, save to Google Sheets and send a Telegram notification at the same time by connecting both nodes to the IF node's "true" output.


Troubleshooting

"ERROR_KEY_DOES_NOT_EXIST" or Invalid API Key

Symptom CapSolver node fails with an API key error
Cause Your API key is incorrect or not configured
Fix Double-check your API key in Settings โ†’ Credentials. Copy it directly from the CapSolver Dashboard

"ERROR_ZERO_BALANCE"

Symptom Task creation fails with a balance error
Cause Your CapSolver account has no credits
Fix Top up your balance at the CapSolver Dashboard

Wrong or Expired Token

Symptom The returned token is rejected by the target website
Cause Turnstile tokens expire after a short period
Fix Use the token immediately after receiving it

Token Not Accepted by the Website

Symptom CapSolver returns a token successfully, but the target website still rejects it
Cause Some websites have additional protections beyond Turnstile, or require specific parameters that weren't included
Fix Double-check that you're submitting the token exactly as the site expects (correct field name, method, and endpoint). Make sure you're using the correct site key. If the token is still not accepted, contact the CapSolver support team for assistance โ€” they can help diagnose site-specific issues

Timeout or Slow Response

Symptom The webhook takes too long or times out
Cause Captcha solving can take a few seconds depending on load
Fix Increase the webhook timeout in n8n settings. Consider adding retry logic for production use cases

Best Practices

  1. Use tokens immediately โ€” Turnstile tokens expire quickly. Send the token to the target website as soon as you receive it from your solver API.

  2. Verify parameters before configuring โ€” Always confirm the correct websiteKey by inspecting the page source before configuring your workflow.

  3. Keep your API key secure โ€” Never expose your CapSolver API key in client-side code. These n8n workflows keep your key server-side, which is the recommended approach.

  4. Monitor your balance โ€” Set up balance alerts in the CapSolver dashboard to avoid unexpected workflow failures due to insufficient credits.

  5. Add error handling โ€” For production workflows, add an IF node after the CapSolver node to check for errors and handle them gracefully (e.g., retry, notify, or log the failure).


Conclusion

You've learned how to build a Cloudflare Turnstile-solving API and a scraping workflow pattern using n8n and CapSolver โ€” no traditional coding required.

In this guide, we covered:

  • An API solver endpoint for Cloudflare Turnstile using a webhook-based workflow
  • A real-world scraping pattern showing how to submit solved tokens to target websites and extract protected data
  • How to identify Turnstile parameters by inspecting the page source
  • Best practices for token handling, error management, and production use

The key takeaway: solving the Turnstile challenge is only half the job โ€” you also need to submit the token to the target website to unlock the protected data.


Ready to get started? Sign up for CapSolver and use bonus code n8n for an extra 8% bonus on your first recharge!

CapSolver bonus code banner


Frequently Asked Questions

What is Cloudflare Turnstile?

Cloudflare Turnstile is a CAPTCHA alternative that verifies visitors without requiring them to solve puzzles. It runs in the background using browser signals and behavioral analysis to determine if a visitor is human.

What captcha types does CapSolver support in n8n?

CapSolver's n8n node supports Cloudflare Turnstile, reCAPTCHA v2, reCAPTCHA v2 Invisible, reCAPTCHA v3 and more. Check the n8n CapSolver integration page for the full list.

How much does it cost to solve a Turnstile challenge?

Pricing varies based on usage. Check the CapSolver pricing page for current Turnstile rates.

How long does it take to solve a Turnstile challenge?

Turnstile challenges are typically solved in a few seconds since there are no image challenges involved.

Can I use this workflow with n8n Cloud?

Yes! This workflow works with both self-hosted n8n and n8n Cloud. The CapSolver node is already available as an official integration โ€” just add your API credentials.

How do I find the Turnstile site key for a website?

Search the page source for data-sitekey in the HTML or look for turnstile.render() in the JavaScript. You can also open DevTools (F12) โ†’ Network tab and filter by turnstile to find the site key in requests. See How to Identify Turnstile Parameters for a detailed guide.

What's the difference between Turnstile and reCAPTCHA?

Turnstile is Cloudflare's CAPTCHA alternative that focuses on privacy and user experience โ€” it rarely shows visible challenges. reCAPTCHA is Google's bot detection system that may require users to solve image puzzles (v2) or assigns a behavioral score (v3). Both can be solved with CapSolver in n8n.

What happens if CapSolver fails to solve a Turnstile challenge?

The CapSolver node will return an error. For production workflows, it's recommended to add error handling (e.g., an IF node to check for errors and a retry mechanism or notification).

Compliance Disclaimer: The information provided on this blog is for informational purposes only. CapSolver is committed to compliance with all applicable laws and regulations. The use of the CapSolver network for illegal, fraudulent, or abusive activities is strictly prohibited and will be investigated. Our captcha-solving solutions enhance user experience while ensuring 100% compliance in helping solve captcha difficulties during public data crawling. We encourage responsible use of our services. For more information, please visit our Terms of Service and Privacy Policy.

More