API 接口

带时间戳歌词

POST/v2/timestamped-lyrics

带时间戳的歌词 API

检索生成曲目的字级歌词时间戳、波形数据和对齐见解。

POSThttps://udioapi.pro/api/v2/timestamped-lyrics

tips

生成完成后调用此端点以获取定时歌词。

提供audio_idtask_id

requestHeaders

namerequireddescription
Authorizationyes用于身份验证的承载令牌
Content-Typeyesapplication/json

requestBody

提供两个标识符以进行比对查找

commonParams

paramNameparamTyperequireddescriptionexample
audio_idstringyes来自提要或回调的音频资产 IDfc490335-ad97-4444-ac64-0fb21c0d4308
task_idstringyes由generate或extend返回的生成任务标识符gen2b9bb36e6c0cc44567aa34fbcff3afa64bksv

responses

json
{
  "code": 200,
  "message": "success",
  "data": {
    "lyricAlignment": {
      "words": [
        {
          "text": "[Verse]\nLola ",
          "aligned": true,
          "startTime": 0.55851,
          "endTime": 0.87766,
          "confidence": 0
        },
        {
          "text": "Chouch, ",
          "aligned": true,
          "startTime": 0.91755,
          "endTime": 1.91489,
          "confidence": 0
        }
      ]
    },
    "audioWaveform": [
      0.00006,
      0,
      0.0339
    ],
    "alignmentScore": 0.175,
    "isStreaming": false
  }
}
json
{
  "code": 401,
  "message": "Missing or invalid Authorization header. Use 'Bearer YOUR_API_KEY'",
  "data": null
}
json
{
  "code": 400,
  "message": "Task ID and Audio ID are required, please provide both task_id and audio_id in the request body",
  "data": null
}
json
{
  "code": 400,
  "message": "Invalid task id",
  "data": null
}
json
{
  "code": 400,
  "message": "Your request is being processed. Please wait until it completes.",
  "status": "IN_PROGRESS",
  "data": null
}
json
{
  "code": 400,
  "message": "Audio ID does not match the Task ID, please check and try again",
  "data": null
}
json
{
  "code": 500,
  "message": "Internal Server Error, please try again later",
  "data": null
}

codeExamples

curl
curl -X POST "https://udioapi.pro/api/v2/timestamped-lyrics" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "audio_id": "fc490335-ad97-4e08-ac64-0fb91c0d4308",
    "task_id": "gen2b9bb36e6c0cc47969aa34fbcff3afa64bksv"
  }'
javascript
const response = await $fetch("https://udioapi.pro/api/v2/timestamped-lyrics", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: {
    audio_id: "fc490335-ad97-4e08-ac64-0fb91c0d4308",
    task_id: "gen2b9bb36e6c0cc47969aa34fbcff3afa64bksv",
  },
});

const { data } = response;
const lyricWords = data.lyricAlignment.words;
const waveform = data.audioWaveform;