CloudFlareTurnstile

CloudFlareTurnstile

 

Create a task through the createTask method, and then get the result through the getTaskResult method

Task Type

Task Type

Description

Price(USD)

Task Type

Description

Price(USD)

CloudFlareTurnstileTask

CloudFlareTurnstile solution

$1.0/k

Create Task

Create a task through the createTask method

Request host: https://api.ez-captcha.com

Request api: https://api.ez-captcha.com/createTask

Request format:POST application/json

Remarks

If you anticipate a large volume of requests within a specific timeframe, please contact us in advance to add more hosts.

Parameter Structure

Parameter

Type

Required

Description

Parameter

Type

Required

Description

clientKey

string

yes

Your client key

type

string

yes

CloudFlareTurnstileTask

websiteURL

string

yes

website url, usually a fixed value.

websiteKey

string

yes

website key, usually a fixed value.

proxy

string

optional

Optional, upload if you want to use your own proxy. Format ishttp://username:password@ip:port

rqData

Object

optional

Turnstile extra data (Document)

rqData.metadataAction

string

optional

The value of the data-action attribute of the Turnstile element if it exists.

rqData.metadataCdata

string

optional

The value of the data-action attribute of the Turnstile element if it exists.

metadataAction and metadataCdata are optional and usually left blank. You only need to fill them in when the website explicitly sets them, as shown in the example. If you are unsure how to find these values, contact the administrator for assistance.

图片-20250716-113109.png

Request Example

POST https://api.ez-captcha.com/createTask Content-Type: application/json { "clientKey": "YourClientKey", "task": { "websiteURL": "https://xxx.com", "type": "CloudFlareTurnstileTask", "websiteKey": "xxxx", "rqData":{ //optional "metadataAction":"signup", "metadataCdata":"" }, } }

Reponse Example

{ "errorId": 0, "errorCode": "", "errorDescription": "", "taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006" // Please save this ID for next step }

Get Result

Use the getTaskResult method to get the recognition result

Request host: https://api.ez-captcha.com

Request api: https://api.ez-captcha.com/getTaskResult

Request format:POST application/json

Request Example

POST https://api.ez-captcha.com/getTaskResult Content-Type: application/json { "clientKey":"YOUR_API_KEY", "taskId": "TASKID OF CREATETASK" //ID created by createTask method }

Response Data

Parameter

Type

Description

Parameter

Type

Description

errorId

Integer

Error message: 0 - no error, 1 - error

errorCode

string

Error code, click here to view all error list

errorDescription

string

Detailed error description

status

String

processing - task is in progress, please try again in 1 seconds

ready - task is complete, find the result in the solution parameter

solution

Object

The recognition result will be different for different types of captcha.

Response Example

{ "errorId": 0, "errorCode": null, "errorDescription": null, "solution": { {"header": {}, "token": "0.alU6fkxnt1TwF7lTlYWWdu0o80HW-4unnp..."} }, "status": "ready" }

Response Description

  • Successful recognition: when errorId is equal to 0 and status is equal to ready, the result is in the solution.

  • Identifying: When errorId is 0 and status is processing, please try again after 1 seconds.

  • An error occurred: when the errorId is greater than 0, please understand the error information according to the errorDescription All error descriptions

Demo

import threading import time import requests import json from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) def test(): start_time = time.time() data = { "clientKey": "YourClientKey", "task": { "type": "CloudFlareTurnstileTask",# "websiteURL": "https://xxx.com/", "websiteKey": "websiteKey", } } resp = requests.post("https://api.ez-captcha.com/createTask", json=data,verify=False) task_id = resp.json()['taskId'] print(f"task_id: {task_id}") for _ in range(30): data = { "clientKey": "YourClientKey",# "taskId": task_id } resp = requests.post("https://api.ez-captcha.com/getTaskResult", json=data,verify=False) if "token" in resp.text: resp_json = json.loads(resp.text) print(f"token: {resp_json.get('solution', {}).get('token', {})}") end_time = time.time() print(f"time: {end_time - start_time}") break; elif "errorDesc" in resp.text: print(resp.text) break; time.sleep(1) if __name__ == '__main__': test()