hCaptcha Protocol Recognition API Integration Guide

This article introduces an hCaptcha protocol recognition API integration guide, which allows users to automatically decode hCaptcha challenges in the background and complete verification simply by submitting the Website Key, without recognizing and clicking hCaptcha image tiles.

Application Process

To use the hCaptcha protocol recognition API, first visit the Ace Data Cloud Console to obtain your API Token for later use.

If you have not yet logged in or registered, you will be automatically redirected to the login page to register and log in. Once completed, 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 the amount shown in your account. If the balance is insufficient, you can top it up in the Console.

📘 Full documentation: hCaptcha Protocol Recognition API →

Basic Usage

First, let's look at the basic usage: enter the URL of the website whose hCaptcha challenge needs to be processed to obtain the processed result. First, simply pass a website_url field. Our example website is https://accounts.hcaptcha.com/demo. We need to obtain the website_key from the website_url page. First, open the webpage, press F12 to enter the console, and finally perform a global search for hcaptcha-demo on the Elements page. We can obtain the following result:

The string corresponding to data-sitekey is the value of website_key. The specific parameters are shown below:

As you can see, we have set the Request Headers here, including:

  • accept: The desired response format. Here it is set to application/json, meaning JSON format.
  • authorization: The key used to call the API. After applying, you can select it directly from the dropdown.

We have also set the Request Body, including:

  • website_url: The URL of the website whose CAPTCHA needs to be processed.
  • website_key: The site key identifier in hCaptcha.
  • rqdata: Optional. An hCaptcha Enterprise challenge may provide data-rqdata on the page. Enter its original value when encountering such a challenge; it is not required for standard hCaptcha.
  • proxy: Optional, Bring Your Own Proxy. When set, the system will use the proxy IP you provide to solve the CAPTCHA, allowing you to control the quality of the outbound IP (for example, to avoid a 410 Gone response caused by a public proxy IP being blocked by the target website). The format is scheme://[user:pass@]host:port, and scheme supports http/https/socks4/socks5, for example, http://user:pass@1.2.3.4:8080. If omitted, the platform's default proxy is used.

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

Click the “Try” button to test it. As shown above, we obtained the following result:

{
  "token": "P1_eyJ0eXAiOiJKV1QiLCJhbGciO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c7bVv-P4FXbLX0WCjvQRES2MCbXPyJ-OpZZXZcJy7SOsGY3jZbTkGoez19cRQLiFO35gA5l9FBptDKW-_yGemt5XeKsR_FwGPN9C-0k1E-28oB4iKo-h1zb2kJpilhnmG36Z59F5T6W77M7OD_N6VHRWuPClLElO09OrPLHbJmxq9JvMWjTg5JjEaqyTLyLXWgw0N3kZMCqJJeqNj5w5I7dpuJ6ScfXKVaT96v2UESebdbMFT7vkZAkFF8LIowkN56pNwXLHkB2KyIWR2WQL-335BEpQ0AVB6RX4kdociIhtvAdsIE6pvFIwkzyO0OvIHxzOwPxZKdmDmBVMu7YxJStrhY-XWCu4kO5gDIJ0iedPWKNleHDOZuZqGKhzaGFyZF9pZM4xrUyBomtyqDE1ZmUwNDhkonBkAA.dVWyVc6N3lx2ZJQ7NJ9aEsWA-KAIuQ4PMSKVGQuWyCA",
  "elapsed": 31.6
}

The returned result contains multiple fields, described below:

  • token, the verification result after processing this hCaptcha task.
  • started_at, finished_at: the times when processing of this request began and the result was produced, as Unix timestamps (seconds, floating-point).
  • elapsed: the total processing time (seconds). We can see that we have obtained the result of solving the hCaptcha CAPTCHA, which we can then use in a POST request or simulated submission to the target website. It is for one-time use, valid for 120 seconds, and recommended for use within 60 seconds. Next, a CURL example 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 developer console, manually pass the verification once, and finally we can see that the website has sent a POST request. We only need to examine the structure of this POST request. The specific process is as follows:

  • First, manually pass the verification, as shown below:

  • Then click submit and observe the changes in the console's network panel, as shown below:

  • Analyze the structure of the submitted POST request. Finally, you can right-click the request to copy the CURL code, as shown below:

From the analysis of the image above, the URL of this POST request is https://accounts.hcaptcha.com/demo. We only need to submit the parameters g-recaptcha-response, h-captcha-response, and email, and then pass the processed token into the data below. The corresponding CURL code for token verification is as follows:

curl 'https://accounts.hcaptcha.com/demo' \
  --data-raw 'email=&g-recaptcha-response={token}&h-captcha-response={token}'

The corresponding Python code for token verification is as follows:

import requests

token = '{token}'

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

response = requests.post('https://accounts.hcaptcha.com/demo',
                        data=data)

if response.status_code == 200:
    print(response.text)

Then we observe that the console displays the following result:

Finally, we have passed the hCaptcha CAPTCHA verification.

In addition, 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/token/hcaptcha' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "website_key": "a5f74b19-9e45-40e0-b45d-47ff91b7a6c2",
  "website_url": "https://accounts.hcaptcha.com/demo"
}'

The Python integration code is as follows:

import requests

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

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

payload = {
    "website_key": "a5f74b19-9e45-40e0-b45d-47ff91b7a6c2",
    "website_url": "https://accounts.hcaptcha.com/demo"
}

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 token processing is complete 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 you pass async: true, the endpoint immediately returns a task_id instead of blocking while it waits:

{
  "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, it returns status: processing:

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

Once processing is complete, it returns status: ready and the token:

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

Billing: In asynchronous mode, creating a task and reading the “processing” status are free; a single charge is incurred when the client first reads a successful result (at the same price as the existing behavior and synchronous mode). The server advances the task independently, but does not charge in advance 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 tasks.

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 hCaptcha protocol recognition API to allow users to complete verification without identifying and clicking hCaptcha CAPTCHA images, simply by submitting a Website Key for automatic decoding in the background. 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.