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

TikTok Captcha Image Solving

Solve TikTok captcha challenges including rotation puzzles and click challenges. TikTok uses custom captcha systems for account verification and bot detection.

What is TikTok Captcha?

TikTok uses custom captcha systems for account verification and bot detection. These challenges include rotation puzzles (rotating images to correct orientation) and click challenges (selecting specific objects). Our API processes these challenges and returns the correct solutions.

Captcha Type

Use the following captcha type identifier in your API requests:

"type": "TIKTOK_IMAGE"

Challenge Types

Type Description
rotate Rotate image to correct orientation
click Click on specific objects
Note

You only need to provide the questionType parameter (e.g., "rotate", "click"). The API automatically formats the question internally. Do not add prefixes like "tiktok_rotate:" to your question text.

Request Format

POST /createTask

Request Parameters

Parameter Type Required Description
captcha.type string required Must be "TIKTOK_IMAGE"
captcha.metadata.siteUrl string required TikTok page URL
captcha.payload.images array required Array of base64-encoded images
captcha.payload.question string required The question text (e.g., "Rotate the image")
captcha.payload.questionType string required "rotate" or "click"
captcha.payload.referenceImages array optional Reference images for click challenges

Rotation Example

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: 'TIKTOK_IMAGE',
      metadata: {
        siteUrl: 'https://www.tiktok.com'
      },
      payload: {
        images: ['rotated_image_base64'],
        question: 'Rotate the image to correct orientation',
        questionType: 'rotate',
        referenceImages: []
      }
    }
  })
});

Response Format

Create Task Response (Processing)

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

Fetch Result Response (Processing)

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

Fetch Result Response (Completed)

JSON
{
  "success": true,
  "service": "MyDisct Solver",
  "message": "Captcha solved successfully",
  "task": {
    "id": "MyDisctSolver_abc123",
    "status": "completed",
    "result": {
      "answers": [90],
      "timestamp": "2025-11-05T12:34:56.789Z"
    }
  }
}
Understanding the Response

For rotation challenges: answers contains angle in degrees (0, 90, 180, 270).
For click challenges: answers contains array of [x, y] coordinates.

Implementation Guide

Step 1: Extract TikTok Captcha Challenge

First, you need to extract the captcha challenge from TikTok's login/register page:

JavaScript
// Extract TikTok captcha images and question
function extractTikTokCaptcha() {
  const captchaContainer = document.querySelector('[data-testid*="captcha"]') ||
                          document.querySelector('.captcha-container') ||
                          document.querySelector('iframe[src*="captcha"]');

  if (!captchaContainer) return null;

  const questionElement = captchaContainer.querySelector('.captcha-question') ||
                         captchaContainer.querySelector('[data-testid*="question"]');
  const question = questionElement ? questionElement.textContent : '';

  const imageElements = captchaContainer.querySelectorAll('img');
  const images = [];

  for (const img of imageElements) {
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');
    canvas.width = img.naturalWidth;
    canvas.height = img.naturalHeight;
    ctx.drawImage(img, 0, 0);
    const base64 = canvas.toDataURL('image/jpeg').split(',')[1];
    images.push(base64);
  }

  const questionType = question.toLowerCase().includes('rotate') ? 'rotate' : 'click';

  return { question, images, questionType };
}

const captchaData = extractTikTokCaptcha();

Step 2: Send to API and Poll for Result

JavaScript
async function solveTikTokCaptcha(images, question, questionType, siteUrl) {
  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: 'TIKTOK_IMAGE',
        metadata: { siteUrl },
        payload: { images, question, questionType }
      }
    })
  });

  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, 3000)); // Wait 3 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.answers;
    } else if (resultData.task.status === 'failed') {
      throw new Error('Captcha solving failed');
    }
  }
}

const { images, question, questionType } = extractTikTokCaptcha();
const solution = await solveTikTokCaptcha(images, question, questionType, 'https://www.tiktok.com');

console.log('Solution:', solution); // [90] for rotation, [[x,y]] for click

Step 3: Apply Solution to TikTok

JavaScript
function applyTikTokSolution(solution, questionType) {
  const captchaContainer = document.querySelector('[data-testid*="captcha"]') ||
                          document.querySelector('.captcha-container');

  if (questionType === 'rotate') {
    const rotationInput = captchaContainer.querySelector('input[type="range"]') ||
                         captchaContainer.querySelector('.rotation-slider');
    if (rotationInput) {
      rotationInput.value = solution[0];
      rotationInput.dispatchEvent(new Event('input', { bubbles: true }));
      rotationInput.dispatchEvent(new Event('change', { bubbles: true }));
    }
  } else if (questionType === 'click') {
    solution.forEach(([x, y]) => {
      const clickEvent = new MouseEvent('click', {
        view: window,
        bubbles: true,
        cancelable: true,
        clientX: x,
        clientY: y
      });

      const targetElement = document.elementFromPoint(x, y);
      if (targetElement) {
        targetElement.dispatchEvent(clickEvent);
      }
    });
  }

  setTimeout(() => {
    const submitButton = captchaContainer.querySelector('button[type="submit"]') ||
                        captchaContainer.querySelector('.captcha-submit');
    if (submitButton) {
      submitButton.click();
    }
  }, 1000);
}

applyTikTokSolution(solution, questionType);

Python Example

Python
import requests
import time

def solve_tiktok(images, question, question_type, site_url, api_key):
    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': 'TIKTOK_IMAGE',
                'metadata': {'siteUrl': site_url},
                'payload': {
                    'images': images,
                    'question': question,
                    'questionType': question_type,
                    'referenceImages': []
                }
            }
        }
    )
    
    create_data = create_response.json()
    if not create_data['success']:
        raise Exception(create_data['error']['message'])
    
    task_id = create_data['task']['id']
    
    while True:
        time.sleep(3)
        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']['answers']
        elif result_data['task']['status'] == 'failed':
            raise Exception('Captcha solving failed')

solution = solve_tiktok(
    images=['image_base64'],
    question='Rotate the image to correct orientation',
    question_type='rotate',
    site_url='https://www.tiktok.com',
    api_key='YOUR_API_KEY'
)
print(f'Rotation angle: {solution[0]} degrees')

Best Practices

Recommendations
  • Provide questionType parameter - the API handles formatting automatically
  • Rotation challenges return angle in degrees (0, 90, 180, 270)
  • Click challenges return coordinate arrays [[x, y], [x, y], ...]
  • Include reference images for click challenges when available
  • Poll for results every 3 seconds to avoid rate limiting
  • Implement proper error handling for failed tasks
  • Handle both rotation and click challenge types
  • Use appropriate user agents and headers to avoid detection

Common Issues

Issue: Captcha container not found

Solution: TikTok frequently changes their captcha implementation. Update your selectors to match current DOM structure. Check for iframe-based captchas.

Issue: Wrong question type detected

Solution: Ensure question text analysis correctly identifies rotation vs click challenges. Look for keywords like "rotate", "turn", "click", "select" in the question.

Issue: Images not converting to base64

Solution: Wait for images to fully load before attempting conversion. Handle CORS issues by using proxy or canvas-based conversion.

Issue: Solution not applying correctly

Solution: Verify coordinate system and event dispatching. TikTok may use different interaction methods for different challenge types.