Skip to main content
POST
Flow Music Replace
flow-music-replace regenerates a time range of one of your clips from an instruction. The whole song is re-rendered with that range replaced. Confirm live rates on the SnapGen models page. Failed tasks are not charged.
string
required
Set to flow-music-replace.
string
required
The id of your earlier task that holds the source clip. It must be your own task, must have succeeded, and must come from a model listed in Source tracks.
integer
default:"1"
Position of the source clip in that task’s result.tracks, counting from 1 (up to 8).
string
default:"lyria-3-pro"
Lyria version: lyria-3-pro (Lyria 3 Pro) or lyria-3.5 (Lyria 3.5).
number
required
Start of the range to regenerate, in seconds (from 0 to 3,600, decimals allowed).
number
required
End of the range, in seconds. Must be greater than start_s and within the source length.
string
required
What the new section should sound like, up to 2,000 characters, for example Replace this part with a piano version.
string
Title of the new clip, up to 120 characters.
integer
Random seed, from 0 to 4,294,967,295. The same seed and request give similar, not identical, results.
string
Optional public https URL that receives one signed event when the task finishes. See Task webhooks.
string
Required with webhook: 16 to 256 characters, used to sign the delivery.

Request rules

The gateway checks these before it reserves any balance:
  • end_s must be greater than start_s.

Source tracks

The source task must be your own succeeded task from one of these models: flow-music, flow-music-extend, flow-music-replace, flow-music-cover, flow-music-upload. Send the task id as source_task_id and pick the clip with source_index. Each Flow Music task returns one clip, so source_index is normally 1. Never send provider track or clip IDs. See Reference earlier tasks.

Request

The response is HTTP 202 with a task object and a Location: /v1/tasks/{id} header. Poll GET /v1/tasks/{id} every 10 to 20 seconds until status is succeeded or failed.

Result

One clip arrives in result.tracks[0], with its audio_url; result.urls lists the same file. Use this task as the source of later Flow Music operations.
Result URLs are kept for about 72 hours. Download the files you want to keep. See Music generation tasks for the task lifecycle, result fields, webhooks, and errors.