Skip to main content
POST
/
api
/
v1
/
generate
/
extend
Extend Music
curl --request POST \
  --url https://api.sunoapi.org/api/v1/generate/extend \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "defaultParamFlag": true,
  "audioId": "5c79****be8e",
  "prompt": "Extend the music with more relaxing notes",
  "style": "Classical",
  "title": "Peaceful Piano Extended",
  "continueAt": 60,
  "model": "V3_5",
  "negativeTags": "Relaxing Piano",
  "vocalGender": "m",
  "styleWeight": 0.65,
  "weirdnessConstraint": 0.65,
  "audioWeight": 0.65,
  "callBackUrl": "https://api.example.com/callback"
}
'
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "5c79****be8e"
  }
}
Extend or modify existing music tracks.

Parameter Usage Modes

The defaultParamFlag parameter controls how the extension works:

Custom Parameters Mode (defaultParamFlag: true)

  • Required fields: continueAt, prompt, style, and title
  • Use this mode when you want to customize how the music is extended
  • You can specify exactly where to continue from and how it should sound

Original Parameters Mode (defaultParamFlag: false)

  • Required fields: Only audioId
  • Uses the original audio’s parameters to extend naturally
  • Simpler approach that maintains the original style and characteristics

Extension Guidelines

  • Continue At: Specify the exact second where extension should begin
  • Model Consistency: Must use the same model version as the source audio
  • Duration Limits:
  • V4_5PLUS & V4_5: Up to 8 minutes
  • V4 & V3_5: Up to 4 minutes
The extension will seamlessly continue from your specified point, maintaining audio quality and style consistency.

Authorizations

Authorization
string
header
required

🔑 API Authentication

All endpoints require authentication using Bearer Token.

Get API Key

  1. Visit the API Key Management Page to obtain your API Key

Usage

Add to request headers:

Authorization: Bearer YOUR_API_KEY

⚠️ Note:

  • Keep your API Key secure and do not share it with others
  • If you suspect your API Key has been compromised, reset it immediately from the management page

Body

application/json
defaultParamFlag
boolean
required

Controls parameter usage mode. true: Use custom parameters (requires continueAt, prompt, style, and title). false: Use original audio parameters (only audioId is required).

Example:

true

audioId
string
required

Audio ID of the track to extend. This is the source track that will be continued.

Example:

"5c79****be8e"

model
enum<string>
required

Model version to use, must be consistent with the source audio. Available options: V4_5PLUS: V4.5+ is richer sound, new ways to create, max 8 min. V4_5: V4.5 is smarter prompts, faster generations, max 8 min. V4: V4 is improved vocal quality, max 4 min. V3_5: V3.5 is better song structure, max 4 min.

Available options:
V3_5,
V4,
V4_5,
V4_5PLUS
Example:

"V3_5"

callBackUrl
string<uri>
required

The URL to receive task completion notifications when music extension is complete. For detailed callback format and implementation guide, see Music Extension Callbacks. Alternatively, you can use the get music generation details endpoint to poll task status.

Example:

"https://api.example.com/callback"

prompt
string

Description of how the music should be extended. Required when defaultParamFlag is true.

Example:

"Extend the music with more relaxing notes"

style
string

Music style, e.g., Jazz, Classical, Electronic

Example:

"Classical"

title
string

Music title

Example:

"Peaceful Piano Extended"

continueAt
number

The time point (in seconds) from which to start extending the music. Required when defaultParamFlag is true. Value range: greater than 0 and less than the total duration of the generated audio. Specifies the position in the original track where the extension should begin.

Example:

60

negativeTags
string

Music styles to exclude from generation

Example:

"Relaxing Piano"

vocalGender
enum<string>

Preferred vocal gender for generated vocals. Optional.

Available options:
m,
f
Example:

"m"

styleWeight
number

Weight of the provided style guidance. Range 0.00–1.00.

Required range: 0 <= x <= 1Must be a multiple of 0.01
Example:

0.65

weirdnessConstraint
number

Constraint on creative deviation/novelty. Range 0.00–1.00.

Required range: 0 <= x <= 1Must be a multiple of 0.01
Example:

0.65

audioWeight
number

Weight of the input audio influence (where applicable). Range 0.00–1.00.

Required range: 0 <= x <= 1Must be a multiple of 0.01
Example:

0.65

Response

Request successful

code
enum<integer>

Status code. 200 - Request successful, 400 - Invalid parameters, 401 - Unauthorized access, 404 - Invalid request method or path, 405 - Rate limit exceeded, 413 - Theme or prompt too long, 429 - Insufficient credits, 430 - Your call frequency is too high. Please try again later, 455 - System maintenance, 500 - Server error

Available options:
200,
400,
401,
404,
405,
413,
429,
430,
455,
500
Example:

200

msg
string

Error message when code != 200

Example:

"success"

data
object