Speech to Text (ASR)
Convert the speech content in an audio or video file into text. Supports multiple language codes and can return sentence-level or word-level timestamps. If you already have the exact script, pass it in for script alignment to get timestamps for every sentence and word of your script. For multi-person conversations, speaker diarization labels every sentence with who said it.
Create Task
Basic Information
| Item | Value |
|---|---|
| Request Method | POST |
| Request Path | /task/asr |
| Content-Type | application/json |
| Authentication | Raw API key in the Authorization header |
Request Body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file_id | string | Yes | - | Uploaded audio or video file ID |
language | string | No | "zh-CN" | Standard locale language code. See the full supported list below |
word_level | boolean | No | false | Whether to return word-level timestamps. Word-level timestamps cover these 18 languages: zh-CN, zh-HK, en-US, ja-JP, ko-KR, fr-FR, de-DE, it-IT, es-ES, es-MX, pt-PT, pt-BR, ru-RU, ar-SA, fil-PH, id-ID, ms-MY, th-TH. For any other language, word_tc_list is empty and word_count is 0; sentence-level results and the full text are unaffected |
script_text | string | No | - | Known script text, up to 20000 characters. A non-empty script switches the task to script alignment mode: no content recognition, timestamps are produced for your script |
speaker_diarization | boolean | No | false | When true, enables speaker diarization: every sentence gets a speaker number; priced separately |
speaker_count | number | No | - | Known number of speakers (2–10). Only valid with speaker_diarization: true; detected automatically when omitted |
Supported Language Codes
Pass the standardized locale code in language. The current implementation accepts 103 values:
Codes outside this list are rejected at submission time with
400/ error code6015. No credits are charged and no task is queued; the error message suggests an actionable alternative (for Cantonese, usezh-HK).
Request language | Language name |
|---|---|
zh-CN | Chinese (China) |
en-US | English (United States) |
ja-JP | Japanese (Japan) |
ko-KR | Korean (South Korea) |
fr-FR | French (France) |
de-DE | German (Germany) |
es-MX | Spanish (Mexico) |
es-ES | Spanish (Spain) |
pt-BR | Portuguese (Brazil) |
pt-PT | Portuguese (Portugal) |
ru-RU | Russian (Russia) |
zh-HK | Chinese (Hong Kong SAR China) |
id-ID | Indonesian (Indonesia) |
fil-PH | Filipino (Philippines) |
ms-MY | Malay (Malaysia) |
th-TH | Thai (Thailand) |
ar-SA | Arabic (Saudi Arabia) |
af-ZA | Afrikaans (South Africa) |
am-ET | Amharic (Ethiopia) |
as-IN | Assamese (India) |
az-AZ | Azerbaijani (Azerbaijan) |
ba-RU | Bashkir (Russia) |
be-BY | Belarusian (Belarus) |
bg-BG | Bulgarian (Bulgaria) |
bn-IN | Bangla (India) |
bo-CN | Tibetan (China) |
br-FR | Breton (France) |
bs-BA | Bosnian (Bosnia & Herzegovina) |
ca-ES | Catalan (Spain) |
cs-CZ | Czech (Czechia) |
cy-GB | Welsh (United Kingdom) |
da-DK | Danish (Denmark) |
el-GR | Greek (Greece) |
et-EE | Estonian (Estonia) |
eu-ES | Basque (Spain) |
fa-IR | Persian (Iran) |
fi-FI | Finnish (Finland) |
fo-FO | Faroese (Faroe Islands) |
gl-ES | Galician (Spain) |
gu-IN | Gujarati (India) |
ha-NG | Hausa (Nigeria) |
haw-US | Hawaiian (United States) |
he-IL | Hebrew (Israel) |
hi-IN | Hindi (India) |
hr-HR | Croatian (Croatia) |
ht-HT | Haitian Creole (Haiti) |
hu-HU | Hungarian (Hungary) |
hy-AM | Armenian (Armenia) |
is-IS | Icelandic (Iceland) |
it-IT | Italian (Italy) |
jw-ID | Javanese (Indonesia) |
ka-GE | Georgian (Georgia) |
kk-KZ | Kazakh (Kazakhstan) |
km-KH | Khmer (Cambodia) |
kn-IN | Kannada (India) |
la-VA | Latin (Vatican City) |
lb-LU | Luxembourgish (Luxembourg) |
ln-CD | Lingala (Congo - Kinshasa) |
lo-LA | Lao (Laos) |
lt-LT | Lithuanian (Lithuania) |
lv-LV | Latvian (Latvia) |
mg-MG | Malagasy (Madagascar) |
mi-NZ | Māori (New Zealand) |
mk-MK | Macedonian (North Macedonia) |
ml-IN | Malayalam (India) |
mn-MN | Mongolian (Mongolia) |
mr-IN | Marathi (India) |
mt-MT | Maltese (Malta) |
my-MM | Burmese (Myanmar (Burma)) |
ne-NP | Nepali (Nepal) |
nl-NL | Dutch (Netherlands) |
nn-NO | Norwegian Nynorsk (Norway) |
no-NO | Norwegian (Norway) |
oc-FR | Occitan (France) |
pa-IN | Punjabi (India) |
pl-PL | Polish (Poland) |
ps-AF | Pashto (Afghanistan) |
ro-RO | Romanian (Romania) |
sa-IN | Sanskrit (India) |
sd-IN | Sindhi (India) |
si-LK | Sinhala (Sri Lanka) |
sk-SK | Slovak (Slovakia) |
sl-SI | Slovenian (Slovenia) |
sn-ZW | Shona (Zimbabwe) |
so-SO | Somali (Somalia) |
sq-AL | Albanian (Albania) |
sr-RS | Serbian (Serbia) |
su-ID | Sundanese (Indonesia) |
sv-SE | Swedish (Sweden) |
sw-KE | Swahili (Kenya) |
ta-IN | Tamil (India) |
te-IN | Telugu (India) |
tg-TJ | Tajik (Tajikistan) |
tk-TM | Turkmen (Turkmenistan) |
tl-PH | Filipino (Philippines) |
tr-TR | Turkish (Türkiye) |
tt-RU | Tatar (Russia) |
uk-UA | Ukrainian (Ukraine) |
ur-PK | Urdu (Pakistan) |
uz-UZ | Uzbek (Uzbekistan) |
vi-VN | Vietnamese (Vietnam) |
yi-DE | Yiddish (Germany) |
yo-NG | Yoruba (Nigeria) |
Tip:
fil-PHandtl-PHare both accepted. For Cantonese content from Hong Kong, preferzh-HK.
Script Alignment Mode
Built for read-from-script audio such as voice-overs and talking-head recordings: you already have the exact script and only need where it falls in the audio. When script_text is passed:
- No content recognition:
asr_textis your script verbatim,sentence_tc_listfollows the sentences of your script (sentence text without sentence-break punctuation), andword_tc_listgives a timestamp for every word or character of the script — non-empty regardless ofword_level. - Only these 13 languages:
zh-CN,zh-HK,en-US,ja-JP,ko-KR,fr-FR,de-DE,it-IT,es-ES,es-MX,pt-PT,pt-BR,ru-RU. Any otherlanguagein script alignment mode is rejected at submission time with400/ error code6015(the message lists the usable codes). No credits are charged and no task is queued. - The script must broadly match the audio: small word differences are usually fine; large mismatches, such as a whole paragraph that was never read or a different script altogether, make the task fail (it does not fall back to recognition results).
- Same output format as recognition mode, with one extra
output_resultkey:mode, whose value isscript. - Billed the same as recognition mode (per minute of audio). A script longer than 20000 characters, or one that is not a string, is rejected at submission time with
400/ error code6016, free of charge.
Speaker Diarization
For multi-person conversations such as meetings, interviews and podcasts, pass speaker_diarization: true and every sentence of the same transcript is labeled with who said it:
- Every sentence carries a speaker number:
sentence_tc_list[].speakerstarts at 1, numbered in order of who speaks first. You also getspeaker_list(total speaking seconds per person) andspeaker_segments(speaker time ranges, handy for drawing a timeline or jumping to someone's voice). Numbers are only meaningful within this file; you name who number 1 is. - Pass
speaker_countif you know it (2–10): without it the number of speakers is detected automatically, which now and then splits one person into an extra speaker with only a line or two. Passing the count avoids that. - Always recognized as
word_level: true: sentences keep their punctuation so the transcript reads well; theword_levelyou pass has no effect in this mode. - Short interjections are sometimes misattributed: very short replies like “yeah” or “mm” are occasionally credited to the person speaking next to them; longer turns are almost always right.
- Not combinable with
script_text: sentences in script alignment come from splitting your script, so the two modes are not combined for now. - Priced separately: billed per minute as “Speech to Text · Speaker Diarization”; see the price list (expand Speech to Text). If speaker diarization fails, the task fails and is refunded rather than returning a transcript without speakers.
- A
speaker_countthat is not an integer from 2 to 10, aspeaker_countwithoutspeaker_diarization: true,speaker_diarizationtogether withscript_text, or a non-booleanspeaker_diarizationis rejected at submission time with400/ error code6016, free of charge.
Request Example
curl -X POST https://api.ai-mcn.tv:10000/task/asr \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"file_id": "537489015178246",
"language": "zh-CN",
"word_level": true
}'
Script alignment mode (with script_text):
curl -X POST https://api.ai-mcn.tv:10000/task/asr -H "Authorization: YOUR_API_KEY" -H "Content-Type: application/json" -d '{
"file_id": "537489015178246",
"language": "en-US",
"script_text": "Today we talk about engineering discipline. Ship it, then talk."
}'
Success Example
{
"code": 200,
"msg": "success",
"data": {
"task_id": "537489015178247",
"task_type": "asr",
"status": "queued"
}
}
Query Task Result
Basic Information
| Item | Value |
|---|---|
| Request Method | GET |
| Request Path | /task/asr/{task_id} |
| Authentication | Raw API key in the Authorization header |
Output Result (output_result)
The full transcription is delivered as a JSON file (its size grows linearly with audio duration).
output_resultitself only carries the file reference plus a summary. Downloadasr_result_download_urlto get the complete transcription JSON.
| Parameter | Type | Description |
|---|---|---|
asr_result_file_id | string | File ID of the full transcription JSON |
asr_result_download_url | string | Download URL of the full transcription JSON |
text_preview | string | Preview of the recognized text (first 500 characters) |
word_count | number | Number of word-level timestamp entries |
sentence_count | number | Number of sentence-level timestamp entries |
text_length | number | Total character count of the full recognized text |
mode | string | Present only in script alignment mode, with value script; absent in recognition mode |
speaker_count | number | Present only with speaker diarization: number of speakers |
Transcription File Content (JSON downloaded from asr_result_download_url)
| Parameter | Type | Description |
|---|---|---|
asr_text | string | Full recognition text (the script verbatim in script alignment mode) |
sentence_tc_list | array | Sentence-level timestamp list |
sentence_tc_list[].text | string | Sentence text. Keeps the original punctuation (commas, periods, question marks, etc.) when word_level: true; punctuation is stripped when word_level: false. Token text in word_tc_list never carries punctuation in either mode |
sentence_tc_list[].start_time | number | Sentence start time |
sentence_tc_list[].end_time | number | Sentence end time |
word_tc_list | array | Word-level timestamps. In recognition mode, non-empty only when word_level: true and the language is covered by word-level timestamps; always non-empty in script alignment mode |
word_tc_list[].text | string | Word or token text |
word_tc_list[].start_time | number | Start time |
word_tc_list[].end_time | number | End time |
sentence_tc_list[].speaker | number | Present only with speaker diarization: the speaker number of this sentence, starting at 1 |
speaker_list | array | Present only with speaker diarization: [{speaker, duration_sec}], total speaking seconds per person |
speaker_segments | array | Present only with speaker diarization: [{speaker, start_time, end_time}], speaker time ranges in seconds |
The transcription file shares the same lifecycle as other media outputs (cleaned up on expiry). Download and archive it promptly after the task completes.
Success Example
{
"code": 200,
"msg": "success",
"data": {
"task_id": "537489015178247",
"status": "completed",
"progress": 100,
"output_result": {
"asr_result_file_id": "537489015178301",
"asr_result_download_url": "https://api.ai-mcn.tv:9000/cloud/file/ab/537489015178301.json",
"text_preview": "Hello world, this is a test clip.",
"word_count": 2,
"sentence_count": 1,
"text_length": 33
},
"create_time": "2026-04-05T08:00:00Z",
"update_time": "2026-04-05T08:00:10Z"
}
}
Transcription File Example (downloaded content)
{
"asr_text": "Hello world, this is a test clip.",
"sentence_tc_list": [
{ "text": "Hello world, this is a test clip.", "start_time": 0.0, "end_time": 3.5 }
],
"word_tc_list": [
{ "text": "Hello", "start_time": 0.0, "end_time": 0.6 },
{ "text": "world", "start_time": 0.6, "end_time": 1.1 }
]
}
Transcription file with speaker diarization (excerpt):
{
"asr_text": "Let's start with this page. Sure.",
"sentence_tc_list": [
{ "text": "Let's start with this page.", "start_time": 0.0, "end_time": 2.0, "speaker": 1 },
{ "text": "Sure.", "start_time": 2.2, "end_time": 2.8, "speaker": 2 }
],
"word_tc_list": [],
"speaker_list": [
{ "speaker": 1, "duration_sec": 2.1 },
{ "speaker": 2, "duration_sec": 0.8 }
],
"speaker_segments": [
{ "speaker": 1, "start_time": 0.0, "end_time": 2.1 },
{ "speaker": 2, "start_time": 2.1, "end_time": 2.9 }
]
}
Error Codes
| Error Code | HTTP Status | Description | Resolution |
|---|---|---|---|
6013 | 400 | Missing file_id | Pass the file_id field |
6015 | 400 | Unsupported language code (in script alignment mode: not one of the 13 alignment languages) | Switch to a code from the table above, or to an alignment language in script alignment mode. The error message suggests usable codes |
6016 | 400 | script_text is longer than 20000 characters or is not a string; speaker_count is not an integer from 2 to 10 or is passed without speaker_diarization: true; speaker_diarization is passed with script_text or is not a boolean | Fix the parameter named in the error message and try again |
6004 | 404 | File not found | Verify the file_id |
6502 | 401 | Authentication failed | Check the Authorization header |
6202 | 402 | Insufficient balance | Recharge in the Dashboard |