API Reference / Endpoints / Music
Edit track regions
/v1/music/tracks/editEdit a selected region of a track with precise timing boundaries.
POST
/v1/music/tracks/editAuth: 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
| Field | Type | Required | Description |
|---|---|---|---|
track_id | string | Optional | Existing generated track id. Provide exactly one of track_id or upload_audio_id. |
upload_audio_id | string | Optional | Existing upload id. Provide exactly one of track_id or upload_audio_id. |
edit_start | number | Yes | Region start in milliseconds. |
edit_end | number | Yes | Region end in milliseconds. |
lyrics | string | Optional | Replacement lyric content for the edited region. |
source_duration_ms | number | Optional | Optional 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?