API Endpoints

Extend Music

POST/v2/extend

Extend Music API

Extend existing music tracks by adding new content to the end.

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

tips

Two modes: inherit original parameters or use custom parameters.

Use Feed API with returned workId to check progress.

requestHeaders

namerequireddescription
AuthorizationyesBearer token for authentication
Content-Typeyesapplication/json

requestBody

Request body supports Inherit Mode or Custom Mode

Inherit Mode

Extend using original track parameters

noAdditionalParams

Custom Mode

Extend with custom parameters

paramNameparamTyperequireddescriptionexample
promptstringyesNew lyrics or descriptionChange the music style to be calm and lyrical.
stylestringnoMusic stylelyrical
titlestringnoTrack titlelyrical song
extensionStartTimenumbernoStart time in seconds for extension150
tagsstringnoAdditional tagswar

commonParams

paramNameparamTyperequireddescriptionexample
origin_task_idstringyesTask ID from original music generationgen20e094aeaadfe494ea33a5c80ee596083bksv
extend_audio_indexnumberyes0 for first audio, 1 for second audio0
custom_modebooleannofalse for inherit mode, true for custom modefalse
callback_urlstringnoOptional webhook URL for real-time resultshttps://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())