Step 1 : Creating a Task
Create the task with the createTask
.
In the process of using turnstile, we must input websiteURL
and websiteKey
, other parameters are optional.
Task Object Structure
Properties | Type | Required | Description |
---|---|---|---|
type | String | Required | AntiTurnstileTaskProxyLess |
websiteURL | String | Required | The address of the target page. |
websiteKey | String | Required | Turnstile website key. |
metadata | Map<String,String> |
Optional | Turnstile extra data . Turnstile Documentation |
metadata.action | String | Optional | The value of the data-action attribute of the Turnstile element if it exists. |
metadata.cdata | String | Optional | The value of the data-cdata attribute of the Turnstile element if it exists. |
Example Request
POST https://api.capsolver.com/createTask
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "AntiTurnstileTaskProxyLess",
"websiteURL": "https://www.yourwebsite.com",
"websiteKey": "0x4XXXXXXXXXXXXXXXXX",
"metadata": {
"action": "login", //optional
"cdata": "0000-1111-2222-3333-example-cdata" //optional
}
}
}
Example Response
{
"errorId": 0,
"status": "idle",
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006" // record taskId
}
Step 2 : Getting Results
Use the getTaskResult method to get the recognition results
Depending on the system load, you will get the results within the interval of 1s
to 20s
Example Request
POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}
Example Response
{
"errorId": 0,
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006",
"status": "ready",
"errorCode": null,
"errorDescription": null,
"solution": {
"token": "0.mF74FV8wEufAWOdvOak_xFaVy3lqIDel7SwNhw3GgpICSWwTjYfrQB8mRT1dAJJBEoP7N1sESdp6WH9cTS1T0catWLecG3ayNcjwxVtr3hWfS-dmcBGRTx4xYwI64sAVboYGpIyuDBeMIRC3W8dK35v1nDism9xa595Da5VlXKM7hk7pIXg69lodfiftasIkyD_KUGkxBwxvrmz7dBo10-Y5zvro9hD4QKRjOx7DYj9sumnkyYCDx0m4ImDIIkNswfVTWI2V22wlnpHdvMgdtKYgOIIAU28y9gtdrdDkpkH0GHcDyd15sxQGd9VjwhGZA_mpusUKMsEoGgst2rJ3zA.UWfZupqLlGvlATkPo3wdaw.38d55cd0163610d8ce8c42fcff7b62d8981495cc1afacbb2f14e5a23682a4e13",
"type": "turnstile",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
}
}