Tutorials

Debugging CAPTCHA API Calls with Charles Proxy

When your CAPTCHA integration returns unexpected errors, inspecting the raw HTTP traffic reveals what's really being sent and received. Charles Proxy sits between your code and CaptchaAI, letting you see every request, response, and timing detail.


Setup

1. Install Charles Proxy

Download from charlesproxy.com. Available on Windows, macOS, and Linux.

2. Enable SSL proxying

CaptchaAI uses HTTPS. To inspect encrypted traffic:

  1. ProxySSL Proxying SettingsAdd
  2. Host: ocr.captchaai.com, Port: 443
  3. HelpSSL ProxyingInstall Charles Root Certificate
  4. Trust the certificate in your OS certificate store

3. Configure your code to use Charles

Charles runs on localhost:8888 by default.

Python:

import requests

proxies = {
    "http": "http://localhost:8888",
    "https": "http://localhost:8888",
}

# Disable SSL verification for Charles (development only)
resp = requests.post(
    "https://ocr.captchaai.com/in.php",
    data={"key": "YOUR_API_KEY", "method": "userrecaptcha", "json": "1"},
    proxies=proxies,
    verify=False,
)

Node.js:

const axios = require('axios');
const HttpsProxyAgent = require('https-proxy-agent');

const agent = new HttpsProxyAgent('http://localhost:8888');

const resp = await axios.post('https://ocr.captchaai.com/in.php', null, {
  params: { key: 'YOUR_API_KEY', method: 'userrecaptcha', json: 1 },
  httpsAgent: agent,
});

What to inspect

Submit request (POST /in.php)

In Charles, click the request to /in.php. Check:

Tab What to verify
Request → Headers Content-Type is correct
Request → Body All required parameters present
Response → Body {"status":1,"request":"TASK_ID"} on success
Timing Request duration (should be <1s)

Common problems visible in Charles:

  • Missing method parameterERROR_BAD_PARAMETERS
  • Wrong Content-Type → Parameters not parsed
  • Empty googlekeyERROR_WRONG_GOOGLEKEY
  • Malformed JSON body → Use form data, not JSON body

Poll request (GET /res.php)

Check the poll requests:

  • Params: key, action=get, id=TASK_ID
  • Response: CAPCHA_NOT_READY (keep polling) or {"status":1,"request":"TOKEN"}
  • Timing: Each poll followed by your sleep interval

Debugging common issues

Issue: ERROR_WRONG_GOOGLEKEY

In Charles, look at the submit request body. Find the googlekey field:

# What Charles shows:
key=YOUR_API_KEY&method=userrecaptcha&googlekey=&pageurl=https://example.com&json=1
                                      ^^^^^^^^ empty!

Fix: The sitekey extraction failed upstream. Check your extraction code.

Issue: Token rejected by target site

Compare what CaptchaAI returned vs what you're injecting:

  1. In Charles, find the /res.php response with status: 1
  2. Copy the full token from request field
  3. Find the subsequent request to the target site
  4. Verify the token is in the form body as g-recaptcha-response

Issue: Requests timing out

Use Charles Sequence view to see timing:

POST /in.php     → 234ms ✓
GET  /res.php    → 189ms (CAPCHA_NOT_READY)
GET  /res.php    → 201ms (CAPCHA_NOT_READY)
GET  /res.php    → 195ms (CAPCHA_NOT_READY)
... 23 more ...
GET  /res.php    → 188ms (CAPCHA_NOT_READY)  ← never resolves

If it never resolves: check if the sitekey and page URL are correct.


Charles features for CAPTCHA debugging

Repeat request

Right-click any request → Repeat to re-send it. Useful for testing poll requests without re-running your entire script.

Breakpoints

Set a breakpoint on /in.php to inspect and modify the request before it's sent:

  1. ProxyBreakpoint SettingsAdd
  2. Host: ocr.captchaai.com, Path: /in.php
  3. Check Request
  4. Now your code pauses before sending — you can edit parameters

Map Local

Replace API responses with local files for testing:

  1. ToolsMap LocalAdd
  2. Map https://ocr.captchaai.com/res.php to a local JSON file
  3. Create mock_response.json:
{"status": 1, "request": "mock_token_for_testing"}

This lets you test your token injection code without using API credits.

Throttle

Simulate slow connections:

  1. ProxyThrottle Settings → Enable
  2. Set preset to 3G or EDGE-level speeds
  3. Test if your code handles slow responses and timeouts correctly

Alternatives to Charles

Tool Platform HTTPS Cost
Charles Proxy Win/Mac/Linux Requires cert install Paid (free trial)
mitmproxy Win/Mac/Linux Requires cert install Free
Fiddler Windows Built-in HTTPS decryption Free
Proxyman macOS One-click HTTPS setup Freemium

mitmproxy quick setup

# Install
pip install mitmproxy

# Run
mitmproxy --listen-port 8080

# Configure Python
proxies = {"https": "http://localhost:8080"}

Troubleshooting

Problem Cause Fix
SSL errors in code Charles cert not trusted Install Charles root cert; use verify=False for dev
No requests visible Code not using proxy Set proxy in requests/axios config
Garbled HTTPS response SSL proxying not enabled Add ocr.captchaai.com to SSL Proxying Settings
Charles slows requests Breakpoints enabled Disable breakpoints when not needed

FAQ

Should I use Charles in production?

No. Charles is a development and debugging tool. Use structured logging and monitoring for production observability.

Does routing through Charles affect CAPTCHA solving?

No. CaptchaAI doesn't see Charles as a proxy — your requests pass through transparently.


Debug and optimize your CaptchaAI integration

Get your API key at captchaai.com.


Discussions (0)

No comments yet.

Related Posts

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
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
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
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
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
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 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 Rate Limiting CAPTCHA Solving Workflows
Sending too many requests too fast triggers blocks, bans, and wasted CAPTCHA solves.

Sending too many requests too fast triggers blocks, bans, and wasted CAPTCHA solves. Smart rate limiting keeps...

Automation Python Web Scraping
Apr 04, 2026
Tutorials Extracting reCAPTCHA Parameters from Page Source
Extract re CAPTCHA parameters from any web page — sitekey, action, data-s, enterprise flag, and version — using regex, DOM queries, and network interception.

Extract all re CAPTCHA parameters from any web page — sitekey, action, data-s, enterprise flag, and version —...

Python reCAPTCHA v2 Web Scraping
Apr 07, 2026
Tutorials Handling Multiple CAPTCHAs on a Single Page
how to detect and solve multiple CAPTCHAs on a single web page using Captcha AI.

Learn how to detect and solve multiple CAPTCHAs on a single web page using Captcha AI. Covers multi-iframe ext...

Python reCAPTCHA v2 Cloudflare Turnstile
Apr 09, 2026