Skip to content

Image to Text

Read the CAPTCHA image into text your form can use. Save the CAPTCHA image associated with your current form session, then send its original bytes as base64. The result is the recognized text.

POST /createTask · example
{
  "clientKey": "capzy_YOUR_API_KEY",
  "task": {
    "type": "ImageToTextTask",
    "body": "/9j/4AAQSkZJRgABAQ..."
  }
}

Illustrative values. Replace the inputs with values from your current integration.

Base64 CAPTCHA imageDirect task integrationRecognized text

Encode the CAPTCHA image.

Save the CAPTCHA image associated with your current form session, then send its original bytes as base64. The result is the recognized text.

Your API key authenticates Capzy.
Provider keys, challenge IDs, images, and session values belong inside task.

Use the original image response.

  1. In Network, select the current CAPTCHA image and save its response bytes to a file. Retain the form cookies and challenge identifier.
  2. Base64-encode the saved bytes into body. Send the string rather than a file path or the bytes of a webpage.
  3. Replace captcha.png below with the image you actually downloaded for this attempt.
Input collection example - replace illustrative values
import base64
from pathlib import Path

def image_bytes(filename):
    return base64.b64encode(Path(filename).read_bytes()).decode("ascii")

task_inputs = {"body": image_bytes("captcha.png")}

A refreshed form may issue a new image. Submit the answer to the challenge that supplied these bytes.

How Image to Text works

A generic OCR task for solving text-based captchas. Send a base64-encoded image containing distorted text, and we return the recognized text using our ML OCR pipeline.

Capzy's proprietary OCR transcribes the text from the image. Designed for accessibility tooling, archival document processing, and authorized automation workflows.

  • Works on any text-based captcha
  • Capzy proprietary OCR models
  • Supports distorted/noisy text
  • < 1 second solve time

Know what goes in.

Choose a field to see its purpose, where to get it, and its place in the request. Optional values omitted from the example can be added when your flow uses them.

The request below follows your selected task configuration.

Request authentication

Required task inputs

Optional context

body

stringRequired

Base64-encoded image (PNG, JPG, GIF, BMP)

Where it comes from

Save the original CAPTCHA image bytes from the current challenge and base64-encode them. Send the encoded bytes, not a local path.

Open the input guide
Example value/9j/4AAQSkZJRgABAQ...
POST /createTask · selected configuration
{
  "clientKey": "capzy_YOUR_API_KEY",
  "task": {
    "type": "ImageToTextTask",
    "body": "/9j/4AAQSkZJRgABAQ..."
  }
}

The selected field is highlighted when present. Preserve the declared value type and current challenge context.

Make your first request.

Create the task, keep its taskId, and poll until status is ready. Then read the selected variant's solution.

More examples
  1. Create the task

    Send clientKey and the selected task to /createTask from your server. Keep the returned taskId.

  2. Wait for the solution

    Send that same key and ID to /getTaskResult. While processing, wait two seconds before checking again. Stop on Ready or an error.

  3. Apply the result

    Read solution.text and submit that exact answer in the original form's CAPTCHA field alongside its remaining fields and current session cookies.

solve_image_to_text.py
import json, os, time
import requests

API = "https://api.capzy.ai"
KEY = os.environ["CAPZY_API_KEY"]
task = json.loads("{\"type\":\"ImageToTextTask\",\"body\":\"/9j/4AAQSkZJRgABAQ...\"}")

def call(path, payload):
    response = requests.post(f"{API}/{path}", json={"clientKey": KEY, **payload}, timeout=30)
    response.raise_for_status()
    data = response.json()
    if data.get("errorId", 0) or data.get("status") == "failed":
        raise RuntimeError(data.get("errorDescription") or data.get("errorCode") or "Task failed")
    return data

created = call("createTask", {"task": task})
for attempt in range(60):
    result = call("getTaskResult", {"taskId": created["taskId"]})
    if result.get("status") == "ready":
        solution = result["solution"]
        print(solution)
        break
    time.sleep(2)
else:
    raise TimeoutError("Task is still processing; keep the taskId to check it later.")

Before runningReplace all illustrative inputs with your captured values. Set CAPZY_API_KEY in your environment. Install requests with pip install requests.

Polling and failuresThe example checks HTTP/API failures, uses 30-second request timeouts, and stops after 60 result checks. Retain taskId if your task is still processing.

Understand what comes back.

Follow this task from creation to completion. Response fields and usage follow your selected request variant.

Recognized text

Read solution.text and submit that exact answer in the original form's CAPTCHA field alongside its remaining fields and current session cookies.

string
The recognized text from the image
POST /getTaskResult · example response
{
  "errorId": 0,
  "status": "ready",
  "solution": {
    "text": "K7m9Qx"
  }
}

Illustrative values. Additional metadata may be returned; only Ready contains a completed solution.

Use the result

Read solution.text and submit that exact answer in the original form's CAPTCHA field alongside its remaining fields and current session cookies.

Execution context result is the parsed Ready response from the polling example. session, when referenced, is your existing requests.Session (or browser-compatible session) with the original cookie jar, headers, and solving proxy configured in session.proxies for both http and https. Keep this client for the complete flow. task is the task object you submitted. For Shape, action_body is the original protected request body as bytes or a string, with its original Content-Type in session.headers. Install curl_cffi when the fragment imports it; match the target's required browser/TLS identity.

Use the result · Python

# Step 3: Image-to-text / math — submit the recognized text as the captcha answer
answer = result["solution"]["text"]
requests.post("https://target.example.com/login", data={"username": "...", "captcha": answer})

When something doesn't work.

Check your captured values, the selected variant, and the response before starting another task.

What image formats are supported?

PNG, JPG, GIF, and BMP. Max 600KB, 1000px per side.

Can this solve reCAPTCHA images?

No. For reCAPTCHA image grids, use ReCaptchaV2ImageTask instead. ImageToTextTask is for simple text captchas.

Connect Image to Text to your workflow.

Get your Capzy API key and use this guide's integration.

$0.80Per 1,000 solves
1.1sAverage solve time

ImageToTextTask · Live configuration