Audio tagging HTTP API
Submit a recording for asynchronous annotation. Retrieve time-aligned speech, sound effects, and background sounds, along with a description of the recording as a whole.
NoteThe examples use China (Beijing). Set WORKSPACE_ID to your workspace ID and DASHSCOPE_API_KEY to your API key for this region.
Submit a task
Submit an audio or video file to create an asynchronous annotation task.
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/asr/transcriptionRequest headers
AuthorizationstringRequiredBearer $DASHSCOPE_API_KEY.
Content-TypestringRequiredapplication/json
X-DashScope-AsyncstringRequiredSet to enable to process the file asynchronously.
Request body
modelstringRequiredAudio annotation model ID, such as qwen-audio-3.1-captioner.
inputobjectRequiredfile_urlstringRequiredHTTP(S) download URL of a single audio or video file.
parametersobjectOptionalchannel_idarray[integer]OptionalZero-based indices of the channels to annotate. Use [0] for a mono recording, or specify multiple indices for a multichannel file.
Response fields
outputobjecttask_idstringTask ID generated by the service. Save it to query the task.
task_statusstringTask status.
request_idstringID of this request. Use it for troubleshooting.
curl --request POST "https://${WORKSPACE_ID}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/asr/transcription" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header "Content-Type: application/json" \
--header "X-DashScope-Async: enable" \
--data '{
"model": "qwen-audio-3.1-captioner",
"input": {
"file_url": "https://g-adoc.alcasset.com/media/maas_docs/sfm-cn/zh/audios/6a4b3c2d1e0f9093.wav"
},
"parameters": {"channel_id": [0]}
}'
{
"output": {
"task_id": "12345678-abcd-4abc-8123-123456789abc",
"task_status": "PENDING"
},
"request_id": "01234567-abcd-4abc-8234-123456789abc"
}
Query a task
Query the processing status by task ID. When the task succeeds, the response includes the download URL for the annotations.
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}Path parameter
task_idstringRequiredTask ID returned at submission.
Response fields
request_idstringID of this request. Use it for troubleshooting.
outputobjecttask_idstringTask ID generated by the service. Save it to query the task.
task_statusstringTask status:
PENDING: Queued. Poll again later.RUNNING: Processing. Poll again later.SUCCEEDED: The task succeeded. Check the file status and download the result.FAILED: The task failed.CANCELED: The task was canceled.
submit_timestringTime the task was submitted.
scheduled_timestringTime the task was scheduled.
end_timestringTime the task ended.
file_urlstringURL of the input file.
subtask_statusstringProcessing status of the input file. SUCCEEDED means the annotation file is ready.
transcription_urlstringDownload URL for the result file, valid for 24 hours after success. Use the complete URL, including its query string.
curl "https://${WORKSPACE_ID}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/${TASK_ID}" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"
{
"request_id": "01234567-abcd-4abc-8234-123456789abc",
"output": {
"task_id": "12345678-abcd-4abc-8123-123456789abc",
"task_status": "SUCCEEDED",
"submit_time": "2026-11-23 11:00:00.000",
"scheduled_time": "2026-11-23 11:00:01.000",
"end_time": "2026-11-23 11:00:08.000",
"file_url": "https://g-adoc.alcasset.com/media/maas_docs/sfm-cn/zh/audios/6a4b3c2d1e0f9093.wav",
"subtask_status": "SUCCEEDED",
"transcription_url": "https://example.com/result.json?signature=..."
}
}
Download and parse the result
After the task succeeds, download the result file. It contains input audio metadata, annotations for each channel, and token usage.
Result file
file_urlstringURL of the input file.
propertiesobjectProperties of the input audio.
audio_formatstringAudio encoding, such as pcm_s16le.
channelsarray[integer]Channel indices.
original_sampling_rateintegerSample rate of the source audio, in Hz.
original_duration_in_millisecondsintegerDuration of the source audio, in milliseconds.
transcriptsarray[object]One entry per channel.
channel_idintegerChannel index.
content_duration_in_millisecondsintegerAnnotated duration of the channel, in milliseconds.
textstringJSON string containing the annotations for this channel.
sentencesarray[object]Annotations for individual segments in the channel.
begin_timeintegerStart offset in milliseconds.
end_timeintegerEnd offset in milliseconds.
textstringAnnotation text for this segment.
speaker_idintegerSpeaker ID, if returned.
usageobjectToken usage for this task.
input_tokensintegerInput token count.
output_tokensintegerOutput token count.
total_tokensintegerTotal input and output token count.
Annotations
Parse transcripts[].text in the result file to read the following fields.
sound_segmentsarray[object]Sound effects and acoustic events.
start_timestringStart time relative to the current audio segment, in MM:SS.cc (minutes:seconds.centiseconds). It can be negative if the event began in an earlier segment.
end_timestringEnd time relative to the start of the current segment, in MM:SS.cc.
tagarray[string]Labels for the acoustic event.
descriptionstringDescription of the sound, or an empty string if absent.
speech_segmentsarray[object]Speech segments.
startstringStart time relative to the current audio segment, in MM:SS.cc (minutes:seconds.centiseconds). It can be negative if the event began in an earlier segment.
endstringEnd time relative to the start of the current segment, in MM:SS.cc.
languagearray[string]Language and accent labels. Empty when no speech is present.
textstringTranscript with inline annotations for speakers, tone, or vocal events.
paraobjectDelivery and speaker information for the segment.
speech_modestringMode of delivery. Values:
唱歌(singing)说唱(rapping)朗诵(recitation)播报(announcement)解说(commentary)讲解(explanation)演讲(speech)讲故事(storytelling)访谈(interview)闲聊(conversation)独白(monologue)无人声(no speech)
speedstringSpeech rate. Empty when no speech is present. Other values:
极慢(very slow)偏慢(slow)中速(moderate)偏快(fast)极快(very fast)短促(clipped)
volumestringVolume. Empty when no speech is present. Other values:
轻声(soft)中等(moderate)偏大(loud)高亢(projected)
intonationstringDescription of intonation, emphasis, and changes in emotion.
speakerarray[string]Speaker roles in this segment.
speaker_indexarray[string]Speaker identifiers that link the segment to the speaker descriptions for the recording.
background_segmentsarray[object]Background music, continuous ambient sound, or quiet intervals.
start_timestringStart time relative to the current audio segment, in MM:SS.cc (minutes:seconds.centiseconds). It can be negative if the event began in an earlier segment.
end_timestringEnd time relative to the start of the current segment, in MM:SS.cc.
descriptionarray[string]Descriptions of the background sounds.
speech_globalsobjectSpeaker information for the recording.
speakersarray[object]Descriptions grouped by speaker.
speaker_indexstringSpeaker identifier, such as SPK_0.
rolestringDescriptive role of the speaker.
genderstringPerceived gender characteristics of the voice.
agestringEstimated age range based on the voice.
namestringName, if identified.
descriptionstringOverall description of the speaker.
voiceobjectVoice characteristics.
naturearray[string]Labels describing the character of the voice.
texturearray[string]Labels describing vocal timbre.
globalobjectScene and emotion descriptions for the recording.
sceneobjectOverall scene.
descriptionstringScene description.
formatarray[string]Content formats.
topicarray[string]Topics covered.
stylearray[string]Style labels.
emotionobjectEmotions and how they change.
overallarray[string]Overall emotion labels.
flowarray[array[string]]Stages of emotional change. Each entry contains a stage title followed by a description.
curl --fail "$TRANSCRIPTION_URL" -o annotation.json
import json
with open("annotation.json", encoding="utf-8") as f:
result = json.load(f)
for channel in result["transcripts"]:
annotation = json.loads(channel["text"])
for segment in annotation["speech_segments"]:
print(channel["channel_id"], segment["start"], segment["end"], segment["text"])
for segment in annotation["background_segments"]:
print(segment["start_time"], segment["end_time"], segment["description"])
{
"sound_segments": [
{
"start_time": "00:00.00",
"end_time": "00:06.08",
"tag": [
"合成语音"
],
"description": "吐字清晰,全程音量稳定。"
}
],
"speech_segments": [
{
"start": "00:00.00",
"end": "00:06.08",
"language": [
"中文-普通话"
],
"text": "[说话人:职场女职员]请把七元项目的报告发给罗科,下周我们要上线玄书系统。",
"para": {
"speech_mode": "播报",
"speed": "中速",
"volume": "中等",
"intonation": "语气正式平稳",
"speaker": [
"职场女职员"
],
"speaker_index": [
"SPK_0"
]
}
}
],
"background_segments": [
{
"start_time": "00:00.00",
"end_time": "00:06.08",
"description": [
"背景环境安静"
]
}
],
"speech_globals": {
"speakers": [
{
"speaker_index": "SPK_0",
"role": "职场女职员",
"description": "声音清亮,语速平稳。",
"voice": {
"nature": [
"干练",
"正式"
],
"texture": [
"清亮"
]
}
}
]
},
"global": {
"scene": {
"description": "说话人正在交代工作安排。",
"format": [
"工作指令传达"
],
"topic": [
"项目工作安排",
"系统上线筹备"
],
"style": [
"正式商务"
]
},
"emotion": {
"overall": [
"中性正式"
],
"flow": [
[
"指令传达",
"语调平稳。"
]
]
}
}
}