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 API, you need to first apply for the corresponding service on the Recaptcha2 Protocol Recognition API page. After entering the page, click the “Acquire” button, as shown in the image below: 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 be automatically returned to the current page. There will be a free quota granted upon the first application, allowing you to use the API for free.

Basic Usage

First, understand the basic usage method, which is to input the URL of the website that needs to process the verification code to obtain the processed result. You need to simply pass a website_url field. Our example website is: https://www.google.com/recaptcha/api2/demo. 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 Elements page. 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 means 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 that needs 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 image below:

Click the “Try” button to conduct a test, as shown in the above image, and we have obtained the following result:
{
  "token": "03AFcWeA5kjJyDQ9S1a9UYimR6nuxnpEnAs5x2Pixao0dXZhMBjiR2MwAwN7K3NXik02Vl--cEmCwxDuf7mNBMbGlfLHb5948cvCdk1jnp_mjbWzT9ZyxzSnny52TiWVZo1xvTTad5QIQz9iRfJrjcM1BkBj5OpwT4mRVK-Yoz8Q8m5MlXEwQ5Zyp0Lxh_L-32EkdwyyCIOlG-Q1wJ-lR7utNB6E8MCrtTM1tox75-3KPvMNHbTjvqSf1l3FO_bASk39mtleI_NjThAPHCBL__cHu2wJxRYITYxqYgCu3FYcmC3OfcUJJEmgg4KEpQTIjo1X2N1m81obHWKrOrrNqfQvELnXrhHU4gVcFwpaMladoLysqOrDqHsYxNeUTp5YiEu6_Xl2eC6r9IKTbeddIf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ZIl2wYi-hWgQjP6LLI6M6wr8AhyiSZBQ34adR07niQPzLfX5Ntwr_8NyMg69bWKlLXknv8O2KznYXQQwsWA3okJCGwhfJkp35QnkHsprTN9LD48cwg8zP7a1mgM-2WHuZmoCpqg1XJgT_tPjc7X9kCQt8e3YirW6IJs-CdBUDkbp12FCukip48mDz7SOWjnLruoNABfo_zCurdOQY_tfcWe4g_ef0y_vey3hLGvxuay_ZMGzDLIo-7_WEp7jU09YKqWOZV7cSxDPm65M1v69ND6b5awsopISEe7E3hKMGrVSonRa9_bkiQ2fuPa5-xitNr4IMxwWMepqDk54v_cyVzUBdAAq8V8w3VHvV4-tjTXFqp0L54RBhJ_EaCXO7nwNbVLqCirfDpKRASfkYoaqsoXbwFMpfFrh-KzDZVIuU6D-VBF5k50ufGPnoXTA8kIF0GjAepW5SCxYupoQos4La6W2f--cl4WAl8oKhSpFtRpb1CNMKmtD7_BJrPDxpnXiA-ENBFe8Y4EOoG5uavVeQl6YftHej52JOTKurOqD-NE-UDBLInNuOo0ayCdV1w8XDAnORgxbkYP65GO5FdytK4zrDVNQEK26D54e0xLpDqUG8UUmUT_VNj9UY78WyWGPTXiGwYAA2_iVUKbT8-phHLDDqeoG3Q5iTP7RUpaW49JmM-tlSeczqqyy9Wc8iZh2Cf9veRJ7HiUeIEMeKGnqD7E9nXxcjC75GzIo477c83U7QN_1QXQjWuAr0C3KFq2W7dJmO08pQ0Z13dG7tz4Ilg1Bc3LIcNgeJLkCTZYpDpn7JpeZRbe6fqvmbqWPQ"
}
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 following image:

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

  • Analyze the construction of the submitted POST request, and finally, you can right-click the request to copy the CURL code, as shown in the following image:

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:
curl 'https://www.google.com/recaptcha/api2/demo' \
  --data-raw 'g-recaptcha-response={token}’
The corresponding Python code for calling the token verification is as follows:
import requests

token = '{token}'

data = {
    'g-recaptcha-response': token,
}

response = requests.post('https://www.google.com/recaptcha/api2/demo',data=data)

if response.status_code:
    print(response.text)

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:
curl -X POST 'https://api.acedata.cloud/captcha/token/recaptcha2' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "website_key": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
  "website_url": "https://www.google.com/recaptcha/api2/demo"
}'
The integration code in Python is as follows:
import requests

url = "https://api.acedata.cloud/captcha/token/recaptcha2"

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

payload = {
    "website_key": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
    "website_url": "https://www.google.com/recaptcha/api2/demo"
}

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 Recaptcha2 protocol recognition API to allow users to bypass recognizing and clicking on Recaptcha2 verification images, achieving backend automatic decoding and completing verification 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.