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 channels to annotate. Use [0] for a mono recording, or specify multiple indices for a multichannel file.

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.

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.

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.

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

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.

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": [
        [
          "指令传达",
          "语调平稳。"
        ]
      ]
    }
  }
}