API 接口

WAV 转换

POST/v2/wav/generate

创建 WAV 转换任务

将已有音乐生成任务中的一个音频结果创建为 WAV 转换任务。

POSThttps://udioapi.pro/api/v2/wav/generate

tips

请使用音乐生成接口返回的 task_id,以及所选结果的 audio_id

创建后返回的 wav... taskId 是轮询、日志和 Webhook 唯一使用的 ID。建议每 5-10 秒轮询一次。

requestHeaders

namerequireddescription
nameAuthorizationrequiredyesdescription用于鉴权并将任务限定到当前账户的 Bearer API Key
nameContent-TyperequiredyesdescriptionJSON 请求体

requestBody

来源音乐任务、所选音频结果和可选的 Webhook 地址

commonParams

paramNameparamTyperequireddescriptionexample
paramNametask_idparamTypestringrequiredyesdescription我方 Udio API 音乐生成 taskIdexamplegen2abc123def456bksv
paramNameaudio_idparamTypestringrequiredyesdescription来源任务结果中的音频 IDexamplee231f197-6bcb-4d70-bb8f-749b7f3272b8
paramNamecallback_urlparamTypestringrequirednodescription接收 WAV 最终状态的 HTTPS 地址examplehttps://api.example.com/webhooks/wav

responses

json
{
  "code": 200,
  "message": "success",
  "workId": "wav7f93c2a18d4e4d61b63d2fd142f31c90",
  "data": {
    "task_id": "wav7f93c2a18d4e4d61b63d2fd142f31c90",
    "status": "IN_PROGRESS"
  }
}
json
{
  "code": 401,
  "message": "No API key provided in Authorization header",
  "data": null
}
json
{
  "code": 403,
  "message": "You do not have access to this music task",
  "data": null
}
json
{
  "code": 404,
  "message": "Original music task not found",
  "data": null
}
json
{
  "code": 422,
  "message": "task_id and audio_id are required",
  "data": null
}
json
{
  "code": 500,
  "message": "Internal Server Error",
  "data": null
}

codeExamples

curl
curl -X POST "https://udioapi.pro/api/v2/wav/generate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task_id": "gen2abc123def456bksv",
    "audio_id": "e231f197-6bcb-4d70-bb8f-749b7f3272b8",
    "callback_url": "https://api.example.com/webhooks/wav"
  }'
javascript
const response = await fetch('https://udioapi.pro/api/v2/wav/generate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    task_id: 'gen2abc123def456bksv',
    audio_id: 'e231f197-6bcb-4d70-bb8f-749b7f3272b8',
    callback_url: 'https://api.example.com/webhooks/wav'
  })
});

const result = await response.json();
console.log(result.data.task_id);
GET/v2/wav/status

查询 WAV 转换状态

使用创建接口返回的 WAV taskId 查询当前状态和 WAV 结果地址。

GEThttps://udioapi.pro/api/v2/wav/status

tips

状态值:IN_PROGRESS、SUCCESS、FAILED、ERROR。

此接口只接受我方 WAV taskId,不需要也不会返回 provider taskId。

requestHeaders

namerequireddescription
nameAuthorizationrequiredyesdescription用于鉴权并将任务限定到当前账户的 Bearer API Key

requestParams

paramNameparamTyperequireddescription
paramNametask_idparamTypestringrequiredyesdescription创建接口返回的 WAV taskId

responses

json
{
  "code": 200,
  "message": "success",
  "data": {
    "type": "IN_PROGRESS",
    "task_id": "wav7f93c2a18d4e4d61b63d2fd142f31c90",
    "audio_wav_url": "",
    "created_at": "2026-07-18 03:20:00",
    "updated_at": "2026-07-18 03:20:00",
    "error_message": null
  }
}
json
{
  "code": 200,
  "message": "success",
  "data": {
    "type": "SUCCESS",
    "task_id": "wav7f93c2a18d4e4d61b63d2fd142f31c90",
    "audio_wav_url": "https://cdn.example.com/audio/converted.wav",
    "created_at": "2026-07-18 03:20:00",
    "updated_at": "2026-07-18 03:21:06",
    "error_message": null
  }
}
json
{
  "code": 200,
  "message": "success",
  "data": {
    "type": "FAILED",
    "task_id": "wav7f93c2a18d4e4d61b63d2fd142f31c90",
    "audio_wav_url": "",
    "created_at": "2026-07-18 03:20:00",
    "updated_at": "2026-07-18 03:21:06",
    "error_message": "WAV conversion failed"
  }
}
json
{
  "code": 401,
  "message": "No API key provided in Authorization header",
  "data": null
}
json
{
  "code": 403,
  "message": "You do not have access to this WAV conversion task",
  "data": null
}
json
{
  "code": 404,
  "message": "WAV conversion task not found",
  "data": null
}
json
{
  "code": 422,
  "message": "task_id is required",
  "data": null
}

codeExamples

curl
curl -X GET "https://udioapi.pro/api/v2/wav/status?task_id=wav7f93c2a18d4e4d61b63d2fd142f31c90" \
  -H "Authorization: Bearer YOUR_API_KEY"
javascript
async function pollWav(taskId) {
  while (true) {
    const response = await fetch(
      'https://udioapi.pro/api/v2/wav/status?task_id=' + encodeURIComponent(taskId),
      { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
    );
    const result = await response.json();

    if (['SUCCESS', 'FAILED', 'ERROR'].includes(result.data?.type)) {
      return result;
    }

    await new Promise(resolve => setTimeout(resolve, 5000));
  }
}
POSTcallback_url

WAV 转换 Webhook

提供 callback_url 后,最终状态会使用与状态接口相同的 WAV taskId 发送到该地址。

POSTcallback_url

tips

请尽快返回 2xx。投递沿用现有的单次回调策略。

payload 不会包含 provider taskId 或 provider 原始响应。

requestBody

json
{
  "code": 200,
  "message": "success",
  "data": {
    "type": "SUCCESS",
    "task_id": "wav7f93c2a18d4e4d61b63d2fd142f31c90",
    "audio_wav_url": "https://cdn.example.com/audio/converted.wav",
    "error_message": null
  }
}

codeExamples

javascript
app.post('/webhooks/wav', express.json(), (req, res) => {
  const { type, task_id, audio_wav_url, error_message } = req.body.data;

  if (type === 'SUCCESS') {
    console.log('WAV ready', task_id, audio_wav_url);
  } else {
    console.error('WAV failed', task_id, error_message);
  }

  res.status(200).json({ received: true });
});