---
title: "replace section"
method: POST
path: "/api/v1/sonic/replace-section"
tags: ["sonic"]
---

# replace section

`POST /api/v1/sonic/replace-section`

## Request

- Base URL: `https://api.musicapi.ai`
- URL: `https://api.musicapi.ai/api/v1/sonic/replace-section`
- Auth: HTTP bearer

Replace a section of lyrics in an existing song to generate new music. The new lyrics should overlap with the original lyrics, and the timing should correspond appropriately.

**Credits cost: 15**

## How to Use

Original lyrics:
```
[Verse 1]
Walking down the street
Feeling the beat

[Chorus]
This is my song
Singing all day long

[Verse 2]
Under the moonlight
Everything feels right

[Outro]
The night goes on
```

If you want to replace Verse 2 with new lyrics:
- **infill_lyrics**: `[Verse 2]\nDancing in the rain\nForgetting all the pain` (the new lyrics to replace)
- **prompt**: `This is my song\nSinging all day long\n\n[Verse 2]\nDancing in the rain\nForgetting all the pain\n\n[Outro]\nThe night goes on` (context with original lyrics before and after the new lyrics)
- **infill_start_s**: `45` (start time of Verse 2)
- **infill_end_s**: `60` (end time of Verse 2)

This way, the system can generate the best result based on the context and new lyrics fragment.

## Auto Concat Feature

When `auto_concat` is set to `true`, the system will automatically concatenate the replaced sections into complete songs:

1. **Replace Section**: Generates 2 replaced music fragments
2. **Auto Concat**: Automatically concatenates each fragment into a full song
3. **Result**: Returns 2 sets of paired data, each containing:
   - `replaced`: The replaced section fragment
   - `full`: The complete concatenated song

**Response format with auto_concat:**
```json
{
  "code": 200,
  "data": [
    {
      "replaced": { /* Fragment 1 data */ },
      "full": { /* Complete song 1 data */ }
    },
    {
      "replaced": { /* Fragment 2 data */ },
      "full": { /* Complete song 2 data */ }
    }
  ],
  "message": "success"
}
```

**Without auto_concat** (default): Returns only the 2 replaced fragments, you need to manually call the concat API to get complete songs.

## Important Notes

- `infill_start_s` must be less than `infill_end_s`
- Both time values must be non-negative
- The new lyrics should have some overlap with the original lyrics
- Timing should correspond appropriately for best results
- When using `auto_concat=true`, polling may take longer as it waits for both replace and concat operations to complete

## Polling Result

Use the task query endpoint with the returned `task_id` to poll for results. Recommended polling interval: 15-25 seconds.

**Status codes during auto_concat:**
- `202`: Task in progress (replace section or concat in progress)
- `200`: Task completed successfully

## Request body

- object
  - `clip_id` string, required: The original music clip ID
  - `mv` 'sonic-v6' | 'sonic-v6-wild' | 'sonic-v6-mini', required: Music model version. Suno retired v3.5 through v5.5 on 2026-09-09 and maps every retired id onto v6, so `sonic-v3-5`, `sonic-v4`, `sonic-v4-5`, `sonic-v4-5-plus`, `sonic-v5` and `sonic-v5-5` are still accepted and run v6 — existing integrations need no change.
  - `infill_start_s` number, required: Start time for replacement in seconds. Must be less than infill_end_s and non-negative.
  - `infill_end_s` number, required: End time for replacement in seconds. Must be greater than infill_start_s.
  - `prompt` string: Context lyrics - concatenate the original lyrics before and after the new lyrics. Maximum 5000 characters.
  - `infill_lyrics` string: New lyrics fragment to replace. Maximum 3000 characters.
  - `title` string: Song title. Maximum 200 characters.
  - `tags` string: Style tags (comma-separated). Examples: pop, rock, jazz, electronic. Maximum 120 characters.
  - `negative_tags` string: Tags to avoid in the generated music (comma-separated). Use this to exclude unwanted styles or elements.
  - `style_weight` number: Controls how strongly the style tags influence the output. Value between 0 and 1. Higher values = stronger style adherence.
  - `weirdness_constraint` number: Controls creativity/randomness level. Value between 0 and 1. Higher values = more experimental/unusual output.
  - `vocal_gender` 'f' | 'm': Vocal gender: 'f' for female, 'm' for male. Supported on every current model.
  - `auto_concat` boolean: Automatically concatenate replaced sections into complete songs. When true, returns paired data with both fragment and full song. Default is false.
  - `webhook_url` string: HTTPS URL to receive webhook notifications when the task completes. Must be a valid HTTPS URL.
  - `webhook_secret` string: Secret key for webhook signature verification. Used to verify the webhook payload authenticity.

## Response `200`

success

- object
  - `message` string, required
  - `task_id` string, required

---

[API](https://skmtc.dev/musicapi/apis/musicapi-docs-suno-style-ai-music-generation-api.md) - [All operations](https://skmtc.dev/musicapi/apis/musicapi-docs-suno-style-ai-music-generation-api/llms.txt) - [OpenAPI document](https://skmtc.dev/musicapi/apis/musicapi-docs-suno-style-ai-music-generation-api/revisions/f94a2c7ed4a1?raw)
