Chat with us, powered by LiveChat
← Return to MyDisct Solver

DataDome Token Solving

Solve DataDome CAPTCHA challenges programmatically. DataDome is a bot protection service that uses slider captchas to verify human users. Token-based solving returns a datadome cookie that bypasses the protection.

What is DataDome?

DataDome is a real-time bot protection service used by many e-commerce and high-traffic websites. When triggered, it displays a slider captcha that must be solved to continue browsing. The solution returns a datadome cookie that allows access to the protected website.

Captcha Type

Use the following captcha type identifier in your API requests:

"type": "DATADOME_TOKEN"

Request Format

POST /createTask

Request Parameters

Parameter Type Required Description
auth.token string required Your API key
captcha.type string required Must be "DATADOME_TOKEN"
captcha.metadata.siteUrl string required The target website URL where you want to access
captcha.metadata.siteKey string required Full DataDome challenge URL (starts with geo.captcha-delivery.com)
captcha.payload.userAgent string optional Browser user agent string (recommended)
captcha.payload.proxy object required Proxy configuration object (required for DataDome)
captcha.payload.proxy.protocol string required* Proxy protocol: "http", "https", "socks4", "socks5"
captcha.payload.proxy.host string required* Proxy IP address
captcha.payload.proxy.port number required* Proxy port number
captcha.payload.proxy.username string optional Proxy authentication username
captcha.payload.proxy.password string optional Proxy authentication password

* Required only if proxy object is provided

Example Request

JavaScript
const response = await fetch('https://solver-api.mydisct.com/createTask', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'apikey': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    auth: {
      token: 'YOUR_API_KEY'
    },
    context: {
      source: 'api',
      version: '1.0.0'
    },
    captcha: {
      type: 'DATADOME_TOKEN',
      metadata: {
        siteUrl: 'https://www.example.com/',
        siteKey: 'https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMAlk-FmAyNOW8AUyTH_g%3D%3D&hash=5B45875B653A484CC79E57036CE9FC&cid=...'
      },
      payload: {
        userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
        proxy: {
          protocol: 'http',
          host: '1.2.3.4',
          port: 8080,
          username: 'proxyuser',
          password: 'proxypass'
        }
      }
    }
  })
});

const data = await response.json();
console.log('Task ID:', data.task.id);

Response Format

Create Task Response (Processing)

JSON
{
  "success": true,
  "service": "MyDisct Solver",
  "message": "Captcha is being processed",
  "task": {
    "id": "MyDisctSolver_abc123def456",
    "status": "processing"
  }
}

Fetch Result Response (Completed)

JSON
{
  "success": true,
  "service": "MyDisct Solver",
  "message": "Captcha solved successfully",
  "task": {
    "id": "MyDisctSolver_abc123def456",
    "status": "completed",
    "result": {
      "token": "4ZXwCBlyHx9ktZhSnycMF8v3LpQr...",
      "cookies": {
        "datadome": "4ZXwCBlyHx9ktZhSnycMF8v3LpQr..."
      },
      "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
    }
  }
}
Understanding the Response

The token field contains the raw DataDome cookie value. This is the same value as result.cookies.datadome. Set this as the datadome cookie in your browser or HTTP client to bypass the protection. You must use the same proxy IP for all subsequent requests.

Response Fields

Field Type Description
result.token string Raw DataDome cookie value, ready to set as the datadome cookie
result.cookies.datadome string Same raw cookie value as token, accessible as a named key
result.user_agent string Browser user agent used during solving. Use this exact value in subsequent requests

Implementation Guide

Step 1: Extract DataDome URL

When DataDome triggers, you'll be redirected to a captcha page. Extract the full URL:

JavaScript
// The challenge URL looks like this:

function getDataDomeUrl() {
  if (window.location.href.includes('captcha-delivery.com')) {
    return window.location.href;
  }
  
  const iframe = document.querySelector('iframe[src*="captcha-delivery.com"]');
  if (iframe) {
    return iframe.src;
  }
  
  return null;
}

const siteKey = getDataDomeUrl();
console.log('DataDome siteKey:', siteKey);

Step 2: Solve DataDome Token

JavaScript
async function solveDataDomeToken(siteUrl, siteKey, proxy) {
  const createResponse = await fetch('https://solver-api.mydisct.com/createTask', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'apikey': 'YOUR_API_KEY'
    },
    body: JSON.stringify({
      auth: { token: 'YOUR_API_KEY' },
      context: { source: 'api', version: '1.0.0' },
      captcha: {
        type: 'DATADOME_TOKEN',
        metadata: { 
          siteUrl: siteUrl,
          siteKey: siteKey
        },
        payload: {
          userAgent: navigator.userAgent,
          proxy: proxy
        }
      }
    })
  });
  
  const createData = await createResponse.json();
  
  if (!createData.success) {
    throw new Error(createData.error.message);
  }
  
  const taskId = createData.task.id;
  
  while (true) {
    await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds
    
    const resultResponse = await fetch('https://solver-api.mydisct.com/fetchResult', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'apikey': 'YOUR_API_KEY'
      },
      body: JSON.stringify({ taskId })
    });
    
    const resultData = await resultResponse.json();
    
    if (resultData.task.status === 'completed') {
      return resultData.task.result.token;
    } else if (resultData.task.status === 'failed') {
      throw new Error('Token solving failed');
    }
  }
}

const proxy = {
  protocol: 'http',
  host: '1.2.3.4',
  port: 8080,
  username: 'proxyuser',
  password: 'proxypass'
};

const token = await solveDataDomeToken(
  'https://www.example.com/',
  'https://geo.captcha-delivery.com/captcha/?initialCid=...',
  proxy
);

console.log('DataDome Token:', token);

Step 3: Use the Token

JavaScript
const token = resultData.task.result.token;

document.cookie = `datadome=${token}; path=/; secure; samesite=lax`;

const response = await fetch('https://www.example.com/protected-page', {
  headers: {
    'Cookie': `datadome=${token}`
  }
});

Python Example

Python
import requests
import time

def solve_datadome_token(site_url, site_key, proxy, api_key):
    """
    Solve DataDome token challenge
    
    Args:
        site_url: Target website URL
        site_key: Full DataDome captcha URL (geo.captcha-delivery.com/...)
        proxy: Proxy configuration dict
        api_key: Your MyDisct Solver API key
    
    Returns:
        DataDome cookie string (token)
    """
    
    # Step 1: Create task
    create_response = requests.post(
        'https://solver-api.mydisct.com/createTask',
        headers={
            'Content-Type': 'application/json',
            'apikey': api_key
        },
        json={
            'auth': {'token': api_key},
            'context': {'source': 'api', 'version': '1.0.0'},
            'captcha': {
                'type': 'DATADOME_TOKEN',
                'metadata': {
                    'siteUrl': site_url,
                    'siteKey': site_key
                },
                'payload': {
                    'userAgent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
                    'proxy': proxy
                }
            }
        }
    )
    
    create_data = create_response.json()
    
    if not create_data['success']:
        raise Exception(create_data['error']['message'])
    
    task_id = create_data['task']['id']
    print(f'Task created: {task_id}')
    
    # Step 2: Poll for result
    while True:
        time.sleep(5)  # Wait 5 seconds
        
        result_response = requests.post(
            'https://solver-api.mydisct.com/fetchResult',
            headers={
                'Content-Type': 'application/json',
                'apikey': api_key
            },
            json={'taskId': task_id}
        )
        
        result_data = result_response.json()
        
        if result_data['task']['status'] == 'completed':
            return result_data['task']['result']['token']
        elif result_data['task']['status'] == 'failed':
            raise Exception('Token solving failed')
        
        print('Waiting for solution...')

# Example usage
proxy = {
    'protocol': 'http',
    'host': '1.2.3.4',
    'port': 8080,
    'username': 'proxyuser',
    'password': 'proxypass'
}

token = solve_datadome_token(
    site_url='https://www.example.com/',
    site_key='https://geo.captcha-delivery.com/captcha/?initialCid=...',
    proxy=proxy,
    api_key='YOUR_API_KEY'
)

print(f'DataDome Token: {token}')

session = requests.Session()
session.cookies.set('datadome', token, domain='.example.com')

response = session.get('https://www.example.com/protected-page')
print(f'Response status: {response.status_code}')

Best Practices

Recommendations
  • Always use a proxy - DataDome validates the IP address
  • Use the same proxy for solving and subsequent requests
  • Match the user agent between solving and your requests
  • DataDome cookies typically last 24 hours
  • Extract the full captcha URL from the redirect or page source
  • Use high-quality residential proxies for better success rates

Common Issues

Issue: Token rejected by website

Solution: Ensure you're using the same proxy IP for solving and accessing the website. DataDome validates the IP address associated with the cookie.

Issue: Invalid siteKey

Solution: Make sure you're using the complete captcha URL including all query parameters. The URL should start with geo.captcha-delivery.com/captcha/.

Issue: Token expired

Solution: DataDome cookies typically last 24 hours. Request a new token if you encounter issues after extended use.