Endpoints da API

Estender música

POST/v2/extend

Estenda a API de música

Amplie as faixas de música existentes adicionando novo conteúdo ao final.

POSThttps://udioapi.pro/api/v2/extend

tips

Dois modos: herdar parâmetros originais ou usar parâmetros personalizados.

Use a API Feed com workId retornado para verificar o progresso.

requestHeaders

namerequireddescription
nameAuthorizationrequiredyesdescriptionToken de portador para autenticação
nameContent-Typerequiredyesdescriptionapplication/json

requestBody

O corpo da solicitação suporta modo herdado ou modo personalizado

Modo Herdar

Estenda usando parâmetros de trilha originais

noAdditionalParams

Modo personalizado

Estenda com parâmetros personalizados

paramNameparamTyperequireddescriptionexample
paramNamepromptparamTypestringrequiredyesdescriptionNova letra ou descriçãoexampleChange the music style to be calm and lyrical.
paramNamestyleparamTypestringrequirednodescriptionEstilo musicalexamplelyrical
paramNametitleparamTypestringrequirednodescriptionTítulo da faixaexamplelyrical song
paramNameextensionStartTimeparamTypenumberrequirednodescriptionHora de início em segundos para extensãoexample150
paramNametagsparamTypestringrequirednodescriptionEtiquetas adicionaisexamplewar

commonParams

paramNameparamTyperequireddescriptionexample
paramNameorigin_task_idparamTypestringrequiredyesdescriptionID da tarefa da geração de música originalexamplegen20e094aeaadfe494ea33a5c80ee596083bksv
paramNameextend_audio_indexparamTypenumberrequiredyesdescription0 para o primeiro áudio, 1 para o segundo áudioexample0
paramNamecustom_modeparamTypebooleanrequirednodescriptionfalse para modo herdado, true para modo personalizadoexamplefalse
paramNamecallback_urlparamTypestringrequirednodescriptionURL de webhook opcional para resultados em tempo realexamplehttps://your-domain.com/webhook

responses

json
{
  "code": 200,
  "message": "success",
  "workId": "ext2e31202d4f629447fa75f603ae2470565bksv"
}
json
{
  "code": 400,
  "message": "Please specify which audio to extend. Add \"extend_audio_index\" to your request, using 0 for the first audio or 1 for the second."
}
json
{
  "code": 400,
  "message": "The provided \"origin_task_id\" is invalid or could not be found. Please ensure it corresponds to a successfully completed task associated with your API key."
}
json
{
  "code": 400,
  "message": "The requested audio is not yet completed. Please wait for the task to complete and try again."
}
json
{
  "code": 401,
  "message": "No API key provided in Authorization header"
}
json
{
  "code": 500,
  "message": "Internal Server Error"
}

codeExamples

curl
curl -X POST "https://udioapi.pro/api/v2/extend" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "origin_task_id": "gen20e094aeaadfe494ea33a5c80ee596083bksv",
    "extend_audio_index": 0,
    "custom_mode": false
  }'
curl
curl -X POST "https://udioapi.pro/api/v2/extend" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "origin_task_id": "gen20e094aeaadfe494ea33a5c80ee596083bksv",
    "extend_audio_index": 0,
    "custom_mode": true,
    "prompt": "Change the music style to be calm and lyrical.",
    "style": "lyrical",
    "title": "lyrical song",
    "extensionStartTime": 150,
    "tags": "war"
  }'
javascript
const response = await fetch('https://udioapi.pro/api/v2/extend', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    origin_task_id: 'gen20e094aeaadfe494ea33a5c80ee596083bksv',
    extend_audio_index: 0,
    custom_mode: false
  })
});

const data = await response.json();
console.log(data);
javascript
const response = await fetch('https://udioapi.pro/api/v2/extend', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    origin_task_id: 'gen20e094aeaadfe494ea33a5c80ee596083bksv',
    extend_audio_index: 0,
    custom_mode: true,
    prompt: 'Change the music style to be calm and lyrical.',
    style: 'lyrical',
    title: 'lyrical song',
    extensionStartTime: 150,
    tags: 'war'
  })
});

const data = await response.json();
console.log(data);
python
import requests

url = "https://udioapi.pro/api/v2/extend"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "origin_task_id": "gen20e094aeaadfe494ea33a5c80ee596083bksv",
    "extend_audio_index": 0,
    "custom_mode": False
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
python
import requests

url = "https://udioapi.pro/api/v2/extend"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "origin_task_id": "gen20e094aeaadfe494ea33a5c80ee596083bksv",
    "extend_audio_index": 0,
    "custom_mode": True,
    "prompt": "Change the music style to be calm and lyrical.",
    "style": "lyrical",
    "title": "lyrical song",
    "extensionStartTime": 150,
    "tags": "war"
}

response = requests.post(url, headers=headers, json=data)
print(response.json())