Replace Music Section
Replace a specific time segment within existing music.
Parameter Usage Guide
This endpoint supports two modes for specifying the source audio: Mode 1: Replace section using existing audiotaskIdandaudioIdare requireduploadUrlandmodelmust NOT be provided
uploadUrlandmodelare requiredtaskIdandaudioIdmust NOT be provided
Common Required Parameters
- prompt (string, required): Replaced lyrics
- tags (string, required): Music style tags, such as jazz, electronic, etc.
- title (string, required): Music title
- infillStartS (number, required): Start time point for replacement (seconds, 2 decimal places)
- infillEndS (number, required): End time point for replacement (seconds, 2 decimal places)
- fullLyrics (string, required): Complete lyrics after modification, combining both modified and unmodified lyrics
Optional Parameters
- negativeTags (string): Excluded music styles, used to avoid specific style elements in the replacement segment
- callBackUrl (string): Callback URL for task completion notification. For detailed callback format, see Replace Music Section Callbacks.
Time Range Instructions
infillStartSmust be less thaninfillEndS- Time values are precise to 2 decimal places, e.g.,
10.50seconds - 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 details interface to poll task status
"https://example.com/callback"
Callbacks
POST{request.body#/callBackUrl}audioGenerated
Body
Response
Callback received successfully
Response status code
- 200: Success - Request processed successfully
- 400: Validation error - Lyrics contain copyrighted content.
- 408: Rate limit exceeded - Timeout.
- 413: Conflict - Uploaded audio matches existing artwork.
- 500: Server error - Unexpected error occurred while processing request
- 501: Audio generation failed.
- 531: Server error - Sorry, generation failed due to issues. Your credits have been refunded. Please try again.
200, 400, 408, 413, 500, 501, 531 Error message when code != 200
"success"
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"
