MTCaptcha Token Solving
Solve MTCaptcha verification challenges. MTCaptcha is a privacy-focused captcha service that returns verification tokens for form submission without user interaction.
MTCaptcha is a privacy-focused captcha service designed to protect websites from automated abuse while respecting user privacy. It provides invisible verification that generates tokens without requiring any user interaction. MTCaptcha tokens must be submitted with the exact user agent string used during verification.
Captcha Type
Use the following captcha type identifier in your API requests:
"type": "MTCAPTCHA_TOKEN"
Request Format
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
captcha.type |
string | required | Must be "MTCAPTCHA_TOKEN" |
captcha.metadata.siteUrl |
string | required | URL where MTCaptcha appears |
captcha.metadata.siteKey |
string | required | MTCaptcha site key (data-mkey) |
Example Request
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: 'MTCAPTCHA_TOKEN',
metadata: {
siteUrl: 'https://example.com',
siteKey: 'MTPublic-KzqLY1cKH'
},
payload: {}
}
})
});
const data = await response.json();
console.log('Task ID:', data.task.id);
Response Format
Create Task Response (Processing)
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha is being processed",
"task": {
"id": "MyDisctSolver_mtc123",
"status": "processing"
}
}
Fetch Result Response (Processing)
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha is being processed",
"task": {
"id": "MyDisctSolver_mtc123",
"status": "processing"
}
}
Fetch Result Response (Completed)
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha solved successfully",
"task": {
"id": "MyDisctSolver_mtc123",
"status": "completed",
"result": {
"token": "v1(abc123...)",
"userAgent": "Mozilla/5.0...",
"timestamp": "2025-11-05T12:34:56.789Z"
}
}
}
MTCaptcha requires the exact user agent string used during verification.
Always use the returned userAgent in your request headers when submitting the token.
The token should be submitted in the mtcaptcha-verifiedtoken field.
Implementation Guide
Step 1: Extract MTCaptcha Site Key
Find the MTCaptcha site key from the page:
// Method 1: From data-mkey attribute
function getMTCaptchaSiteKey() {
const mtCaptcha = document.querySelector('[data-mkey]');
if (mtCaptcha) {
return mtCaptcha.getAttribute('data-mkey');
}
const scripts = document.querySelectorAll('script');
for (const script of scripts) {
const match = script.textContent?.match(/MTPublic-[^'"]+/);
if (match) return match[0];
}
if (window.mt_captcha_key) {
return window.mt_captcha_key;
}
return null;
}
const siteKey = getMTCaptchaSiteKey();
console.log('MTCaptcha Site Key:', siteKey);
Step 2: Solve MTCaptcha Token
async function solveMTCaptchaToken(siteUrl, siteKey) {
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: 'MTCAPTCHA_TOKEN',
metadata: { siteUrl, siteKey },
payload: {}
}
})
});
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;
} else if (resultData.task.status === 'failed') {
throw new Error('MTCaptcha solving failed');
}
}
}
const result = await solveMTCaptchaToken(
'https://example.com/login',
'MTPublic-KzqLY1cKH'
);
console.log('MTCaptcha Token:', result.token);
console.log('User Agent:', result.userAgent);
Step 3: Submit Token with Matching User Agent
// Method 1: Submit with form data
async function submitFormWithMTCaptcha(result) {
const formData = new FormData();
formData.append('username', 'myusername');
formData.append('password', 'mypassword');
formData.append('mtcaptcha-verifiedtoken', result.token);
const response = await fetch('https://example.com/login', {
method: 'POST',
headers: {
'User-Agent': result.userAgent // CRITICAL: Use the returned user agent
},
body: formData
});
return await response.json();
}
async function submitJsonWithMTCaptcha(result) {
const response = await fetch('https://example.com/api/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'User-Agent': result.userAgent // CRITICAL: Use the returned user agent
},
body: JSON.stringify({
username: 'myusername',
password: 'mypassword',
mtcaptchaVerifiedToken: result.token
})
});
return await response.json();
}
function injectMTCaptchaIntoForm(result) {
const tokenField = document.querySelector('input[name="mtcaptcha-verifiedtoken"]') ||
document.querySelector('input[name*="mtcaptcha"]');
if (tokenField) {
tokenField.value = result.token;
}
// IMPORTANT: Set the user agent (this may not work in all browsers)
Object.defineProperty(navigator, 'userAgent', {
value: result.userAgent,
writable: false
});
const form = tokenField?.closest('form');
if (form) {
form.submit();
}
}
const result = await solveMTCaptchaToken(siteUrl, siteKey);
await submitFormWithMTCaptcha(result);
Python Example
import requests
import time
def solve_mtcaptcha_token(site_url, site_key, api_key):
"""
Solve MTCaptcha token challenge
Args:
site_url: URL where MTCaptcha appears
site_key: MTCaptcha site key (MTPublic-...)
api_key: Your MyDisct Solver API key
Returns:
Dict containing token, userAgent, and timestamp
"""
# 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': 'MTCAPTCHA_TOKEN',
'metadata': {
'siteUrl': site_url,
'siteKey': site_key
},
'payload': {}
}
}
)
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']
elif result_data['task']['status'] == 'failed':
raise Exception('MTCaptcha solving failed')
print('Waiting for solution...')
# Example usage
result = solve_mtcaptcha_token(
site_url='https://example.com/login',
site_key='MTPublic-KzqLY1cKH',
api_key='YOUR_API_KEY'
)
print(f'MTCaptcha Token: {result["token"]}')
print(f'User Agent: {result["userAgent"]}')
# Submit with matching user agent (CRITICAL)
response = requests.post(
'https://example.com/login',
headers={'User-Agent': result['userAgent']}, # Use returned user agent
data={
'username': 'myusername',
'password': 'mypassword',
'mtcaptcha-verifiedtoken': result['token']
}
)
print(f'Login response: {response.status_code}')
Best Practices
- Always use the exact returned userAgent - MTCaptcha validates user agent matching
- Site key is found in the
data-mkeyattribute - Token format:
v1(encoded_data) - Submit token in
mtcaptcha-verifiedtokenfield - Tokens expire after 2 minutes
- Poll every 5 seconds for token-based captchas
- MTCaptcha solving typically takes 10-30 seconds
- Implement proper error handling for failed tasks
Common Issues
Solution: MTCaptcha strictly validates user agent matching. Ensure you're using
the exact userAgent string returned in the API response.
Solution: In browser environments, user agent spoofing may be limited. Consider using server-side requests with proper user agent headers instead.
Solution: MTCaptcha site keys start with 'MTPublic-'. Check for data-mkey
attributes and script content for the key.
Solution: MTCaptcha tokens expire quickly (2 minutes). Submit the token immediately after receiving it.