API Reference
API Reference / Endpoints / Music

Edit track regions

/v1/music/tracks/edit

Edit a selected region of a track with precise timing boundaries.

POST/v1/music/tracks/edit
Auth: API keyBilling: Consumes 1 API callBehavior: AsyncScopes: audio:generate
POSTAsyncjsonaudio:generate

When to use it

Use this when you need to replace or regenerate only a segment instead of the full track.

Behavior on success

Returns 202 Accepted with a request_id. Poll the status endpoint or use webhooks.

Integration shape

Authorization model
audio:generate
Request format
json
Polling pattern
Poll status if the route returns processing.

Request

FieldTypeRequiredDescription
track_idstringOptionalExisting generated track id. Provide exactly one of track_id or upload_audio_id.
upload_audio_idstringOptionalExisting upload id. Provide exactly one of track_id or upload_audio_id.
edit_startnumberYesRegion start in milliseconds.
edit_endnumberYesRegion end in milliseconds.
lyricsstringOptionalReplacement lyric content for the edited region.
source_duration_msnumberOptionalOptional source duration used for the provider tail-distance validation.

Example request

POST /v1/music/tracks/edit
const response = await fetch('https://prod-backup-backend.wubble.ai/v1/music/tracks/edit', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.WUBBLE_API_KEY}`,
    'Idempotency-Key': crypto.randomUUID(),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "track_id": "track_123",
  "edit_start": 12000,
  "edit_end": 22000,
  "lyrics": "Replace this section with a stripped-back breakdown",
  "source_duration_ms": 48000
}),
});

const payload = await response.json();
console.log(payload);

Example response

Response shapejson
{
  "success": true,
  "data": {
    "request_id": "<uuid>",
    "status": "processing",
    "estimated_seconds": 50
  }
}

Implementation notes

Region edits must be at least 3000ms long.
edit_start must be at least 12000ms from the head of the source audio.
If source_duration_ms is supplied, edit_end must also be at least 12000ms before the tail.

Production guidance

Pair this route with idempotency on POST requests and either request polling or webhooks whenever the response is asynchronous.
Was this page helpful?