Datadome: solving Datadome captcha
Create the task with the createTask method and get the result with
the getTaskResult method.
ℹ️This task type require your own proxies.
Datadome types we support both:
Slider Captcha and Interstitial(Device check)
The tasks type types that we support:
DatadomeSliderTaskthis task type require your own proxies.
Create Task
Create the task with the createTask.
Attention You must observe whether the t parameter in captchaUrl is equal to fe. If t=bv means that
your ip is directly banned, and you must change the IP.
Task Object Structure
| Properties | Type | Required | Description |
|---|---|---|---|
| type | String | Required | DataDomeSliderTask (Both slider and interstitial use this type) |
| captchaUrl | String | Required | if the url contains t=bv that means that your ip must be banned, t should be t=fe |
| userAgent | String | Required | You need to keep your userAgent consistent with the one used to request the captchaUrl. Currently, we only support two fixed userAgents. |
| proxy | String | Required | Learn Using proxies |
WARNING
Please use the fixed userAgent we provide to request the captchaUrl.
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36,Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36,Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36,Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36,Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.36Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Mobile/15E148 Safari/604.1Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1
Example Request
POST https://api.capsolver.com/createTask
Host: api.capsolver.com
Content-Type: application/json{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "DatadomeSliderTask",
"captchaUrl": "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMA1QGvUmJwyYoAwpyjNg%3D%3D&hash=789361B674144528D0B7EE76B35826&cid=6QAEcL8coBYTi9tYLmjCdyKmNNyHz1xwM2tMHHGVd_Rxr6FsWrb7H~a04csMptCPYfQ25CBDmaOZpdDa4qwAigFnsrzbCkVkoaBIXVAwHsjXJaKYXsTpkBPtqJfLMGN&t=fe&referer=https%3A%2F%2bck.websiteurl.com%2Fclient%2Fregister%2FYM4HJV%3Flang%3Den&s=40070&e=3e531bd3b30650f2e810ac72cd80adb5eaa68d2720e804314d122fa9e84ac25d",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"proxy": "158.120.100.23:334:user:pass",
}
}Example Response
{
"errorId": 0,
"status": "idle",
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}Getting Result
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,
"errorCode": null,
"errorDescription": null,
"solution": {
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"cookie": "datadome=yzj_BK...S0; Max-Age=31536000; Domain=; Path=/; Secure; SameSite=Lax"
},
"status": "ready"
}Use SDK Request
# pip install --upgrade capsolver
# export CAPSOLVER_API_KEY='...'
import capsolver
# capsolver.api_key = "..."
solution = capsolver.solve({
"type": "DatadomeSliderTask",
"websiteURL": "https://bck.websiteurl.com/",
"captchaUrl": "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMA1QGvUmJwyYoAwpyjNg%3D%3D&hash=789361B674144528D0B7EE76B35826&cid=6QAEcL8coBYTi9tYLmjCdyKmNNyHz1xwM2tMHHGVd_Rxr6FsWrb7H~a04csMptCPYfQ25CBDmaOZpdDa4qwAigFnsrzbCkVkoaBIXVAwHsjXJaKYXsTpkBPtqJfLMGN&t=fe&referer=https%3A%2F%2bck.websiteurl.com%2Fclient%2Fregister%2FYM4HJV%3Flang%3Den&s=40070&e=3e531bd3b30650f2e810ac72cd80adb5eaa68d2720e804314d122fa9e84ac25d",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"proxy": "158.120.100.23:334:user:pass"
})package main
import (
"fmt"
capsolver_go "github.com/capsolver/capsolver-go"
"log"
)
func main() {
// first you need to install sdk
//go get github.com/capsolver/capsolver-go
//export CAPSOLVER_API_KEY='...' or
//capSolver := CapSolver{ApiKey:"..."}
capSolver := capsolver_go.CapSolver{}
solution, err := capSolver.Solve(map[string]any{
"type": "DatadomeSliderTask",
"websiteURL": "https://bck.websiteurl.com/",
"captchaUrl": "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMA1QGvUmJwyYoAwpyjNg%3D%3D&hash=789361B674144528D0B7EE76B35826&cid=6QAEcL8coBYTi9tYLmjCdyKmNNyHz1xwM2tMHHGVd_Rxr6FsWrb7H~a04csMptCPYfQ25CBDmaOZpdDa4qwAigFnsrzbCkVkoaBIXVAwHsjXJaKYXsTpkBPtqJfLMGN&t=fe&referer=https%3A%2F%2bck.websiteurl.com%2Fclient%2Fregister%2FYM4HJV%3Flang%3Den&s=40070&e=3e531bd3b30650f2e810ac72cd80adb5eaa68d2720e804314d122fa9e84ac25d",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"proxy": "158.120.100.23:334:user:pass",
})
if err != nil {
log.Fatal(err)
return
}
fmt.Println(solution)
}Sample Code
# pip install requests
import requests
import time
api_key = "YOUR_API_KEY" # your api key of capsolver
def capsolver():
payload = {
"clientKey": api_key,
"task": {
"type": 'DatadomeSliderTask',
"websiteURL": "https://bck.websiteurl.com/",
"captchaUrl": "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMA1QGvUmJwyYoAwpyjNg%3D%3D&hash=789361B674144528D0B7EE76B35826&cid=6QAEcL8coBYTi9tYLmjCdyKmNNyHz1xwM2tMHHGVd_Rxr6FsWrb7H~a04csMptCPYfQ25CBDmaOZpdDa4qwAigFnsrzbCkVkoaBIXVAwHsjXJaKYXsTpkBPtqJfLMGN&t=fe&referer=https%3A%2F%2bck.websiteurl.com%2Fclient%2Fregister%2FYM4HJV%3Flang%3Den&s=40070&e=3e531bd3b30650f2e810ac72cd80adb5eaa68d2720e804314d122fa9e84ac25d",
"proxy": "158.120.100.23:334:user:pass",
"userAgent": "please use our supported userAgent"
}
}
res = requests.post("https://api.capsolver.com/createTask", json=payload)
resp = res.json()
task_id = resp.get("taskId")
if not task_id:
print("Failed to create task:", res.text)
return
print(f"Got taskId: {task_id} / Getting result...")
while True:
time.sleep(1) # delay
payload = {"clientKey": api_key, "taskId": task_id}
res = requests.post("https://api.capsolver.com/getTaskResult", json=payload)
resp = res.json()
status = resp.get("status")
if status == "ready":
return resp.get("solution", {}).get("cookie")
if status == "failed" or resp.get("errorId"):
print("Solve failed! response:", res.text)
return
cookie = capsolver()
print(cookie)package main
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"time"
)
type capSolverResponse struct {
ErrorId int32 `json:"errorId"`
ErrorCode string `json:"errorCode"`
ErrorDescription string `json:"errorDescription"`
TaskId string `json:"taskId"`
Status string `json:"status"`
Solution map[string]any `json:"solution"`
}
func capSolver(ctx context.Context, apiKey string, taskData map[string]any) (*capSolverResponse, error) {
uri := "https://api.capsolver.com/createTask"
res, err := request(ctx, uri, map[string]any{
"clientKey": apiKey,
"task": taskData,
})
if err != nil {
return nil, err
}
if res.ErrorId == 1 {
return nil, errors.New(res.ErrorDescription)
}
uri = "https://api.capsolver.com/getTaskResult"
for {
select {
case <-ctx.Done():
return res, errors.New("solve timeout")
case <-time.After(time.Second):
break
}
res, err = request(ctx, uri, map[string]any{
"clientKey": apiKey,
"taskId": res.TaskId,
})
if err != nil {
return nil, err
}
if res.ErrorId == 1 {
return nil, errors.New(res.ErrorDescription)
}
if res.Status == "ready" {
return res, err
}
}
}
func request(ctx context.Context, uri string, payload interface{}) (*capSolverResponse, error) {
payloadBytes, err := json.Marshal(payload)
if err != nil {
return nil, err
}
req, err := http.NewRequestWithContext(ctx, "POST", uri, bytes.NewReader(payloadBytes))
if err != nil {
return nil, err
}
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
responseData, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
capResponse := &capSolverResponse{}
err = json.Unmarshal(responseData, capResponse)
if err != nil {
return nil, err
}
return capResponse, nil
}
func main() {
apikey := "YOUR_API_KEY"
ctx, cancel := context.WithTimeout(context.Background(), time.Second*120)
defer cancel()
res, err := capSolver(ctx, apikey, map[string]any{
"type": "DatadomeSliderTask",
"websiteURL": "https://bck.websiteurl.com/",
"captchaUrl": "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMA1QGvUmJwyYoAwpyjNg%3D%3D&hash=789361B674144528D0B7EE76B35826&cid=6QAEcL8coBYTi9tYLmjCdyKmNNyHz1xwM2tMHHGVd_Rxr6FsWrb7H~a04csMptCPYfQ25CBDmaOZpdDa4qwAigFnsrzbCkVkoaBIXVAwHsjXJaKYXsTpkBPtqJfLMGN&t=fe&referer=https%3A%2F%2bck.websiteurl.com%2Fclient%2Fregister%2FYM4HJV%3Flang%3Den&s=40070&e=3e531bd3b30650f2e810ac72cd80adb5eaa68d2720e804314d122fa9e84ac25d",
"proxy": "158.120.100.23:334:user:pass",
"userAgent": "your_user_agent",
})
if err != nil {
panic(err)
}
fmt.Println(res.Solution["cookie"])
}// npm install axios
const axios = require('axios');
const api_key = "YOUR_API_KEY";
async function capsolver() {
const payload = {
clientKey: api_key,
task: {
type: 'DatadomeSliderTask',
websiteURL: "https://bck.websiteurl.com/",
captchaUrl: "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMA1QGvUmJwyYoAwpyjNg%3D%3D&hash=789361B674144528D0B7EE76B35826&cid=6QAEcL8coBYTi9tYLmjCdyKmNNyHz1xwM2tMHHGVd_Rxr6FsWrb7H~a04csMptCPYfQ25CBDmaOZpdDa4qwAigFnsrzbCkVkoaBIXVAwHsjXJaKYXsTpkBPtqJfLMGN&t=fe&referer=https%3A%2F%2bck.websiteurl.com%2Fclient%2Fregister%2FYM4HJV%3Flang%3Den&s=40070&e=3e531bd3b30650f2e810ac72cd80adb5eaa68d2720e804314d122fa9e84ac25d",
proxy: "158.120.100.23:334:user:pass",
userAgent: "please use our supported userAgent"
}
};
try {
const res = await axios.post("https://api.capsolver.com/createTask", payload);
const task_id = res.data.taskId;
if (!task_id) {
console.log("Failed to create task:", res.data);
return;
}
console.log("Got taskId:", task_id);
while (true) {
await new Promise(resolve => setTimeout(resolve, 1000)); // Delay for 1 second
const getResultPayload = {clientKey: api_key, taskId: task_id};
const resp = await axios.post("https://api.capsolver.com/getTaskResult", getResultPayload);
const status = resp.data.status;
if (status === "ready") {
return resp.data.solution.cookie;
}
if (status === "failed" || resp.data.errorId) {
console.log("Solve failed! response:", resp.data);
return;
}
}
} catch (error) {
console.error("Error:", error);
}
}
capsolver().then(cookie => {
console.log(cookie);
});package org.example.capsolver;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class DataDome {
public static String API_KEY = "YOUR_API_KEY";
public static String CAPTCHA_URL = "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMA1QGvUmJwyYoAwpyjNg%3D%3D&hash=789361B674144528D0B7EE76B35826&cid=6QAEcL8coBYTi9tYLmjCdyKmNNyHz1xwM2tMHHGVd_Rxr6FsWrb7H~a04csMptCPYfQ25CBDmaOZpdDa4qwAigFnsrzbCkVkoaBIXVAwHsjXJaKYXsTpkBPtqJfLMGN&t=fe&referer=https%3A%2F%2bck.websiteurl.com%2Fclient%2Fregister%2FYM4HJV%3Flang%3Den&s=40070&e=3e531bd3b30650f2e810ac72cd80adb5eaa68d2720e804314d122fa9e84ac25d"; // Replace with the site captcha of your target site
public static String SITE_URL = "https://www.yourwebsite.com";
public static String PROXY = "http://name:pass@host:port";
public static String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
public static void capsolver() throws IOException, InterruptedException {
JSONObject param = new JSONObject();
Map<String, Object> task = new HashMap<>();
task.put("type", "DatadomeSliderTask");
task.put("captchaUrl", CAPTCHA_URL);
task.put("websiteURL", SITE_URL);
task.put("userAgent", USER_AGENT);
task.put("proxy", PROXY);
param.put("clientKey", API_KEY);
param.put("task", task);
String taskId = createTask(param);
if (Objects.equals(taskId, "")) {
System.out.println("Failed to create task");
return;
}
System.out.println("Got taskId: "+taskId+" / Getting result...");
while (true){
Thread.sleep(1000);
String cookie = getTaskResult(taskId);
if (Objects.equals(cookie, null)) {
continue;
}
System.out.println(cookie);
break;
}
}
public static String requestPost(String url, JSONObject param) throws IOException {
URL ipapi = new URL(url);
HttpURLConnection c = (HttpURLConnection) ipapi.openConnection();
c.setRequestMethod("POST");
c.setDoOutput(true);
OutputStream os = null;
os = c.getOutputStream();
os.write(param.toString().getBytes("UTF-8"));
c.connect();
BufferedReader reader = new BufferedReader(
new InputStreamReader(c.getInputStream())
);
String line;
StringBuilder sb = new StringBuilder();
while ((line = reader.readLine()) != null)
{ sb.append(line); }
return sb.toString();
}
public static String createTask(JSONObject param) throws IOException {
String parsedJsonStr = requestPost("https://api.capsolver.com/createTask", param);
JSONObject responseJson = new JSONObject(parsedJsonStr);
return responseJson.get("taskId").toString();
}
public static String getTaskResult(String taskId) throws IOException {
JSONObject param = new JSONObject();
param.put("clientKey", API_KEY);
param.put("taskId", taskId);
String parsedJsonStr = requestPost("https://api.capsolver.com/getTaskResult", param);
JSONObject responseJson = new JSONObject(parsedJsonStr);
String status = responseJson.getString("status");
if (status.equals("ready")) {
JSONObject solution = responseJson.getJSONObject("solution");
return solution.get("cookie").toString();
}
if (status.equals("failed") || responseJson.getInt("errorId")!=0) {
System.out.println("Solve failed! response: "+parsedJsonStr);
return "error";
}
return null;
}
}
CapSolver