Documentation menu

ImageToTextTask : solve an image captcha

Post an image body and receive text from it. Text can only contain digits, letters, special characters and a space. GIF animations are supported, up to 500kb. Custom captchas like "find a cat in this series of images and enter its number" are not supported.

Task object

Property Type Required Default value Purpose
type String Yes ImageToTextTask Defines the type of task.
body String Yes File body encoded in base64. Make sure to send it without line breaks. Do not include 'data:image/png,' or similar tags, only clean base64!
phrase Boolean No false false - no requirements
true - requires workers to enter an answer with at least one "space". If there are no spaces, they will skip the task, so use it with caution.
case Boolean No true false - no requirements
true - workers see a special mark indicating that the answer must be entered with case sensitivity.
numeric Integer No 0 0 - no requirements
1 - only numbers are allowed
2 - any letters are allowed except numbers
math Boolean No false false - no requirements
true - workers see a special mark telling them the answer must be calculated
minLength Integer No 0 0 - no requirements
>1 - defines minimum length of the answer
maxLength Integer No 0 0 - no requirements
>1 - defines maximum length of the answer
comment String No Additional comments for workers like "enter red text".
The result is not guaranteed and is totally up to the worker.
websiteURL String No Optional parameter to distinguish source of image captchas in spending statistics.

Request example

          curl -i -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -X POST -d '{

//git clone


$api = new ImageToText();

//your account key

//setting file

//create task in API
if (!$api->createTask()) {
    echo "API v2 send failed - ".$api->getErrorMessage()."\n";

$taskId = $api->getTaskId();

if (!$api->waitForResult()) {
    echo "could not solve captcha\n";
    echo $api->getErrorMessage()."\n";
} else {
    $captchaText    =   $api->getTaskSolution();
    echo "captcha text: $captchaText\n\n";
          #pip3 install anticaptchaofficial

from anticaptchaofficial.imagecaptcha import *

solver = imagecaptcha()

captcha_text = solver.solve_and_return_solution("captcha.jpeg")
if captcha_text != 0:
    print "captcha text "+captcha_text
    print "task finished with error "+solver.error_code
          //npm -i @antiadmin/anticaptchaofficial

const ac = require("@antiadmin/anticaptchaofficial");
const fs = require('fs');

const captcha = fs.readFileSync('captcha.png', { encoding: 'base64' });

ac.solveImage(captcha, true)
    .then(text => console.log('captcha text: '+text))
    .catch(error => console.log('test received error '+error));
          //git clone

using System;
using Anticaptcha_example.Api;
using Anticaptcha_example.Helper;
using Newtonsoft.Json.Linq;

namespace Anticaptcha_example
    internal class Program
        private static void Main() {

            DebugHelper.VerboseMode = true;

            var api = new ImageToText
                ClientKey = "YOUR_API_KEY_HERE",
                FilePath = "captcha.jpg"

            if (!api.CreateTask())
                DebugHelper.Out("API v2 send failed. " + api.ErrorMessage, DebugHelper.Type.Error);
            else if (!api.WaitForResult())
                DebugHelper.Out("Could not solve the captcha.", DebugHelper.Type.Error);
                DebugHelper.Out("Result: " + api.GetTaskSolution().Text, DebugHelper.Type.Success);


          //git clone

package com.anti_captcha;

import com.anti_captcha.Api.ImageToText;
import com.anti_captcha.Helper.DebugHelper;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.Iterator;
import java.util.concurrent.ThreadLocalRandom;

public class Main {

    public static void main(String[] args) throws InterruptedException, MalformedURLException, JSONException {

        ImageToText api = new ImageToText();

        if (!api.createTask()) {
                    "API v2 send failed. " + api.getErrorMessage(),
        } else if (!api.waitForResult()) {
            DebugHelper.out("Could not solve the captcha.", DebugHelper.Type.ERROR);
        } else {
            DebugHelper.out("Result: " + api.getTaskSolution().getText(), DebugHelper.Type.SUCCESS);


Response example

JSON with no errors
    "errorId": 0,
    "taskId": 7654321
JSON with an error
    "errorId": 1,
    "errorCode": "ERROR_KEY_DOES_NOT_EXIST",
    "errorDescription": "Account authorization key not found in the system"

Retrieve the solution

Use method getTaskResult to request the solution. Give the worker about 5 seconds before making your first request. If the worker is still busy, retry in 3 seconds.

Task solution object

Property Type Purpose
text String Text from image captcha
url String Web address where we'll store the captcha for the next 24 hours, after which it will be removed.

Response example

JSON with no errors