Explainers

Architecture of a CAPTCHA Solving API: How CaptchaAI Works

A CAPTCHA solving API takes an impossible-to-automate challenge and returns the solution through simple HTTP calls. But between your POST to /in.php and the result from /res.php, there is an entire distributed system handling routing, solving, and delivery. Understanding this architecture helps you build more efficient integrations.


The request lifecycle

Every CAPTCHA solve follows this path:

Your code → Submit (in.php) → Queue → Router → Solver → Result store → Poll (res.php) → Your code

Each stage has specific responsibilities.


Stage 1: Task submission

You send a POST request to https://ocr.captchaai.com/in.php with your API key and CAPTCHA parameters.

What happens:

  1. Authentication — API key validated, balance checked
  2. Parameter validation — Required fields verified for the method type
  3. Rate check — Request rate and concurrent task limits checked
  4. Task creation — A unique task ID is generated
  5. Response — Task ID returned immediately
{"status": 1, "request": "12345678"}

This returns in milliseconds — no solving happens yet. Your task is now in the queue.


Stage 2: Task routing

The router examines the task and directs it to the appropriate solver pool.

Decision factor Routes to
Method type reCAPTCHA pool, Turnstile pool, OCR pool, etc.
Complexity Standard workers or specialized workers
Proxy requirements Workers with proxy support
Current load Least-loaded worker group

Different CAPTCHA types require fundamentally different solving infrastructure:

  • Token CAPTCHAs (reCAPTCHA, Turnstile) → Browser-based workers that simulate human interaction
  • Image/OCR CAPTCHAs → ML models for character recognition
  • Grid image CAPTCHAs → Computer vision models for object detection
  • Challenge CAPTCHAs (Cloudflare) → Full browser environments with proxy support

Stage 3: Solving

The solving stage is where the actual CAPTCHA is processed. This is the time-consuming part.

For token CAPTCHAs (reCAPTCHA, Turnstile):

  1. A browser environment loads the target page (or simulates the context)
  2. The CAPTCHA widget is rendered
  3. Browser automation solves the challenge (selects images, passes behavioral checks)
  4. The resulting token is captured

For image/OCR CAPTCHAs:

  1. The image is preprocessed (noise removal, normalization)
  2. ML models analyze the image
  3. Characters/objects are identified
  4. The text answer or grid selections are generated

For Cloudflare Challenge:

  1. A browser with the specified proxy and User-Agent loads the page
  2. Cloudflare's JavaScript challenges are executed
  3. Browser checks pass (canvas, WebGL, etc.)
  4. The cf_clearance cookie is captured

Stage 4: Result storage and delivery

Once solved, the result is stored and made available for polling.

Polling (default):

Your code calls GET /res.php to check if the task is complete:

CAPCHA_NOT_READY → Wait → Poll again

When ready:

{"status": 1, "request": "SOLVED_TOKEN_abc123"}

Callback/webhook (alternative):

Instead of polling, you can provide a pingback URL when submitting. CaptchaAI sends the result directly to your endpoint when the solve is complete — no polling needed.


System architecture diagram

┌─────────────┐
│  Your Code  │
└──────┬──────┘
       │ POST /in.php
       ▼
┌─────────────┐     ┌──────────────┐
│   API Gate  │────▶│  Task Queue  │
│ (auth, rate │     └──────┬───────┘
│  limiting)  │            │
└─────────────┘            ▼
                    ┌──────────────┐
                    │   Router     │
                    └──┬───┬───┬──┘
                       │   │   │
              ┌────────┘   │   └────────┐
              ▼            ▼            ▼
        ┌──────────┐ ┌──────────┐ ┌──────────┐
        │ reCAPTCHA│ │ Turnstile│ │ OCR/Image│
        │ Workers  │ │ Workers  │ │ Workers  │
        └────┬─────┘ └────┬─────┘ └────┬─────┘
             │             │             │
             └──────┬──────┘─────────────┘
                    ▼
             ┌─────────────┐
             │ Result Store│
             └──────┬──────┘
                    │ GET /res.php
                    ▼
             ┌─────────────┐
             │  Your Code  │
             └─────────────┘

Performance characteristics

Metric Typical value
Submit latency < 100ms
Poll latency < 100ms
reCAPTCHA v2 solve 10–30 seconds
reCAPTCHA v3 solve 8–20 seconds
Turnstile solve 5–15 seconds
Cloudflare Challenge 15–30 seconds
Image/OCR solve 2–5 seconds
Grid image solve 5–10 seconds

How this affects your integration

Understanding the architecture explains common integration patterns:

Pattern Architecture reason
Poll every 5 seconds Results are stored; polling faster wastes API calls
Initial wait before first poll Solving takes time; first poll before 5–10s always returns NOT_READY
Use callbacks for high volume Eliminates polling overhead; results pushed to you
Handle ERROR_NO_SLOT_AVAILABLE Queue has capacity limits; back off and retry
Separate submit and poll concerns Submit is async; result delivery is independent

FAQ

Why is there a delay between submit and result?

CAPTCHA solving requires browser simulation, image analysis, or behavioral verification — real computations that take time. The async submit/poll pattern lets your code continue working while the solve happens.

Can I get results faster?

Some things help: use the correct CAPTCHA type (wrong types waste time), provide accurate parameters (wrong sitekey causes retries), and use pingback to avoid polling latency.

What happens if a solver fails?

Failed tasks are automatically retried internally. If the task cannot be solved after retries, an error is returned (e.g., ERROR_CAPTCHA_UNSOLVABLE).

How does CaptchaAI scale?

Worker pools scale independently by CAPTCHA type. More reCAPTCHA demand adds reCAPTCHA workers. Image/OCR demand adds OCR capacity. This allows efficient resource allocation.


Start solving CAPTCHAs with CaptchaAI

Build on a production-grade CAPTCHA solving infrastructure at captchaai.com.


Discussions (0)

No comments yet.

Related Posts

Integrations Axios + CaptchaAI: Solve CAPTCHAs Without a Browser
Use Axios and Captcha AI to solve re CAPTCHA, Turnstile, and image CAPTCHAs in Node.js without launching a browser.

Use Axios and Captcha AI to solve re CAPTCHA, Turnstile, and image CAPTCHAs in Node.js without launching a bro...

Automation All CAPTCHA Types
Apr 08, 2026
DevOps & Scaling Blue-Green Deployment for CAPTCHA Solving Infrastructure
Implement blue-green deployments for CAPTCHA solving infrastructure — zero-downtime upgrades, traffic switching, and rollback strategies with Captcha AI.

Implement blue-green deployments for CAPTCHA solving infrastructure — zero-downtime upgrades, traffic switchin...

Automation Python All CAPTCHA Types
Apr 07, 2026
Reference CAPTCHA Solving Performance by Region: Latency Analysis
Analyze how geographic region affects Captcha AI solve times — network latency, proxy location, and optimization strategies for global deployments.

Analyze how geographic region affects Captcha AI solve times — network latency, proxy location, and optimizati...

Automation Python All CAPTCHA Types
Apr 05, 2026
Tutorials Streaming Batch Results: Processing CAPTCHA Solutions as They Arrive
Process CAPTCHA solutions the moment they arrive instead of waiting for tasks to complete — use async generators, event emitters, and callback patterns for stre...

Process CAPTCHA solutions the moment they arrive instead of waiting for all tasks to complete — use async gene...

Automation Python All CAPTCHA Types
Apr 07, 2026
DevOps & Scaling Ansible Playbooks for CaptchaAI Worker Deployment
Deploy and manage Captcha AI workers with Ansible — playbooks for provisioning, configuration, rolling updates, and health checks across your server fleet.

Deploy and manage Captcha AI workers with Ansible — playbooks for provisioning, configuration, rolling updates...

Automation Python All CAPTCHA Types
Apr 07, 2026
Tutorials Bulkhead Pattern: Isolating CAPTCHA Solving Failures
Apply the bulkhead pattern to isolate CAPTCHA solving failures — partition resources into independent pools so a slow or failing solver type doesn't starve othe...

Apply the bulkhead pattern to isolate CAPTCHA solving failures — partition resources into independent pools so...

Automation Python All CAPTCHA Types
Apr 07, 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
Tutorials CaptchaAI Webhook Security: Validating Callback Signatures
Secure your Captcha AI callback/pingback endpoints — validate request origins, implement HMAC signatures, and protect against replay attacks.

Secure your Captcha AI callback/pingback endpoints — validate request origins, implement HMAC signatures, and...

Automation Python All CAPTCHA Types
Feb 15, 2026
Tutorials Discord Webhook Alerts for CAPTCHA Pipeline Status
Send CAPTCHA pipeline alerts to Discord — webhook integration for balance warnings, error spikes, queue status, and daily summary reports with Captcha AI.

Send CAPTCHA pipeline alerts to Discord — webhook integration for balance warnings, error spikes, queue status...

Automation Python All CAPTCHA Types
Tutorials Profiling CAPTCHA Solving Bottlenecks in Python Applications
Profile Python CAPTCHA solving scripts to identify bottlenecks — timing breakdowns, c Profile, line_profiler, and async profiling for Captcha AI integrations.

Profile Python CAPTCHA solving scripts to identify bottlenecks — timing breakdowns, c Profile, line_profiler,...

Automation Python All CAPTCHA Types
Apr 04, 2026
Explainers reCAPTCHA v2 Invisible: Trigger Detection and Solving
Detect and solve re CAPTCHA v 2 Invisible challenges with Captcha AI — identify triggers, extract parameters, and handle auto-invoked CAPTCHAs.

Detect and solve re CAPTCHA v 2 Invisible challenges with Captcha AI — identify triggers, extract parameters,...

Automation Python reCAPTCHA v2
Apr 07, 2026
Explainers How BLS CAPTCHA Works: Grid Logic and Image Selection
Deep dive into BLS CAPTCHA grid logic — how images are arranged, how instructions map to selections, and how Captcha AI processes BLS challenges.

Deep dive into BLS CAPTCHA grid logic — how images are arranged, how instructions map to selections, and how C...

Automation BLS CAPTCHA
Apr 09, 2026
Explainers How reCAPTCHA Token Lifecycle Works: Expiration, Renewal, Validation
Understand the full re CAPTCHA token lifecycle: generation, expiration windows, server validation, and renewal strategies.

Understand the full re CAPTCHA token lifecycle: generation, expiration windows, server validation, and renewal...

Automation reCAPTCHA v2
Feb 23, 2026