SurSolver

BlogDataDome Captcha Solver API: Read var dd, Solve and Replay the datadome Cookie

DataDome Captcha Solver API: Read var dd, Solve and Replay the datadome Cookie

· Updated · 7 min read

A DataDome block rarely tells you what to do next. You get a 403, a small HTML page and an iframe on a domain you have never heard of. Behind that page sits a short, fixed structure, and once you know how to read it you can decide in seconds which challenge URL to capture and send to SurSolver. This guide takes a block apart field by field, explains the slider and the device check, and shows how to replay the datadome cookie that DataDomeCookie returns.

What a DataDome block looks like

DataDome checks each request on the server. When it distrusts the session it replaces the real page with a challenge. There are two forms:

  • Slider CAPTCHA. A puzzle iframe served from captcha-delivery.com, with a path that begins /captcha/.
  • Device check (interstitial). A short page whose script collects browser signals and posts them, with a path that begins /interstitial/. A device check that scores badly can escalate to the slider.

For a page request the block arrives as a short HTTP 403 document. For an XHR or fetch call it can arrive as a JSON body with a url property that points at the same host. In both cases the block page defines a JavaScript object named dd:

A browser console fetching a protected page and extracting the var dd object from the 403 response

Read the var dd object

var dd carries everything needed to find the challenge, so read it before you guess.

Field Meaning
rt Challenge route: c for the slider, i for the device check
cid The block's initial challenge ID, sent as initialCid
hsh A hash generated for this block, sent as hash
cookie The value of the datadome cookie issued to the blocked session, sent as cid
s Passed through unchanged as s
e Present on some blocks; passed through unchanged as e
t Passed through as t on the slider route only
b Passed through as b on the device-check route only
host The challenge host, usually geo.captcha-delivery.com

These fields are generated for one visit. They belong to the IP, User-Agent and cookie that produced the block, so a copy taken yesterday or from another machine does not describe the session you are about to solve.

Where the challenge URL comes from

The browser opens the challenge from the same fields. A slider URL looks like this, with the placeholders replaced by the block's own values:

snippet.txt
https://geo.captcha-delivery.com/captcha/?initialCid=<dd.cid>&hash=<dd.hsh>&cid=<dd.cookie>&referer=<page URL>&s=<dd.s>&dm=cd

On the device-check route the path is /interstitial/ instead, and b is added. In practice you rarely build it by hand. The easier source is the src of the iframe on the block page, or the url in a JSON block. Copy that value whole, with its query string.

A browser console listing the datadome cookie and the captcha-delivery.com URLs the page requested

Capture the required captchaUrl

captchaUrl is required. The solver opens exactly the URL you provide; it does not discover it from websiteURL.

Capture the complete iframe src or JSON block url through the same sticky proxy and User-Agent you will use for solving and replay. Preserve the complete query and related session cookies. If the URL came from an old session or another IP, capture a new block instead.

A slider URL with t=bv is rejected before charging. Change proxy and recapture; editing that flag does not unblock the IP.

Create the task

DataDomeCookie requires websiteURL, captchaUrl, userAgent and your proxy. There is no proxyless variant, because the cookie is tied to the IP that solved the challenge.

snippet.json
{
  "clientKey": "sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "task": {
    "type": "DataDomeCookie",
    "websiteURL": "https://shop.example.com/products",
    "captchaUrl": "https://geo.captcha-delivery.com/captcha/?initialCid=BLOCK_ID&hash=BLOCK_HASH&cid=COOKIE_ID&referer=https%3A%2F%2Fshop.example.com%2Fproducts&s=SESSION&t=fe",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36",
    "proxy": "http://user:pass@proxy.example.com:8080"
  }
}

One optional field carries the existing session:

  • cookies carries the blocked session. It accepts a Cookie header value such as datadome=blocked-value; session=your-session, or an engine cookie dump with one JSON object per line. Use it when the protected request depends on cookies you already hold. Do not send the old datadomeCookie field; it is rejected with ERROR_INVALID_REQUEST.

A missing proxy is refused with ERROR_INVALID_REQUEST and proxy is required for this task type. before anything is charged. The userAgent must be one of the supported identities; otherwise the answer is ERROR_WRONG_USERAGENT with supportedUserAgents.

Poll and read the result

Poll getTaskResult every 3 seconds. The result contains only the cookie value:

snippet.json
{
  "errorId": 0,
  "status": "ready",
  "solution": {
    "datadome": "value of the datadome cookie"
  }
}

There is no userAgent in it. solution.datadome is the value of the datadome cookie; cookies, when returned, maps every returned cookie name to its value.

Set solution.datadome as a cookie named datadome on the protected site's domain, and repeat the request through the same proxy with the same User-Agent. The script below creates the task, waits for the cookie and retries the page.

datadome-python.py
# datadome-python.py - solve DataDome and request the protected page with the datadome cookie.
# Install: pip install requests
# Run: python datadome-python.py

import time

import requests


# Your SurSolver API key.
CLIENT_KEY = "sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# The challenged page, exactly as it shows the challenge.
TARGET_URL = "https://example.com/page"
# The proxy for the solve and the replay: http://user:pass@host:port or socks5://host:port.
PROXY_URL = "http://username:password@proxy.example.com:8080"
# The complete fresh captcha-delivery challenge page URL from your blocked session.
CAPTCHA_URL = "https://geo.captcha-delivery.com/captcha/?initialCid=YOUR_CAPTURE&t=fe"
# Existing session cookies as a Cookie header value (name=value; name2=value2).
SESSION_COOKIES = None
# The User-Agent the solve runs with; send the result with this same user agent.
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36"
# Text that appears only in a response the site accepted.
SUCCESS_TEXT = "PASTE_ACCEPTED_MARKER"


API = "https://api.sursolver.com"
POLL_ATTEMPTS = 60


def call(path, body):
    # API errors are HTTP 200 with errorId 1; anything else is a transport failure.
    response = requests.post(f"{API}{path}", json=body, timeout=30)
    response.raise_for_status()
    data = response.json()
    if data["errorId"] != 0:
        raise RuntimeError(f'{data["errorCode"]}: {data["errorDescription"]}')
    return data


def solve(task):
    created = call("/createTask", {"clientKey": CLIENT_KEY, "task": task})
    for _ in range(POLL_ATTEMPTS):
        result = call("/getTaskResult", {"clientKey": CLIENT_KEY, "taskId": created["taskId"]})
        if result["status"] == "ready":
            return result["solution"]
        time.sleep(3)
    raise TimeoutError(f'task {created["taskId"]} was not ready in {POLL_ATTEMPTS} polls')


def without_empty(fields):
    # Optional task fields are sent only when they have a value.
    return {name: value for name, value in fields.items() if value not in (None, "")}


PROXIES = {"http": PROXY_URL, "https": PROXY_URL}


def main():
    solution = solve({
        "type": "DataDomeCookie",
        "websiteURL": TARGET_URL,
        "captchaUrl": CAPTCHA_URL,
        "userAgent": USER_AGENT,
        **without_empty({
            "cookies": SESSION_COOKIES,
        }),
        "proxy": PROXY_URL,
    })

    # Replay with the user agent the solve ran with, through the same proxy.
    headers = {"User-Agent": USER_AGENT}
    cookies = dict(part.strip().split("=", 1) for part in (SESSION_COOKIES or "").split(";")
                   if "=" in part)
    cookies["datadome"] = solution["datadome"]
    cookies = {
        **cookies,
        **solution.get("cookies", {}),
        "datadome": solution["datadome"],
    }
    response = requests.get(
        TARGET_URL,
        headers=headers,
        cookies=cookies,
        proxies=PROXIES,
        timeout=30,
    )
    if not response.ok or SUCCESS_TEXT not in response.text:
        raise SystemExit(f"The site did not accept the result (HTTP {response.status_code}).")
    print("The site accepted the result.")


if __name__ == "__main__":
    main()

In a Playwright run, add the cookie to the browser context before the first navigation, and make the context use the same proxy and User-Agent as the task. The Playwright recipe shows the pattern.

DataDome scores more than the cookie, so a replay fails for reasons the cookie itself cannot fix.

Symptom Likely cause What to check
Another 403 right after the replay Exit IP differs from the one that solved Use one sticky proxy session for task and replay
Another 403 with a different User-Agent The UA was changed Send the task's userAgent unchanged
The slider never appears The exit IP is blocked outright Use a different sticky proxy session
The block returns after a few requests Request patterns look automated Keep the browser's headers and request order, and avoid bursts
The task fails with ERROR_FAILED The URL did not serve a DataDome challenge, or the challenge changed Capture the block again through your proxy; the charge is refunded once
A captured captchaUrl fails Its URL, cookies or exit IP came from another session Recapture the complete URL and session together through one sticky proxy

A header that disagrees with the User-Agent is another common cause; the headers guide shows which headers have to move together.

Checklist

  1. Read the block through your production proxy and note whether the path is /captcha/ or /interstitial/.
  2. Send a fresh, complete captchaUrl captured from the same IP and session.
  3. Send a sticky proxy and a complete User-Agent from supportedUserAgents.
  4. Poll every 3 seconds and never duplicate a task that is still processing.
  5. Set datadome on the protected host and replay through the same proxy and User-Agent.

The DataDome solver page lists the task fields at a glance, and the API reference has the request and result schemas.

Current input and replay contract

captchaUrl is required. No URL discovery is performed. Capture the complete current slider or interstitial page URL and send it with the same proxy, User-Agent and session cookies.

A captured slider URL containing t=bv identifies a blocked proxy and is rejected before charging. Change proxy and capture a fresh session; editing the query flag does not repair it. t=fe is the normal slider path. Requests to c.js or i.js help identify challenge activity but are not substitutes for the challenge page URL.

The result contains solution.datadome, the datadome cookie value, and optional cookies. ready means a credential was generated, not that the application accepted it: the native acceptance check may fail or remain unverified while returning the minted token. Keep the same sticky proxy, User-Agent and application cookies, then check the protected response. The shared script's SESSION_COOKIES setting takes a Cookie header string and preserves its other cookies. See both capture and replay recipes.

More articles