👑 CaptchaKings
  • Home
  • Features
  • Pricing
  • Documentation
Login Sign Up

Python Captcha Solver

reCAPTCHA, hCaptcha & image captchas in Python — updated August 2026

TL;DR: For image captchas, pip install captchakings and solve in 3 lines. For reCAPTCHA/hCaptcha tokens, POST a task to api.captchakings.com/createTask and poll for the result. New accounts get 50 free solves — no credit card.

Option 1: Official Python Library (Image Captchas)

The fastest path for image captcha solving. The official package is on PyPI:

terminal
pip install captchakings
solve_image.py
from captchakings import CaptchaKings

client = CaptchaKings('your_api_key_here')
result = client.solve('captcha.jpg')
print(result)

Your API key is in Dashboard → API Keys after signing up.

Option 2: reCAPTCHA v2 with requests (Token Tasks)

reCAPTCHA v2/v3 and hCaptcha are solved as token tasks: you submit the page URL and site key, workers solve it in a real browser, and you receive a token to inject. This is the pattern used in our reCAPTCHA solver pipeline:

recaptcha_solver.py
import requests
import time

API_KEY = "your_api_key_here"

def solve_recaptcha_v2(page_url, site_key):
    # 1. Create the task
    task_data = {
        "clientKey": API_KEY,
        "task": {
            "type": "RecaptchaV2TaskProxyless",
            "websiteURL": page_url,
            "websiteKey": site_key
        }
    }
    response = requests.post("https://api.captchakings.com/createTask", json=task_data)
    task_id = response.json().get("taskId")

    # 2. Poll for the result
    while True:
        time.sleep(3)
        result = requests.post(
            "https://api.captchakings.com/getTaskResult",
            json={"clientKey": API_KEY, "taskId": task_id}
        ).json()

        if result.get("status") == "ready":
            return result["solution"]["gRecaptchaResponse"]

Option 3: Image Captchas via REST API

If you don't want the dependency, the image API is a single multipart POST. It's the same endpoint behind the pip package:

image_api.py
import requests

API_KEY = "your_api_key_here"

with open("captcha.jpg", "rb") as f:
    response = requests.post(
        "https://captchakings.com/api/process.php",
        headers={"Authorization": f"Bearer {API_KEY}"},
        files={"captcha": f}
    )

data = response.json()
if data.get("success"):
    print(data["data"]["prediction"])       # solved text
    print(data["data"]["confidence"])       # 0-100
    print(data["billing"]["balance_remaining"])
else:
    print("Error:", data["error"]["message"])

Using the Token with Selenium

Once you have the gRecaptchaResponse token, inject it into the hidden textarea and submit — the standard flow for Python captcha automation:

selenium_flow.py
from selenium import webdriver

driver = webdriver.Chrome()
driver.get("https://example.com/signup")

token = solve_recaptcha_v2(driver.current_url, "SITE_KEY_FROM_PAGE")

driver.execute_script(
    'document.getElementById("g-recaptcha-response").innerHTML = arguments[0];',
    token
)
driver.find_element("css selector", "form").submit()

High-Volume: Async with aiohttp

Solving thousands of images? Don't block on one request at a time. The image API supports concurrent requests, so async clients scale linearly:

async_bulk.py
import aiohttp
import asyncio

API_KEY = "your_api_key_here"
API_URL = "https://captchakings.com/api/process.php"

async def solve_one(session, path):
    with open(path, "rb") as f:
        form = aiohttp.FormData()
        form.add_field("captcha", f, filename=path)
        async with session.post(
            API_URL,
            headers={"Authorization": f"Bearer {API_KEY}"},
            data=form
        ) as resp:
            data = await resp.json()
            return data["data"]["prediction"] if data.get("success") else None

async def main():
    files = ["cap1.jpg", "cap2.jpg", "cap3.jpg"]
    async with aiohttp.ClientSession() as session:
        results = await asyncio.gather(*[solve_one(session, f) for f in files])
        print(results)

asyncio.run(main())

Endpoint Recap

Captcha TypeEndpointResult
Image captchacaptchakings.com/api/process.phpSolved text (synchronous)
reCAPTCHA v2/v3, hCaptchaapi.captchakings.com/createTaskToken (async, poll getTaskResult)
2Captcha-compatiblecaptchakings.com/in.php / res.phpDrop-in migration format

Best Practices

  • Poll every 3 seconds for token tasks — typical solve time is 5–20 seconds for reCAPTCHA v2.
  • Timeout at 120s and retry with a fresh task rather than polling forever.
  • Reuse one requests.Session in long-running workers to keep connections alive.
  • Check confidence on image solves; resubmit when it's below your threshold instead of accepting garbage.
  • Never hardcode the key — load it from an environment variable in production.

FAQ

Is there an official Python library?

Yes — pip install captchakings covers image captchas in 3 lines. For reCAPTCHA/hCaptcha token tasks, use the task API with requests as shown above; it takes about 15 lines.

How do I solve reCAPTCHA v2 in Python?

Send a RecaptchaV2TaskProxyless task with the page URL and site key to createTask, poll getTaskResult until status is ready, then inject the returned gRecaptchaResponse token into the form.

Does it work with Selenium / Playwright?

Yes. The API returns a token; your browser automation injects it into g-recaptcha-response and submits. The solving happens on our side, so your browser never runs the challenge.

What does it cost?

Image captchas: $0.50 per 1,000 solves, pay-as-you-go. 50 free solves on signup, no credit card. See the full price comparison against other services.

Integration Guides for Other Languages

  • Node.js Captcha Solver Guide
  • PHP Captcha Solver Guide
  • cURL / Terminal Guide
  • reCAPTCHA Solver — How It Works
  • Full API Documentation
  • Free Browser Tools (no code)

Start solving from Python today

50 free solves on signup — test with your own captchas.

Get Your API Key

👑 CaptchaKings

AI-powered captcha solving API with 95% success rate. Trusted by developers worldwide.

Compare

  • Price Comparison
  • vs 2Captcha
  • vs CapSolver
  • vs CapMonster
  • vs Anti-Captcha

Legal

  • Privacy Policy
  • Terms of Service
  • Refund Policy
  • Documentation

© 2026 CaptchaKings. All rights reserved.