API Tutorials

Case-Sensitive CAPTCHA API Parameter Guide

Some CAPTCHAs require exact case matching — AbCd is not abcd. Using the regsense parameter correctly prevents rejection of valid solves.


The regsense Parameter

Value Meaning
0 (default) Case-insensitive — solver may return any case
1 Case-sensitive — solver preserves original case

When Case Sensitivity Matters

Sites that validate case check the solve result exactly. If the CAPTCHA shows AbCd3F and you submit abcd3f, it fails.

Common case-sensitive sites:

  • Financial services login pages
  • Government portals
  • Some forum registrations
  • Custom CAPTCHA implementations

Basic Usage

import requests
import base64
import time
import os

API_KEY = os.environ["CAPTCHAAI_API_KEY"]


def solve_case_sensitive(image_b64):
    """Solve with case preservation."""
    resp = requests.post("https://ocr.captchaai.com/in.php", data={
        "key": API_KEY,
        "method": "base64",
        "body": image_b64,
        "regsense": 1,    # Preserve case
        "json": 1,
    }, timeout=30)

    result = resp.json()
    if result.get("status") != 1:
        raise RuntimeError(result.get("request"))

    task_id = result["request"]

    time.sleep(8)
    for _ in range(24):
        resp = requests.get("https://ocr.captchaai.com/res.php", params={
            "key": API_KEY, "action": "get",
            "id": task_id, "json": 1,
        }, timeout=15)
        data = resp.json()
        if data.get("status") == 1:
            return data["request"]
        if data["request"] != "CAPCHA_NOT_READY":
            raise RuntimeError(data["request"])
        time.sleep(5)

    raise TimeoutError("Solve timeout")

Detecting Case Sensitivity

Before setting regsense, determine if the site requires it:

# detect_case.py


def detect_case_sensitivity(page_html):
    """Detect if CAPTCHA is likely case-sensitive."""
    indicators = [
        "case sensitive",
        "case-sensitive",
        "CaSe SeNsItIvE",
        "exact characters",
        "enter exactly",
    ]

    lower = page_html.lower()
    for indicator in indicators:
        if indicator.lower() in lower:
            return True

    return False


def detect_from_input(page_html):
    """Check input field attributes for clues."""
    import re

    # autocomplete="off" + no text-transform often means case-sensitive
    if 'autocomplete="off"' in page_html:
        return True

    # text-transform: uppercase means the site lowercases anyway
    if "text-transform: uppercase" in page_html:
        return False  # Not case-sensitive

    return None  # Unknown

Testing Case Sensitivity

# test_case.py


def test_case_sensitivity(solve_func, test_url):
    """Test whether a site validates case by submitting both."""
    # This requires two solves — use on first integration only

    # Solve 1: Case-sensitive
    result_sensitive = solve_func(regsense=1)

    # Solve 2: Lowercased
    result_lower = result_sensitive.lower()

    # If lowercased works, case doesn't matter
    # If only original works, case matters

    return {
        "original": result_sensitive,
        "lowered": result_lower,
        "needs_regsense": result_sensitive != result_lower,
    }

Combined with Other Parameters

# Case-sensitive, letters only, Latin, fixed length
params = {
    "regsense": 1,
    "numeric": 2,      # Letters only (no digits)
    "language": 2,     # Latin alphabet
    "minLen": 6,
    "maxLen": 6,
}

# Case-sensitive, mixed alphanumeric
params = {
    "regsense": 1,
    "minLen": 5,
    "maxLen": 8,
}

Common Mistakes

Mistake 1: Using regsense when not needed

# If the site lowercases input anyway, regsense=1 reduces accuracy
# Only set regsense=1 when the site actually checks case

Mistake 2: Not handling the response correctly

# WRONG — stripping case after solve
answer = solve_case_sensitive(image_b64).lower()  # Defeats the purpose

# RIGHT — use as-is
answer = solve_case_sensitive(image_b64)

Mistake 3: Mixing with numeric=1

# numeric=1 means digits only — no letters to be case-sensitive about
# Don't combine regsense=1 with numeric=1 (it's contradictory)

Troubleshooting

Issue Cause Fix
Answer rejected despite correct characters Case mismatch Enable regsense=1
Lower accuracy with regsense More ambiguous characters Add textinstructions for context
Always returns uppercase Image only has uppercase Set regsense=1 and textinstructions="all uppercase"
Some chars wrong case Ambiguous glyphs (o/O, s/S) Report bad answers for quality improvement

FAQ

Does regsense affect cost?

No. The parameter is free — it only guides the solver's output format.

Should I always use regsense=1?

No. Only use it when the target site validates case. Using it unnecessarily can reduce accuracy because the solver has to make harder decisions about ambiguous characters.

What about mixed case (some upper, some lower)?

Set regsense=1. The solver will attempt to match the exact case shown in the image.



Get the case right — start with CaptchaAI.

Discussions (0)

No comments yet.

Related Posts

API Tutorials Image CAPTCHA Base64 Encoding Best Practices
Best practices for base 64 encoding CAPTCHA images before submitting to Captcha AI.

Best practices for base 64 encoding CAPTCHA images before submitting to Captcha AI. Covers format, quality, si...

Python Web Scraping Image OCR
Apr 06, 2026
API Tutorials Custom CAPTCHA Types: Submitting Unusual Challenges to CaptchaAI
How to submit non-standard and custom CAPTCHA types to Captcha AI — drag-and-drop, slider, puzzle, audio, and custom interactive challenges.

How to submit non-standard and custom CAPTCHA types to Captcha AI — drag-and-drop, slider, puzzle, audio, and...

Python Web Scraping Image OCR
Feb 07, 2026
API Tutorials Math CAPTCHA Solving with CaptchaAI calc Parameter
Solve math CAPTCHAs using Captcha AI's calc parameter.

Solve math CAPTCHAs using Captcha AI's calc parameter. The API reads the equation and returns the computed res...

Python Web Scraping Image OCR
Apr 02, 2026
Tutorials Grid Image CAPTCHA: Coordinate Mapping and Cell Selection
Map grid image CAPTCHA cells to coordinates, extract the full grid, and solve re CAPTCHA-style image challenges with Captcha AI.

Map grid image CAPTCHA cells to coordinates, extract the full grid, and solve re CAPTCHA-style image challenge...

Python Web Scraping Image OCR
Jan 20, 2026
API Tutorials Improving OCR CAPTCHA Accuracy with CaptchaAI Settings
Optimize OCR CAPTCHA solve accuracy using Captcha AI API parameters — numeric, min Len, max Len, language, regsense, and textinstructions.

Optimize OCR CAPTCHA solve accuracy using Captcha AI API parameters — numeric, min Len, max Len, language, reg...

Python Web Scraping Image OCR
Jan 09, 2026
API Tutorials Phrase, MinLen, and MaxLen Parameters for Image CAPTCHA
Use phrase, min Len, and max Len parameters to constrain image CAPTCHA solving with Captcha AI and improve accuracy.

Use phrase, min Len, and max Len parameters to constrain image CAPTCHA solving with Captcha AI and improve acc...

Python Web Scraping Image OCR
Jan 09, 2026
API Tutorials CAPTCHA Image Preprocessing for Better Solve Rates
Preprocess CAPTCHA images using Python PIL to improve solve rates — grayscale conversion, noise removal, contrast enhancement, and binarization.

Preprocess CAPTCHA images using Python PIL to improve solve rates — grayscale conversion, noise removal, contr...

Python Web Scraping Image OCR
Mar 15, 2026
Use Cases Shipping and Logistics Rate Scraping with CAPTCHA Solving
Scrape shipping rates, tracking data, and logistics information from carrier websites protected by CAPTCHAs using Captcha AI.

Scrape shipping rates, tracking data, and logistics information from carrier websites protected by CAPTCHAs us...

Python reCAPTCHA v2 Cloudflare Turnstile
Jan 25, 2026
API Tutorials Multi-Character Image CAPTCHA Solving Strategies
Strategies for solving multi-character image CAPTCHAs — handling connected letters, overlapping characters, and distorted text with Captcha AI.

Strategies for solving multi-character image CAPTCHAs — handling connected letters, overlapping characters, an...

Python Web Scraping Image OCR
Jan 20, 2026
Use Cases Legal Research Web Scraping with CAPTCHA Handling
Scrape legal databases, court records, and case law from portals protected by CAPTCHAs using Captcha AI for automated legal research.

Scrape legal databases, court records, and case law from portals protected by CAPTCHAs using Captcha AI for au...

Python reCAPTCHA v2 Web Scraping
Jan 17, 2026
API Tutorials How to Solve reCAPTCHA v2 Enterprise with Python
Solve re CAPTCHA v 2 Enterprise using Python and Captcha AI API.

Solve re CAPTCHA v 2 Enterprise using Python and Captcha AI API. Complete guide with sitekey extraction, task...

Automation Python reCAPTCHA v2
Apr 08, 2026
API Tutorials Solving CAPTCHAs with Kotlin and CaptchaAI API
Complete guide to solving re CAPTCHA, Turnstile, and image CAPTCHAs in Kotlin using Captcha AI's HTTP API with Ok Http, Ktor client, and coroutines.

Complete guide to solving re CAPTCHA, Turnstile, and image CAPTCHAs in Kotlin using Captcha AI's HTTP API with...

Automation reCAPTCHA v2 Cloudflare Turnstile
Mar 06, 2026
API Tutorials Graceful Degradation When CAPTCHA Solving Fails
Keep your automation running when CAPTCHA solving fails — fallback strategies, queue-based retries, and degraded-mode patterns.

Keep your automation running when CAPTCHA solving fails — fallback strategies, queue-based retries, and degrad...

Automation Python All CAPTCHA Types
Apr 06, 2026