Skip to main content
This article will introduce a Recaptcha2 protocol recognition API integration instruction, which allows users to bypass the recognition and clicking of Recaptcha2 verification images, achieving automatic decoding in the background by simply submitting the Website Key.

Application Process

To use the Recaptcha2 protocol recognition API, first go to the Ace Data Cloud Console to obtain your API Token for future use. If you are not logged in or registered, you will be automatically redirected to the login page inviting you to register and log in, and after completion, you will be automatically returned to the current page. One API Token can call all services on the platform without needing to apply separately for each service. The first application will grant a free quota for a trial experience; when the quota is insufficient, you can recharge the general balance in the console.
📘 Complete Documentation: Recaptcha2 Protocol Recognition API →

Basic Usage

First, understand the basic usage method, which is to input the URL of the website needing to process the verification code to obtain the processed result. You first need to simply pass a website_url field. Our example website is: https://www.google.com/recaptcha/api2/demo, and we need to obtain the website_key from the website_url page. First, open this webpage, press F12 to enter the console, and then perform a global search for recaptcha-demo in the Element page, and we can get the following result:

The string corresponding to data-sitekey is the value of the website_key. Below are the specific parameter results:

Here we can see that we have set the Request Headers, including:
  • accept: the format of the response result you want to receive, filled in as application/json, which is in JSON format.
  • authorization: the key for calling the API, which can be directly selected after application.
Additionally, the Request Body is set, including:
  • website_url: the URL of the website needing to process the verification code.
  • website_key: the website key identifier in Recaptcha2.
After selection, you can find that the corresponding code is also generated on the right side, as shown in the figure:

Click the “Try” button to conduct a test, as shown in the above figure, and we have obtained the following result:
The return result has multiple fields, described as follows:
  • token, the verification result after processing the Recaptcha2 captcha task.
As we can see, we have obtained the verification result for processing the Recaptcha2 captcha, which we can use for POST or simulate submission to the target website, for one-time use, valid for 120 seconds, and it is recommended to use it within 60 seconds. Next, a Python version will be provided to submit the processed token to the target website to pass the Recaptcha2 captcha. First, we need to find out how the website sends the POST request so that we can pass the generated token into it. We need to open the F12 console first, then manually go through the verification, and finally, we can see that the website sent a POST request. We only need to check the construction of this POST request, and the specific process is as follows:
  • First, manually go through the verification, as shown in the figure below:

  • Then click submit, watch the changes in the console’s network, as shown in the figure below:

  • Analyze the construction of the submitted POST request, and finally, right-click the request to copy the CURL code, as shown in the figure below:

From the analysis of the above image, the URL for this POST request is: https://www.google.com/recaptcha/api2/demo, we only need to submit the parameter g-recaptcha-response, then we just need to pass the processed token into the data below, the specific CURL code for calling the token for verification is as follows:
The corresponding Python code for calling the token verification is as follows:
Then we run the code and observe that the console shows the following result:

Finally, we have passed the Recaptcha2 verification protocol. Additionally, if you want to generate the corresponding integration code, you can directly copy it, for example, the CURL code is as follows:
The Python integration code is as follows:

Asynchronous Mode (async)

By default, the API is synchronous and blocking: a request will wait until the token processing is complete before returning. If you are doing multi-solver rotation and want to “immediately get the task_id after submitting the task, schedule other solvers, and come back later to get the result,” you can pass async: true in the request body. After passing async: true, the interface will immediately return a task_id without blocking:
Then use the task_id to poll POST /captcha/tasks (recommended every 3-5 seconds) to get the result:
During processing, it will return status: processing:
When processing is complete, it will return status: ready and the token:
Billing explanation: In asynchronous mode, creating tasks and polling “processing” do not incur charges; only when successfully obtaining results is there a one-time charge (consistent with the price of synchronous mode). Therefore, canceling unfinished tasks during rotation will not incur costs. /captcha/tasks is universal for all captcha interfaces (token and recognition series), and you can poll with the same task_id.

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

Conclusion

Through this document, you have learned how to use the Recaptcha2 protocol recognition API to allow users to bypass recognizing and clicking on Recaptcha2 captcha images, achieving backend automatic decoding by simply submitting the Website Key. We hope this document helps you better integrate and use this API. If you have any questions, please feel free to contact our technical support team.