Getting Started

CaptchaAI API Response Formats Explained

CaptchaAI uses simple text-based responses. This reference covers every response format you'll encounter, with parsing examples.

Submit Endpoint (in.php)

Success Response

OK|TASK_ID

Example: OK|73548291

Error Response

ERROR_CODE

Example: ERROR_WRONG_USER_KEY

Parsing

resp = requests.get("https://ocr.captchaai.com/in.php", params={...})

if resp.text.startswith("OK|"):
    task_id = resp.text.split("|")[1]
else:
    error = resp.text
    raise Exception(f"Submit failed: {error}")
const resp = await axios.get("https://ocr.captchaai.com/in.php", { params });

if (resp.data.startsWith("OK|")) {
  const taskId = resp.data.split("|")[1];
} else {
  throw new Error(`Submit failed: ${resp.data}`);
}

Poll Endpoint (res.php)

Not Ready Response

CAPCHA_NOT_READY

The task is still being processed. Wait 5 seconds and poll again.

Success — Token-Based CAPTCHAs

For reCAPTCHA, Turnstile, hCaptcha, and similar:

OK|03AGdBq24PBCbw...long_token_string

Success — Image/OCR CAPTCHAs

OK|abc123

The text after OK| is the recognized text from the image.

Success — GeeTest

OK|challenge:abc123,validate:def456,seccode:ghi789

Parse each field:

if result.text.startswith("OK|"):
    data = result.text.split("|")[1]
    parts = dict(item.split(":") for item in data.split(","))
    challenge = parts["challenge"]
    validate = parts["validate"]
    seccode = parts["seccode"]

Success — Cloudflare Challenge

Returns cf_clearance cookie value and user agent:

OK|cf_clearance=abc123;user_agent=Mozilla/5.0...

Error Response

ERROR_CODE

Parsing Template

def parse_result(response_text):
    if response_text == "CAPCHA_NOT_READY":
        return {"status": "pending"}

    if response_text.startswith("OK|"):
        return {"status": "solved", "result": response_text.split("|", 1)[1]}

    return {"status": "error", "error": response_text}

Balance Endpoint

GET https://ocr.captchaai.com/res.php?key=API_KEY&action=getbalance

Response:

1.234

A decimal number representing your balance in USD.

balance = float(requests.get("https://ocr.captchaai.com/res.php", params={
    "key": API_KEY, "action": "getbalance"
}).text)
print(f"Balance: ${balance:.2f}")

Report Endpoints

Report Good (correct solve)

GET https://ocr.captchaai.com/res.php?key=API_KEY&action=reportgood&id=TASK_ID

Response: OK_REPORT_RECORDED

Report Bad (incorrect solve)

GET https://ocr.captchaai.com/res.php?key=API_KEY&action=reportbad&id=TASK_ID

Response: OK_REPORT_RECORDED

Reporting bad solves helps improve accuracy and may credit your balance.

Common Error Codes

Error Code Meaning Action
ERROR_WRONG_USER_KEY Invalid API key Verify your key
ERROR_KEY_DOES_NOT_EXIST Key not registered Check dashboard
ERROR_ZERO_BALANCE Insufficient funds Add balance
ERROR_NO_SLOT_AVAILABLE Server at capacity Retry after 5 seconds
ERROR_CAPTCHA_UNSOLVABLE Challenge too difficult Retry with fresh CAPTCHA
ERROR_BAD_DUPLICATES Duplicate task rejected Wait before resubmitting
ERROR_WRONG_CAPTCHA_ID Invalid task ID Check task ID value
ERROR_EMPTY_ACTION Missing action parameter Add action=get
IP_BANNED Too many bad requests Fix your API key; wait

Complete Polling Example

import requests
import time

API_KEY = "YOUR_API_KEY"

def solve_captcha(submit_params, timeout=300):
    """Generic solver with proper response handling."""
    submit_params["key"] = API_KEY

    # Submit
    resp = requests.get("https://ocr.captchaai.com/in.php", params=submit_params)
    if not resp.text.startswith("OK|"):
        raise Exception(f"Submit error: {resp.text}")

    task_id = resp.text.split("|")[1]

    # Poll
    deadline = time.time() + timeout
    while time.time() < deadline:
        time.sleep(5)
        result = requests.get("https://ocr.captchaai.com/res.php", params={
            "key": API_KEY,
            "action": "get",
            "id": task_id
        })

        parsed = parse_result(result.text)

        if parsed["status"] == "pending":
            continue
        elif parsed["status"] == "solved":
            return parsed["result"]
        else:
            raise Exception(f"Solve error: {parsed['error']}")

    raise TimeoutError(f"Task {task_id} timed out after {timeout}s")

FAQ

Why does the response use pipe (|) delimiters instead of JSON?

CaptchaAI's format is optimized for simplicity. Pipe-delimited responses are smaller and faster to parse than JSON. For structured data (GeeTest results), the data after OK| contains key-value pairs.

How do I handle network errors?

Wrap API calls in try/except and retry on ConnectionError or Timeout. Network issues are separate from API errors; the API itself maintains 99.9%+ uptime.

What's the maximum token length?

reCAPTCHA tokens can be up to ~500 characters. Always use split("|", 1) (max split of 1) to avoid splitting the token itself.

Discussions (0)

No comments yet.

Related Posts

Reference CAPTCHA Token Injection Methods Reference
Complete reference for injecting solved CAPTCHA tokens into web pages.

Complete reference for injecting solved CAPTCHA tokens into web pages. Covers re CAPTCHA, Turnstile, and Cloud...

Automation Python reCAPTCHA v2
Apr 08, 2026
Tutorials Pytest Fixtures for CaptchaAI API Testing
Build reusable pytest fixtures to test CAPTCHA-solving workflows with Captcha AI.

Build reusable pytest fixtures to test CAPTCHA-solving workflows with Captcha AI. Covers mocking, live integra...

Automation Python reCAPTCHA v2
Apr 08, 2026
Tutorials CAPTCHA Solving Fallback Chains
Implement fallback chains for CAPTCHA solving with Captcha AI.

Implement fallback chains for CAPTCHA solving with Captcha AI. Cascade through solver methods, proxy pools, an...

Automation Python reCAPTCHA v2
Apr 06, 2026
Use Cases Multi-Step Workflow Automation with CaptchaAI
Manage workflows across multiple accounts on CAPTCHA-protected platforms — , action, and data collection at scale.

Manage workflows across multiple accounts on CAPTCHA-protected platforms — , action, and data collection at sc...

Automation Python reCAPTCHA v2
Apr 06, 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
Integrations Puppeteer Stealth + CaptchaAI: Reliable Browser Automation
Standard Puppeteer gets detected immediately by anti-bot systems.

Standard Puppeteer gets detected immediately by anti-bot systems. `puppeteer-extra-plugin-stealth` patches the...

Automation reCAPTCHA v2 Cloudflare Turnstile
Apr 05, 2026
Comparisons WebDriver vs Chrome DevTools Protocol for CAPTCHA Automation
Compare Web Driver and Chrome Dev Tools Protocol (CDP) for CAPTCHA automation — detection, performance, capabilities, and when to use each with Captcha AI.

Compare Web Driver and Chrome Dev Tools Protocol (CDP) for CAPTCHA automation — detection, performance, capabi...

Automation Python reCAPTCHA v2
Mar 27, 2026
Troubleshooting ERROR_PAGEURL: URL Mismatch Troubleshooting Guide
Fix ERROR_PAGEURL when using Captcha AI.

Fix ERROR_PAGEURL when using Captcha AI. Diagnose URL mismatch issues, handle redirects, SPAs, and dynamic URL...

Automation Python reCAPTCHA v2
Mar 23, 2026
API Tutorials Solving CAPTCHAs with Swift and CaptchaAI API
Complete guide to solving re CAPTCHA, Turnstile, and image CAPTCHAs in Swift using Captcha AI's HTTP API with URLSession, async/await, and Alamofire.

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

Automation reCAPTCHA v2 Cloudflare Turnstile
Apr 05, 2026
Getting Started Migrate from CapMonster Cloud to CaptchaAI
Step-by-step guide to migrate from Cap Monster Cloud to Captcha AI — endpoint mapping, parameter changes, and code migration examples.

Step-by-step guide to migrate from Cap Monster Cloud to Captcha AI — endpoint mapping, parameter changes, and...

Python reCAPTCHA v2 Cloudflare Turnstile
Mar 29, 2026
Getting Started CaptchaAI API Key Setup and Authentication
How to get your Captcha AI API key, authenticate requests, check your balance, and secure your credentials.

How to get your Captcha AI API key, authenticate requests, check your balance, and secure your credentials.

Automation reCAPTCHA v2
Jan 27, 2026
Getting Started CaptchaAI Quickstart: Your First Solve in 5 Minutes
Go from zero to a solved CAPTCHA in under 5 minutes.

Go from zero to a solved CAPTCHA in under 5 minutes. Get your Captcha AI API key, send your first request, and...

Automation Cloudflare Turnstile
Jan 27, 2026