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 input channels to annotate. For a multichannel recording, you can specify multiple indices.
NoteTrack separation requires mono input (channel 0).
audio_separation_enabledbooleanOptionalWhether to enable audio track separation. The default is false, which returns annotations only. Set to true to separate speakers or singing vocals from background audio.
audio_separation_max_spkintegerOptionalMaximum number of speakers when track separation is enabled. Set this to the expected speaker count or slightly higher, for example 3. If the model detects more speakers than the limit, it skips separation but still returns the annotations.
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.
Standard tagging
Submit the task
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/en/audios/6a4b3c2d1e0f9092.wav"
},
"parameters": {"channel_id": [0]}
}'
Submission response (excerpt)
{
"output": {
"task_id": "12345678-abcd-4abc-8123-123456789abc",
"task_status": "PENDING"
},
"request_id": "01234567-abcd-4abc-8234-123456789abc"
}
Track separation
Submit the task
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://cdn.jsdelivr.net/gh/pyannote/pyannote-audio@b5794f46d16f85de1551a7080658b6de7d62046f/tutorials/assets/sample.wav"
},
"parameters": {
"channel_id": [0],
"audio_separation_enabled": true,
"audio_separation_max_spk": 3
}
}'
Submission response (excerpt)
{
"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.
Query the task status
curl "https://${WORKSPACE_ID}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/${TASK_ID}" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"
Response when the task succeeds
{
"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/en/audios/6a4b3c2d1e0f9092.wav",
"subtask_status": "SUCCEEDED",
"transcription_url": "https://example.com/result.json?signature=..."
}
}
Download and parse the result
Set TRANSCRIPTION_URL to output.transcription_url from the successful task response. The following command saves the result as annotation.json, which contains input audio metadata, annotations for each channel, and token usage.
curl --fail "$TRANSCRIPTION_URL" -o annotation.json
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.
audio_filesarray[string]Download URLs for the output audio files.
NoteReturned only when track separation is enabled (audio_separation_enabled is true).
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.
Track separation results
When track separation is enabled, parse transcripts[0].text to read these fields. After successful separation, stem in each speech, sound effect, or background segment identifies its zero-based channel in the output WAV file.
noise_stemintegerZero-based index of the background channel.
assignmentobjectMaps each speaker ID to a track. For example, if assignment.SPK_0.stem is 0, that speaker is on the first channel of the WAV file.
separatedbooleanWhether the model separated the tracks.
stems_wavstringTemporary signed URL for the multichannel WAV file. When separated is true, download and save the file before the URL expires. Each channel in the file contains one track.
n_stemsintegerTotal number of tracks in the WAV file, including the background track.
n_speakersintegerNumber of speakers detected.
reasonstringWhy the model skipped separation, for example because the detected speaker count exceeded the limit.
Standard tagging
Parsed annotations from the English recording (excerpt)
The transcript is shown as returned. Descriptive labels and summaries are translated into English here. The API values for speech_mode, speed, and volume are shown unchanged: announcement, moderate speed, and moderate volume, respectively.
{
"sound_segments": [
{
"start_time": "00:00.00",
"end_time": "00:03.68",
"tag": [
"Synthetic female voice"
],
"description": "Clear synthetic speech at a steady volume, with little change in emotion."
}
],
"speech_segments": [
{
"start": "00:00.00",
"end": "00:03.68",
"language": [
"General American English"
],
"text": "Please send the quarterly project report to Kellera before Friday.",
"para": {
"speech_mode": "播报",
"speed": "中速",
"volume": "中等",
"intonation": "Formal, even delivery with a falling tone at the end.",
"speaker": [
"Office announcer"
],
"speaker_index": [
"SPK_0"
]
}
}
],
"background_segments": [
{
"start_time": "00:00.00",
"end_time": "00:03.68",
"description": [
"Quiet background."
]
}
],
"speech_globals": {
"speakers": [
{
"speaker_index": "SPK_0",
"role": "Office announcer",
"description": "A clear female voice delivers a workplace instruction in an even tone.",
"voice": {
"nature": [
"Formal",
"Neutral",
"Precise"
],
"texture": [
"Bright",
"Clear",
"Synthetic"
]
}
}
]
},
"global": {
"scene": {
"description": "An off-screen voice gives a work instruction.",
"format": [
"Workplace scene"
],
"topic": [
"Work assignment"
],
"style": [
"Serious and formal",
"Calm and focused"
]
},
"emotion": {
"overall": [
"Neutral and formal",
"Matter-of-fact"
],
"flow": [
[
"Giving the instruction",
"The tone stays even throughout the instruction."
]
]
}
}
}
Read speech and background segments
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"])
Track separation
The following excerpts show the parsed annotations for the English conversation used in the track separation request.
Separation succeeded: Channels 0 and 1 each contain one speaker, and channel 2 contains the background audio.
{
"noise_stem": 2,
"assignment": {
"SPK_1": {"stem": 1},
"SPK_0": {"stem": 0}
},
"separated": true,
"stems_wav": "https://example.com/tracks.wav?signature=...",
"n_stems": 3,
"n_speakers": 2
}
Separation skipped: The speaker limit was set to 1, but the model detected 2 speakers. The reason message is shown in English here.
{
"reason": "Detected 2 speakers, exceeding the limit of 1. Track separation was skipped.",
"n_speakers": 2,
"separated": false
}