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 on this image set and enter its number" are not supported.

Task object

Property Type Required Default value Purpose
type String Yes ImageToTextTask Defines a type of the 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 worker to enter an answer with at least one "space". If there's no space, they will skip the task, so use it with caution.
case Boolean No true false - no requirements
true - worker will see a special mark telling that answer must be entered with case sensitivity.
numeric Integer No 0 0 - no requirements
1 - only number are allowed
2 - any letters are allowed except numbers
math Boolean No false 0 - no requirements
1 - only number are allowed
2 - any letters are allowed except numbers
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 comment for workers like "enter letters in red color".
Result is not guaranteed and is totally up to a worker.
websiteURL String No Optional parameter to distinguish source of image captchas in spending statistics.

Request example

CURL
          curl -i -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -X POST -d '{
    "clientKey":"YOUR_API_KEY",
    "task":
        {
            "type":"ImageToTextTask",
            "body":"BASE64_BODY_HERE__NO_NEWLINES__NO_EXTRA_TAGS__ONLY_CLEAN_BASE64",
            "phrase":false,
            "case":false,
            "numeric":0,
            "math":false,
            "minLength":0,
            "maxLength":0
        }
}' https://api.anti-captcha.com/createTask
        

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 a worker some time, like 5 seconds, before making 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 of captcha where we'll store it for the next 24 hours. It is removed afterwards.

Response example

JSON with no errors
          {
    "errorId":0,
    "status":"ready",
    "solution":
    {
        "text":"deditur",
        "url":"http://61.39.233.233/1/147220556452507.jpg"
    },
    "cost":"0.000700",
    "ip":"46.98.54.221",
    "createTime":1472205564,
    "endTime":1472205570,
    "solveCount":"0"
}