Audio tagging HTTP API

Updated at:

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.

POSThttps://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/asr/transcription

Request headers

AuthorizationstringRequired

Bearer $DASHSCOPE_API_KEY.

Content-TypestringRequired

application/json

X-DashScope-AsyncstringRequired

Set to enable to process the file asynchronously.

Request body

modelstringRequired

Audio annotation model ID, such as qwen-audio-3.1-captioner.

inputobjectRequired
file_urlstringRequired

HTTP(S) download URL of a single audio or video file.

parametersobjectOptional
channel_idarray[integer]Optional

Zero-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_enabledbooleanOptional

Whether 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_spkintegerOptional

Maximum 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

outputobject
task_idstring

Task ID generated by the service. Save it to query the task.

task_statusstring

Task status.

request_idstring

ID 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.

GEThttps://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}

Path parameter

task_idstringRequired

Task ID returned at submission.

Response fields

request_idstring

ID of this request. Use it for troubleshooting.

outputobject
task_idstring

Task ID generated by the service. Save it to query the task.

task_statusstring

Task 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_timestring

Time the task was submitted.

scheduled_timestring

Time the task was scheduled.

end_timestring

Time the task ended.

file_urlstring

URL of the input file.

subtask_statusstring

Processing status of the input file. SUCCEEDED means the annotation file is ready.

transcription_urlstring

Download 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_urlstring

URL of the input file.

propertiesobject

Properties of the input audio.

audio_formatstring

Audio encoding, such as pcm_s16le.

channelsarray[integer]

Channel indices.

original_sampling_rateinteger

Sample rate of the source audio, in Hz.

original_duration_in_millisecondsinteger

Duration of the source audio, in milliseconds.

transcriptsarray[object]

One entry per channel.

channel_idinteger

Channel index.

content_duration_in_millisecondsinteger

Annotated duration of the channel, in milliseconds.

textstring

JSON string containing the annotations for this channel.

sentencesarray[object]

Annotations for individual segments in the channel.

begin_timeinteger

Start offset in milliseconds.

end_timeinteger

End offset in milliseconds.

textstring

Annotation text for this segment.

speaker_idinteger

Speaker 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).

usageobject

Token usage for this task.

input_tokensinteger

Input token count.

output_tokensinteger

Output token count.

total_tokensinteger

Total 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_timestring

Start 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_timestring

End time relative to the start of the current segment, in MM:SS.cc.

tagarray[string]

Labels for the acoustic event.

descriptionstring

Description of the sound, or an empty string if absent.

speech_segmentsarray[object]

Speech segments.

startstring

Start 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.

endstring

End 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.

textstring

Transcript with inline annotations for speakers, tone, or vocal events.

paraobject

Delivery and speaker information for the segment.

speech_modestring

Mode of delivery. Values:

  • 唱歌 (singing)
  • 说唱 (rapping)
  • 朗诵 (recitation)
  • 播报 (announcement)
  • 解说 (commentary)
  • 讲解 (explanation)
  • 演讲 (speech)
  • 讲故事 (storytelling)
  • 访谈 (interview)
  • 闲聊 (conversation)
  • 独白 (monologue)
  • 无人声 (no speech)
speedstring

Speech rate. Empty when no speech is present. Other values:

  • 极慢 (very slow)
  • 偏慢 (slow)
  • 中速 (moderate)
  • 偏快 (fast)
  • 极快 (very fast)
  • 短促 (clipped)
volumestring

Volume. Empty when no speech is present. Other values:

  • 轻声 (soft)
  • 中等 (moderate)
  • 偏大 (loud)
  • 高亢 (projected)
intonationstring

Description 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_timestring

Start 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_timestring

End time relative to the start of the current segment, in MM:SS.cc.

descriptionarray[string]

Descriptions of the background sounds.

speech_globalsobject

Speaker information for the recording.

speakersarray[object]

Descriptions grouped by speaker.

speaker_indexstring

Speaker identifier, such as SPK_0.

rolestring

Descriptive role of the speaker.

genderstring

Perceived gender characteristics of the voice.

agestring

Estimated age range based on the voice.

namestring

Name, if identified.

descriptionstring

Overall description of the speaker.

voiceobject

Voice characteristics.

naturearray[string]

Labels describing the character of the voice.

texturearray[string]

Labels describing vocal timbre.

globalobject

Scene and emotion descriptions for the recording.

sceneobject

Overall scene.

descriptionstring

Scene description.

formatarray[string]

Content formats.

topicarray[string]

Topics covered.

stylearray[string]

Style labels.

emotionobject

Emotions 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_steminteger

Zero-based index of the background channel.

assignmentobject

Maps 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.

separatedboolean

Whether the model separated the tracks.

stems_wavstring

Temporary 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_stemsinteger

Total number of tracks in the WAV file, including the background track.

n_speakersinteger

Number of speakers detected.

reasonstring

Why 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
}