Audio to Text
Audio to Text tasks transcribe spoken audio CAPTCHAs into text. Send a base64-encoded audio file and receive the transcribed content. This is commonly used for accessibility-oriented CAPTCHA challenges that read out letters, numbers, or words.
Task Type
Section titled “Task Type”| Type | Description |
|---|---|
AudioToTextTask | Transcribe audio CAPTCHA to text |
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | AudioToTextTask |
body | string | Yes | Base64-encoded audio file (MP3, WAV, OGG) |
lang | string | No | Language code (e.g., en, ru, de) |
Create Task
Section titled “Create Task”Request
Section titled “Request”{ "clientKey": "YOUR_API_KEY", "task": { "type": "AudioToTextTask", "body": "SUQzBAAAAAAAI1RTU0UAAAA...", "lang": "en" }}Response
Section titled “Response”{ "errorId": 0, "status": "ready", "solution": { "text": "seven four two" }}Solution Object
Section titled “Solution Object”{ "text": "seven four two"}| Field | Type | Description |
|---|---|---|
text | string | The transcribed text from the audio CAPTCHA |
Code Examples
Section titled “Code Examples”Python
Section titled “Python”import requestsimport base64
API_KEY = "YOUR_API_KEY"
# Encode the audio file to base64with open("captcha.mp3", "rb") as f: audio_data = base64.b64encode(f.read()).decode()
# Create taskresponse = requests.post("https://api.ucaptcha.net/createTask", json={ "clientKey": API_KEY, "task": { "type": "AudioToTextTask", "body": audio_data, "lang": "en" }}).json()
if response.get("status") == "ready": print("Transcription:", response["solution"]["text"])else: import time task_id = response["taskId"] while True: result = requests.post("https://api.ucaptcha.net/getTaskResult", json={ "clientKey": API_KEY, "taskId": task_id }).json()
if result["status"] == "ready": print("Transcription:", result["solution"]["text"]) break elif result["status"] == "failed": print("Error:", result.get("errorDescription")) break
time.sleep(5)JavaScript
Section titled “JavaScript”import { readFileSync } from "fs";
const API_KEY = "YOUR_API_KEY";
// Encode the audio file to base64const audioData = readFileSync("captcha.mp3").toString("base64");
const response = await fetch("https://api.ucaptcha.net/createTask", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientKey: API_KEY, task: { type: "AudioToTextTask", body: audioData, lang: "en" } })}).then(r => r.json());
if (response.status === "ready") { console.log("Transcription:", response.solution.text);} else { const taskId = response.taskId; while (true) { const result = await fetch("https://api.ucaptcha.net/getTaskResult", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientKey: API_KEY, taskId }) }).then(r => r.json());
if (result.status === "ready") { console.log("Transcription:", result.solution.text); break; } else if (result.status === "failed") { console.error("Error:", result.errorDescription); break; }
await new Promise(r => setTimeout(r, 5000)); }}# Encode audio to base64AUDIO_BASE64=$(base64 -w 0 captcha.mp3)
# Create taskcurl -X POST https://api.ucaptcha.net/createTask \ -H "Content-Type: application/json" \ -d "{ \"clientKey\": \"YOUR_API_KEY\", \"task\": { \"type\": \"AudioToTextTask\", \"body\": \"$AUDIO_BASE64\", \"lang\": \"en\" } }"
# Poll for result if not immediately ready (replace TASK_ID)curl -X POST https://api.ucaptcha.net/getTaskResult \ -H "Content-Type: application/json" \ -d '{ "clientKey": "YOUR_API_KEY", "taskId": "TASK_ID" }'Provider Coverage
Section titled “Provider Coverage”- 2Captcha
Aliases
Section titled “Aliases”The following legacy type name is also accepted for backward compatibility:
AudioTask