Alphanumeric CAPTCHA Recognition API Integration Guide

This article introduces an alphanumeric CAPTCHA recognition API integration guide. It is based on deep learning technology and can be used to recognize variable-length alphanumeric CAPTCHAs. Input the CAPTCHA image content, and output the CAPTCHA result.

Application Process

To use the alphanumeric CAPTCHA recognition API, first go to the Ace Data Cloud Console to obtain your API Token for later use.

If you have not logged in or registered, you will be automatically redirected to the login page to register and log in. Once complete, you will be automatically returned to the current page.

A general application's API Key can be used for services enabled for the account; a dedicated application's Key can be used within that application's service scope. Please check the Key's permissions, validity period, and limits, and confirm that the application balance is sufficient to pay for this request. Available trial credits are subject to what is displayed in the account. If the balance is insufficient, click the "Recharge" button.

📘 Full documentation: Alphanumeric CAPTCHA Recognition API →

Basic Usage

First, let's look at the basic usage: input the variable-length alphanumeric CAPTCHA image to be processed, and you can obtain the processed result. First, simply pass an image field, which is the actual alphanumeric CAPTCHA image, as shown below:

Then we need to convert the CAPTCHA image into a Base64-encoded CAPTCHA image. For Base64 encoding, we recommend using the Google Chrome extension FeHelper. For specific usage, refer to the images below:

After that, you can copy the Base64 encoding obtained from the Google Chrome extension FeHelp. Remember not to include the data:image/png;base64 prefix. The specific content is as follows:

You can see that we have set the Request Headers here, including:

  • accept: The format in which you want to receive the response. Here it is set to application/json, meaning JSON format.
  • authorization: The key for calling the API. After applying, you can select it directly from the dropdown.

We have also set the Request Body, including:

  • image: The Base64-encoded CAPTCHA image (without the data:image/png;base64 prefix).

After making the selection, you can see that the corresponding code has also been generated on the right, as shown below:

Click the "Try" button to test. As shown above, we obtained the following result here:

{
  "text": "7364",
  "elapsed": 31.6
}

The returned result contains multiple fields, described as follows:

  • text: The text content after processing this variable-length alphanumeric CAPTCHA image task.
  • started_at, finished_at: The times when this request began processing and produced a result, as Unix timestamps (seconds, floating-point).
  • elapsed: The total time taken for this processing (seconds).

You can see that we obtained the verification result from processing the variable-length alphanumeric CAPTCHA image. We only need to use the text content in text from the result to pass verification.

Also, if you want to generate the corresponding integration code, you can copy the generated code directly. For example, the CURL code is as follows:

curl -X POST 'https://api.acedata.cloud/captcha/recognition/image2text' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "image": "iVBORw0KGgoAAAANSUhEUgAAAgUAAAE3CAYAAAA6xjI2AAAAAX..."
}'

The Python integration code is as follows:

import requests

url = "https://api.acedata.cloud/captcha/recognition/image2text"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}",
    "content-type": "application/json"
}

payload = {
    "image": "iVBORw0KGgoAAAANSUhEUgAAAgUAAAE3CAYAAAA6xjI2AAAAAX..."
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)

Asynchronous Mode (async)

By default, the API is synchronous and blocking: a request waits until the recognition result has been processed before returning. If you are using multi-solver rotation and want to "receive a task_id immediately after submitting a task, schedule other solvers first, and come back to read the result later," you can pass async: true in the request body.

After passing async: true, the API immediately returns a task_id without blocking and waiting:

curl -X POST 'https://api.acedata.cloud/captcha/recognition/image2text' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "image": "iVBORw0KGgoAAAANSUhEUgAAAgUAAAE3CAYAAAA6xjI2AAAAAX...",
  "async": true
}'
{
  "task_id": "61138bb6-19aa-11ec-a9c8-0242ac110002",
  "trace_id": "2efa9340-b21b-4e26-9e14-4aac95f343ab"
}

To actively check progress, you can use the task_id to query POST /captcha/tasks (once every 3–5 seconds is recommended). This endpoint does not trigger or advance task processing; the server will continue processing even if you do not query, disconnect from the network, or exit the client:

curl -X POST 'https://api.acedata.cloud/captcha/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "task_id": "61138bb6-19aa-11ec-a9c8-0242ac110002"
}'

While processing, status: processing is returned:

{ "success": true, "task_id": "61138bb6-19aa-11ec-a9c8-0242ac110002", "status": "processing" }

Once processing is complete, status: ready and the recognition result text are returned (the field structure is exactly the same as in synchronous mode):

{
  "success": true,
  "task_id": "61138bb6-19aa-11ec-a9c8-0242ac110002",
  "status": "ready",
  "text": "7364"
}

Billing note: In asynchronous mode, creating a task and reading the "processing" status are not charged; a single charge is applied when the client first reads a successful result (consistent with existing behavior and synchronous mode pricing). The server advances the task independently, but does not charge early simply because it finishes in the background. If a task does not succeed within 120 seconds, it terminates with HTTP 504 timeout and is not charged. /captcha/tasks is not responsible for advancing the task.

Error Handling

When calling the API, if an error occurs, the API returns the corresponding error code and message. For example:

  • 400 token_mismatched: Bad request, possibly due to missing or invalid parameters.
  • 400 api_not_implemented: Bad request, possibly due to missing or invalid parameters.
  • 401 invalid_token: Unauthorized, invalid or missing authorization token.
  • 429 too_many_requests: Too many requests, you have exceeded the rate limit.
  • 500 api_error: Internal server error, something went wrong on the server.

Error Response Example

{
  "success": false,
  "error": {
    "code": "api_error",
    "message": "fetch failed"
  },
  "trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}

Conclusion

Through this document, you have learned how to use the Alphanumeric CAPTCHA Recognition API to recognize variable-length alphanumeric CAPTCHAs. Input the CAPTCHA image content, and output the CAPTCHA result. We hope this document helps you better integrate and use the API. If you have any questions, please feel free to contact our technical support team.