Replace Music Section
Replace a specific time segment within existing music.
Usage Guide
- This interface can replace specific time segments in already generated music
- Requires providing the original music’s task ID and the time range to be replaced, or a user-uploaded audio URL with a model version
- The replaced audio will naturally blend with the original music
Two Modes of Operation
Mode 1: Using existing audio- Provide
taskIdandaudioIdto replace a section in previously generated music
- Provide
uploadUrlandmodelto replace a section using your own uploaded audio
Parameter Details
-
Common Required Parameters:
prompt: Replaced lyricstags: Music style tagstitle: Music titleinfillStartS: Start time point for replacement (seconds, 2 decimal places)infillEndS: End time point for replacement (seconds, 2 decimal places)fullLyrics: Complete lyrics after modification, combining both modified and unmodified lyrics
-
Mode 1 Required Parameters:
taskId: Original music’s parent task IDaudioId: Audio ID to replace (returned in callback data after generation)
-
Mode 2 Required Parameters:
uploadUrl: URL of the custom audio uploaded by the usermodel: AI model version (V4, V4_5, V4_5PLUS, V4_5ALL, V5, V5_5)
-
Optional Parameters:
negativeTags: Music styles to excludecallBackUrl: Callback URL after task completion
Time Range Instructions
infillStartSmust be less thaninfillEndS- Time values are precise to 2 decimal places, e.g., 10.50 seconds
- The replacement time range must be between 6 and 60 seconds
- Replacement duration should not exceed 50% of the original music’s total duration
Developer Notes
- Replacement segments will be regenerated based on the provided
promptandtags - Generated replacement segments will automatically blend with the original music’s preceding and following parts
- Generated files will be retained for 14 days
- Query task status using the same interface as generating music: Get Music Details
Authorizations
🔑 API Authentication
All endpoints require authentication using Bearer Token.
Get API Key
- Visit the API Key Management Page to obtain your API Key
Usage
Add to request headers:
⚠️ 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
- Replace section using existing audio
- Replace section using uploaded custom audio
Original task ID (parent task), used to identify the source music for section replacement.
"2fac****9f72"
Unique identifier of the audio track to replace. This ID is returned in the callback data after music generation completes.
"e231****-****-****-****-****8cadc7dc"
Replaced lyrics
"A calm and relaxing piano track."
Music style tags, such as jazz, electronic, etc.
"Jazz"
Music title
"Relaxing Piano"
Start time point for replacement (seconds), 2 decimal places. Must be less than infillEndS. The time interval (infillEndS - infillStartS) must be between 6 and 60 seconds.
x >= 010.5
End time point for replacement (seconds), 2 decimal places. Must be greater than infillStartS. The time interval (infillEndS - infillStartS) must be between 6 and 60 seconds.
x >= 020.75
Complete lyrics after modification, combining both modified and unmodified lyrics. This parameter contains the full lyrics text that will be used for the entire song after the section replacement.
"[Verse 1]\nOriginal lyrics here\n[Chorus]\nModified lyrics for this section\n[Verse 2]\nMore original lyrics"
Excluded music styles, used to avoid specific style elements in the replacement segment
"Rock"
Callback URL for task completion. The system will send a POST request to this URL when replacement is complete, containing task status and results.
- Your callback endpoint should be able to accept POST requests containing JSON payloads with replacement results
- For detailed callback format and implementation guide, see Replace Music Section Callbacks
- Alternatively, you can use the Get Music Generation Details endpoint to poll task status
"https://example.com/callback"
Response
Request successful
Response status code
- 200: Success - Request processed successfully
- 401: Unauthorized - Authentication credentials missing or invalid
- 402: Insufficient credits - Account does not have enough credits to perform this operation
- 404: Not found - Requested resource or endpoint does not exist
- 409: Conflict - WAV record already exists
- 422: Validation error - Request parameters failed validation checks
- 429: Rate limit exceeded - Exceeded request limit for this resource
- 451: Unauthorized - Failed to retrieve image. Please verify any access restrictions set by you or your service provider.
- 455: Service unavailable - System is currently undergoing maintenance
- 500: Server error - Unexpected error occurred while processing request
200, 401, 402, 404, 409, 422, 429, 451, 455, 500 Error message when code != 200
"success"
