Text CAPTCHA Image Solving
Solve text-based image captchas with advanced OCR technology. Text CAPTCHAs require reading distorted characters with 98.7% accuracy.
Text CAPTCHAs present images containing distorted, warped, or obscured text that humans must read and type. These challenges test the ability to distinguish characters despite visual noise, distortion, overlapping lines, or background patterns designed to confuse automated recognition systems.
Captcha Type
Use the following captcha type identifier in your API requests:
"type": "TEXT_CAPTCHA_IMAGE"
Request Format
POST /createTask
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
auth.token |
string | required | Your API key |
captcha.type |
string | required | Must be "TEXT_CAPTCHA_IMAGE" |
captcha.metadata.siteUrl |
string | required | The URL where the captcha appears |
captcha.payload.images |
array | required | Array containing the text image [base64_image] |
captcha.payload.question |
string | optional | Instruction text (usually omitted for text captchas) |
captcha.payload.onlyNumbers |
boolean | optional | Whether the captcha contains only numeric digits (default: false) |
captcha.payload.maxLength |
number | optional | Maximum expected text length (default: 0 = no limit) |
captcha.payload.referenceImages |
array | optional | Additional reference images (if provided) |
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: 'TEXT_CAPTCHA_IMAGE',
metadata: {
siteUrl: 'https://example.com'
},
payload: {
images: ['base64_encoded_text_image'],
questionType: 'text',
caseSensitive: false,
minLength: 4,
maxLength: 8,
referenceImages: []
}
}
})
});
const data = await response.json();
console.log('Task ID:', data.task.id);
Response Format
Create Task Response (Processing)
{
"success": true,
"service": "MyDisct Solver",
"message": "Task created successfully",
"task": {
"id": "MyDisctSolver_text123def456",
"status": "processing",
"timestamp": "2025-11-05T12:00:00.000Z"
}
}
Fetch Result Response (Processing)
{
"success": true,
"service": "MyDisct Solver",
"task": {
"id": "MyDisctSolver_text123def456",
"status": "processing",
"timestamp": "2025-11-05T12:00:00.000Z"
}
}
Fetch Result Response (Completed)
{
"success": true,
"service": "MyDisct Solver",
"message": "Captcha solved successfully",
"task": {
"id": "MyDisctSolver_text123def456",
"status": "completed",
"result": {
"text": "AB7K9X"
},
"timestamp": "2025-11-05T12:00:02.000Z"
}
}
The text field contains the recognized text from the image.
The result preserves the original case as detected in the image.
Implementation Guide
Step 1: Extract Text Image
// Get the text image
const textImage = document.querySelector('.captcha-text-image img');
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
canvas.width = textImage.naturalWidth;
canvas.height = textImage.naturalHeight;
ctx.drawImage(textImage, 0, 0);
const imageBase64 = canvas.toDataURL('image/png').split(',')[1];
const lengthHint = document.querySelector('.captcha-length-hint');
const minLength = lengthHint ? parseInt(lengthHint.dataset.min) : null;
const maxLength = lengthHint ? parseInt(lengthHint.dataset.max) : null;
Step 2: Send to API and Poll
async function solveTextCaptcha(siteUrl, imageBase64, minLength, maxLength) {
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: 'TEXT_CAPTCHA_IMAGE',
metadata: { siteUrl },
payload: {
images: [imageBase64],
questionType: 'text',
caseSensitive: false,
...(minLength && { minLength }),
...(maxLength && { maxLength }),
referenceImages: []
}
}
})
});
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, 1000)); // Wait 1 second
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.text;
} else if (resultData.task.status === 'failed') {
throw new Error('Text captcha solving failed');
}
}
}
Step 3: Apply Solution
// Usage
async function handleTextCaptcha() {
const imageBase64 = getTextImageBase64();
const minLength = getMinLengthHint();
const maxLength = getMaxLengthHint();
const recognizedText = await solveTextCaptcha(window.location.href, imageBase64, minLength, maxLength);
const textInput = document.querySelector('.captcha-text-input');
textInput.value = recognizedText;
const form = textInput.closest('form');
form.submit();
}
Python Example
import requests
import base64
import time
def solve_text_captcha(site_url, image_path, api_key, min_length=None, max_length=None):
"""Solve text captcha challenge"""
# Step 1: Convert image to base64
with open(image_path, 'rb') as image_file:
image_base64 = base64.b64encode(image_file.read()).decode('utf-8')
# Step 2: Create task
payload = {
'images': [image_base64],
'questionType': 'text',
'caseSensitive': False,
'referenceImages': []
}
if min_length is not None:
payload['minLength'] = min_length
if max_length is not None:
payload['maxLength'] = max_length
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': 'TEXT_CAPTCHA_IMAGE',
'metadata': {'siteUrl': site_url},
'payload': 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 3: Poll for result
while True:
time.sleep(1) # Wait 1 second
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']['text']
elif result_data['task']['status'] == 'failed':
raise Exception('Text captcha solving failed')
print('Waiting for solution...')
# Example usage
recognized_text = solve_text_captcha(
site_url='https://example.com/captcha',
image_path='text_captcha.png',
api_key='YOUR_API_KEY',
min_length=4,
max_length=8
)
print(f'Recognized text: {recognized_text}')
Best Practices
- Image Quality: Ensure the text image is captured at full resolution without cropping essential parts
- Preprocessing: Do not apply heavy filters or thresholding as our AI handles noisy backgrounds better
- Polling Intervals: Use 2-3 second intervals between fetchResult requests
- Case Sensitivity: Most text captchas are case-insensitive, but check the specific site requirements
- Character Sets: If you know the allowed characters (e.g., numbers only), specify this in your request
- Timeout Management: Set reasonable timeouts (max 30 seconds) for solving
Common Issues
Solution: Check if the image is blurry or cut off. Ensure you are sending the full captcha image. Some captchas have very high noise levels that may occasionally lead to errors.
Solution: This usually means the AI couldn't find any text in the image. Verify that the image actually contains text and isn't blank or just a background.
Solution: If the target site requires case-sensitive input, ensure your application respects the case returned by the API. If case doesn't matter, you can convert the result to upper/lower case as needed.