Captcha bypass tutorials

Was this helpful?

How to bypass Lemin captcha

Gregory Fisher

Technical engineer

Introduction

Lemin captcha is a modern protection system that uses interactive puzzles (such as drag-and-drop puzzles or sliders) to verify users. Unlike simple text captchas, Lemin generates unique session identifiers, ties them to the domain, and requires exact context matching, making it challenging for standard automation and scraping methods.

In this guide, we'll walk through how to automatically bypass Lemin captcha using the 2Captcha API. We'll cover how to extract the necessary parameters from the page, configure tasks with or without proxies, and correctly inject the received response into the target website.

How to Find Lemin captcha Parameters on a Website

To successfully solve the captcha, you'll need two critical parameters: captchaId and divId.

  1. Open the target page in your browser and launch the developer tools (F12).
  2. Navigate to the Elements tab and locate the script tag that loads code from the api.leminnow.com domain.
  3. In the src attribute of this script, you'll find a unique identifier embedded in the URL. Copy it — this is your captchaId (it typically starts with CROPPED_).
  4. Next, find the div container where the captcha is integrated. By default, its id is lemin-cropped-captcha, but website developers may have changed this value. Copy the id attribute of this block — this is your divId.

API Parameters

The 2Captcha API supports two task types for Lemin: using our proxies (LeminTaskProxyless) and using your own proxies (LeminTask).

Required Parameters (for both types)

Parameter Type Description
type string LeminTaskProxyless or LeminTask
websiteURL string Full URL of the target page where the captcha is loaded
captchaId string The captchaId value extracted from the Lemin script
divId string ID of the parent div element containing the captcha

Optional Parameters

Parameter Type Description
leminApiServerSubdomain string API domain for loading scripts. Default: api.leminnow.com
userAgent string Your browser's User-Agent. Recommended to pass for session matching

Proxy Parameters (for LeminTask only)

If the website strictly checks IP addresses, use the LeminTask type and pass your residential proxy details.

Parameter Type Description
proxyType string Proxy type: http, socks4, or socks5
proxyAddress string IP address or hostname of the proxy server
proxyPort integer Proxy server port
proxyLogin string Login for authentication (if required)
proxyPassword string Password for authentication (if required)

JSON Request Examples

Create Task Request (Proxyless)

json Copy
{
    "clientKey": "YOUR_API_KEY",
    "task": {
        "type": "LeminTaskProxyless",
        "captchaId": "CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b",
        "divId": "lemin-cropped-captcha",
        "leminApiServerSubdomain": "api.leminnow.com",
        "websiteURL": "https://example.com/login"
    }
}

Create Task Request (with Your Proxy)

json Copy
{
    "clientKey": "YOUR_API_KEY",
    "task": {
        "type": "LeminTask",
        "captchaId": "CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b",
        "divId": "lemin-cropped-captcha",
        "websiteURL": "https://example.com/login",
        "proxyType": "http",
        "proxyAddress": "1.2.3.4",
        "proxyPort": 8080,
        "proxyLogin": "user",
        "proxyPassword": "password"
    }
}

Successful Response with Solution

Unlike many other captchas, Lemin doesn't return just a token — it returns a solution object containing both answer and challenge_id. You'll need both values for the final request.

json Copy
{
    "errorId": 0,
    "status": "ready",
    "solution": {
        "answer": "0xaxakx0xaxaax0xkxx3ox0x3ox3ox...gAAAAABk8bgzEFOg9i3Jm",
        "challenge_id": "e0348984-92ec-23af-1488-446e3a58946c"
    },
    "cost": "0.00299",
    "createTime": 1692863536,
    "endTime": 1692863556
}

Step-by-Step Implementation in Python

Step 1: Create the Task

python Copy
import requests

API_KEY = "YOUR_API_KEY"
API_HOST = "api.2captcha.com"

def create_lemin_task(website_url, captcha_id, div_id):
    payload = {
        "clientKey": API_KEY,
        "task": {
            "type": "LeminTaskProxyless",
            "websiteURL": website_url,
            "captchaId": captcha_id,
            "divId": div_id,
            "leminApiServerSubdomain": "api.leminnow.com"
        }
    }
    
    response = requests.post(f"https://api.2captcha.com/createTask", json=payload)
    return response.json()["taskId"]

Step 2: Get the Result

python Copy
import time

def get_lemin_result(task_id):
    while True:
        time.sleep(5)
        
        payload = {
            "clientKey": API_KEY,
            "taskId": task_id
        }
        
        response = requests.post(f"https://api.2captcha.com/getTaskResult", json=payload)
        result = response.json()
        
        if result.get("status") == "ready":
            return result["solution"]
        elif result.get("errorId") != 0:
            raise Exception(f"API error: {result.get('errorDescription')}")

Complete Code Examples

Python (via Official SDK)

Using the SDK significantly simplifies the code, as the library handles task status polling for you.

python Copy
from twocaptcha import Twocaptcha

solver = Twocaptcha('YOUR_API_KEY')

try:
    result = solver.lemin(
        captcha_id='CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b',
        div_id='lemin-cropped-captcha',
        url='https://example.com/login',
        api_server='api.leminnow.com'
    )
    
    print(f"Answer: {result['answer']}")
    print(f"Challenge ID: {result['challenge_id']}")
    
except Exception as e:
    print(f"Error solving: {e}")

Selenium Integration and Answer Injection

After receiving the answer and challenge_id, you need to pass them to the website. Lemin typically expects this data in hidden form fields or through a JavaScript callback before form submission.

python Copy
from selenium import webdriver
from selenium.webdriver.common.by import By
from twocaptcha import Twocaptcha
import time

driver = webdriver.Chrome()
driver.get("https://example.com/login")
time.sleep(3)  # Wait for captcha to load

# Solve the captcha
solver = Twocaptcha('YOUR_API_KEY')
result = solver.lemin(
    captcha_id='CROPPED_...',
    div_id='lemin-cropped-captcha',
    url=driver.current_url
)

# Inject the received data into hidden fields (adapt selectors to your website)
driver.execute_script(f"""
    let answerInput = document.querySelector('input[name="lemin_answer"]');
    if (!answerInput) {{
        answerInput = document.createElement('input');
        answerInput.type = 'hidden';
        answerInput.name = 'lemin_answer';
        document.querySelector('form').appendChild(answerInput);
    }}
    answerInput.value = '{result["answer"]}';
    
    // If the website requires challenge_id
    let challengeInput = document.querySelector('input[name="lemin_challenge_id"]');
    if (challengeInput) {{
        challengeInput.value = '{result["challenge_id"]}';
    }}
""")

# Submit the form
driver.find_element(By.CSS_SELECTOR, "button[type='submit']").click()

Best Practices

1. Extract captchaId Accurately

The captcha identifier is embedded in the script URL. If you copy it incorrectly or truncate extra characters, the task won't be solved.

2. Use Residential Proxies for Strict Websites

Lemin analyzes network traffic. If you solve the captcha via Proxyless but the final POST request with the answer comes from your datacenter IP, the website may reject the token. In such cases, use the LeminTask type and pass the proxy directly to the API.

3. Pass Both Parameters from the Solution

Many developers mistakenly send only the answer. However, Lemin often requires validation of the answer and challenge_id pair. Make sure you pass both values in the final request to the target website.

4. Synchronize User-Agent

If you're using Selenium or Playwright, pass the browser's User-Agent in the userAgent parameter when creating the task. This helps the Lemin system link the solving session with the form submission session.

Solution Accuracy Reports

If a captcha solution turns out to be incorrect or you want to confirm a correct answer, use the 2Captcha reporting system. This helps improve recognition quality and trains our workers.

When to Send Reports

Send reportIncorrect if:

  • The website rejected the received answer and challenge_id
  • The captcha didn't load or threw an internal error after token injection
  • The worker missed a step in the interactive puzzle

Send reportCorrect if:

  • The solution passed validation on the website and the form was successfully submitted
  • You want to confirm the high quality of the worker's performance

Report Parameters

Parameter Type Description
clientKey string Your API key
taskId string Task ID received when calling createTask

Example of Sending a Report

python Copy
import requests

API_KEY = "YOUR_API_KEY"
API_HOST = "api.2captcha.com"

def report_incorrect(task_id):
    """Report an incorrect Lemin captcha solution"""
    response = requests.post(
        f"https://api.2captcha.com/reportIncorrect",
        json={
            "clientKey": API_KEY,
            "taskId": task_id
        }
    )
    return response.json().get("errorId") == 0

def report_correct(task_id):
    """Report a correct Lemin captcha solution"""
    response = requests.post(
        f"https://api.2captcha.com/reportCorrect",
        json={
            "clientKey": API_KEY,
            "taskId": task_id
        }
    )
    return response.json().get("errorId") == 0

Important Points for Reporting

  1. Save the taskId — make sure to save the task ID in your script's state so you can send a report after verifying the answer on the target website.
  2. Send reports promptly — reports are only accepted within a certain time after the task is solved.
  3. Don't abuse reports — send reportIncorrect only if you're confident the issue is on the service side, not due to your IP address or an expired session on the website.

Troubleshooting Common Issues

Website Rejects the Answer (Invalid Token)

Solutions:

  • Make sure you're passing both answer and challenge_id.
  • Check if the captcha session has expired (usually 1-2 minutes). Inject the answer immediately after receiving it.
  • Switch to LeminTask with a residential proxy so the IP address during solving matches the IP during form submission.

ERROR_captcha_UNSOLVABLE Error

Solutions:

  • Verify the captchaId you copied is correct.
  • Make sure divId is specified correctly (developers often change the default lemin-cropped-captcha to custom values).
  • Check if the api.leminnow.com domain is blocked in your network.

captcha Doesn't Appear on the Page

Solutions:

  • Lemin may not load if the website detects you're using automation (Selenium/Puppeteer) without masking. Use Undetected Chromedriver or stealth plugins.

Conclusion

Bypassing Lemin captcha through 2Captcha requires careful attention to extracting parameters from the page and correctly passing the received solution.

Key Takeaways:

  1. Accurately extract captchaId from the script URL and divId from the container.
  2. Remember that the solution consists of two parts: answer and challenge_id. Both need to be passed to the website.
  3. For websites with strict IP checking, use the LeminTask type with your proxies.
  4. Inject tokens as quickly as possible before the session expires.
  5. Use reportIncorrect and reportCorrect to maintain high solution quality.

Following these recommendations, you'll be able to reliably automate interactions with websites protected by the Lemin system.