Skip to main content
This document will introduce a Digital English Captcha Recognition API integration guide, which is based on deep learning technology and can be used to recognize variable-length English numeric captchas. Input the content of the captcha image and output the captcha result.

Application Process

To use the API, you need to first apply for the corresponding service on the Digital English Captcha Recognition API page. After entering the page, click the “Acquire” button, as shown in the image: If you are not logged in or registered, you will be automatically redirected to the login page inviting you to register and log in. After logging in or registering, you will automatically return to the current page. Upon your first application, there will be a free quota available for you to use the API for free.

Basic Usage

First, understand the basic usage method, which is to input the variable-length English numeric captcha image that needs to be processed to obtain the processed result. You need to simply pass a image field, which is the specific English numeric captcha image, as shown in the image:

Then, we need to convert the captcha image to a Base64 encoded captcha image. It is recommended to use the Google Chrome extension FeHelper for the conversion. The specific usage method can be referenced in the following images:

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

Here we can see that we have set the Request Headers, including:
  • accept: the format of the response result you want to receive, here filled in as application/json, which is JSON format.
  • authorization: the key to call the API, which can be directly selected after application.
Additionally, we set the Request Body, including:
  • image: the Base64 encoded captcha image (without the prefix data:image/png;base64).
After selection, you can find that the corresponding code is also generated on the right side, as shown in the image:

Click the “Try” button to test, as shown in the image above, and we obtained the following result:
{
  "text": "7364"
}
The returned result contains multiple fields, described as follows:
  • text: the text content after processing the variable-length English numeric captcha image task.
We can see that we have obtained the verification result for processing the variable-length English numeric captcha image, and we only need to verify based on the text content in the text result. Additionally, if you want to generate the corresponding integration code, you can directly copy the generated code, 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)

Error Handling

When calling the API, if an error occurs, the API will return 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 Digital English Captcha Recognition API to recognize variable-length English numeric captchas. Input the content of the captcha image and output the captcha result. We hope this document can help you better integrate and use the API. If you have any questions, please feel free to contact our technical support team.