Skip to content

Image to text

Summary

PropertyValue
v1 typeimage.text
Compatibility namesImageToTextTask
Proxynot used
Deadline60 seconds (starting value). A task not solved by then fails with timeout and is not charged.
2captcha legacy APImethod=base64 or method=post (details)

Parameters

The params object of POST /v1/tasks. Unknown fields are rejected with 422 invalid_params.

FieldTypeDescription
image
required
string

Base64-encoded PNG, JPEG, GIF, WebP or BMP image (standard or URL-safe alphabet; a data:image/...;base64, prefix, line breaks and missing padding are accepted). At most 1,000,000 characters, 8192 pixels per side and 8,388,608 pixels in total; animated images at most 1000 frames and 8,388,608 pixels for frames x width x height; multi-picture JPEG (MPO), JPEG with more than 100 scans, malformed or truncated images are rejected.

min length 1 · max length 1,000,000
case_sensitive
optional
boolean

The answer is case-sensitive.

numeric
optional
enum

0 no requirement; 1 digits only; 2 no digits.

one of 0, 1, 2
phrase
optional
boolean

The answer contains at least one space.

math
optional
boolean

The image is an arithmetic expression; the answer is its result.

min_length
optional
integer

Minimum answer length; 0 means no limit.

≥ 0 · ≤ 100
max_length
optional
integer

Maximum answer length; 0 means no limit.

≥ 0 · ≤ 100

Solution

The solution object of a solved task.

FieldTypeDescription
text
required
string

Recognized text.

min length 1 · max length 1,024

Example: native API (v1)

Runs as is with a test key (nop_test_…) in the sandbox; use a live key for real tasks.

POST /v1/tasks
{
"type": "image.text",
"params": {
"image": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"case_sensitive": false,
"numeric": 0
}
}
Terminal window
export NOPTCHA_KEY=nop_test_... # your test or live key
# waits up to 60 s; 200 = finished (solved or failed), 202 = still processing
IDEMPOTENCY_KEY=$(uuidgen) # one key per task you want; a retry of the same request reuses it
curl -s -X POST "https://api.noptcha.com/v1/tasks" \
-H "Authorization: Bearer $NOPTCHA_KEY" \
-H 'Prefer: wait=60' \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H 'Content-Type: application/json' \
-d @- <<EOF
{
"type": "image.text",
"params": {
"image": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"case_sensitive": false,
"numeric": 0
}
}
EOF
# on 202: long-poll with the "id" from the response
TASK_ID=...
curl -s "https://api.noptcha.com/v1/tasks/$TASK_ID?wait=60" \
-H "Authorization: Bearer $NOPTCHA_KEY"

In the sandbox the task is solved at once and solution is:

{
"text": "noptcha"
}

Compatibility API

NameProxyNotes
ImageToTextTaskignored

Task fields (in task, next to type) and the v1 parameter each one becomes:

Compatibility fieldv1 parameter
bodyimage
casecase_sensitive
imageimage
mathmath
maxLengthmax_length
minLengthmin_length
numericnumeric
phrasephrase

Solution fields in getTaskResult:

Compatibility fieldv1 solution field
texttext

Example: compatibility API

POST /createTask
{
"clientKey": "nop_test_…",
"task": {
"type": "ImageToTextTask",
"body": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"case": false,
"numeric": 0
}
}
Terminal window
export NOPTCHA_KEY=nop_test_... # your test or live key
# 1. create the task
curl -s -X POST "https://api.noptcha.com/createTask" \
-H 'Content-Type: application/json' \
-d @- <<EOF
{
"clientKey": "$NOPTCHA_KEY",
"task": {
"type": "ImageToTextTask",
"body": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"case": false,
"numeric": 0
}
}
EOF
# 2. poll with the taskId from step 1 every few seconds until "status" is "ready"
TASK_ID=...
curl -s -X POST "https://api.noptcha.com/getTaskResult" \
-H 'Content-Type: application/json' \
-d @- <<EOF
{
"clientKey": "$NOPTCHA_KEY",
"taskId": $TASK_ID
}
EOF

In the sandbox getTaskResult returns "status": "ready" and solution:

{
"text": "noptcha"
}