> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vidgo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Replace Section

> Replace specific sections of generated music tracks

<Tip>
  1. After submission, a `task_id` will be returned. If you provided a `callback_url`, when the task status becomes `finished` or `failed`, a POST request will be sent to the `callback_url`.
  2. Regardless of whether `callback_url` is provided, you can retrieve the response result through the unified [Query Music Detail](/api-manual/music-series/query-music-detail) endpoint.
</Tip>

## Usage Guide

* This endpoint replaces a specific time range of an existing music track with new content
* Useful for editing verses, choruses, or any specific part of a generated track
* The replacement content is generated based on your prompt and style tags

## Parameter Details

* `task_id` (required): The original task ID from a completed music generation
* `audio_id` (required): The specific audio track identifier from the callback data
* `prompt` (required): Description of the replacement content (lyrics or musical description)
* `tags` (required): Style tags for the replacement section
* `title` (required): Title for the resulting track
* `infill_start_s` (required): Start time in seconds (minimum 0, up to 2 decimals)
* `infill_end_s` (required): End time in seconds (must be greater than start time)

## Developer Notes

* Ensure `infill_end_s` is always greater than `infill_start_s`
* The time range should be within the duration of the original track
* Use `full_lyrics` when you want to maintain lyrical consistency across the entire track

## Optional parameters

* `negative_tags` (string): Styles to exclude from the replacement section
* `full_lyrics` (string): Complete lyrics for the entire track after modification
* `callback_url` (string): Webhook URL for receiving completion notifications


## OpenAPI

````yaml /api-manual/music-series/replace-section.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - Replace Section API
  description: Replace specific sections of generated music tracks
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: Production server
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Music Editing
      summary: Submit Replace Section Task
      description: >-
        Replace a specific time range of an existing music track with new
        content
      operationId: submitReplaceSectionTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              replace-chorus:
                summary: Replace Chorus Section
                value:
                  model: replace-section
                  callback_url: https://your-domain.com/callback
                  input:
                    task_id: 5c79xxxxbe8e
                    audio_id: e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc
                    prompt: A powerful chorus with soaring vocals
                    tags: pop, upbeat
                    title: Summer Dreams
                    infill_start_s: 30
                    infill_end_s: 60
              replace-with-lyrics:
                summary: Replace Section with Full Lyrics
                value:
                  model: replace-section
                  callback_url: https://your-domain.com/callback
                  input:
                    task_id: 5c79xxxxbe8e
                    audio_id: e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc
                    prompt: New verse lyrics here
                    tags: jazz, smooth
                    title: Midnight Blues
                    infill_start_s: 15.5
                    infill_end_s: 45
                    negative_tags: rock, heavy
                    full_lyrics: >-
                      Complete song lyrics including modified and unmodified
                      sections
      responses:
        '200':
          description: Task submitted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: |-
            API model identifier.

            Must be `replace-section` for this endpoint.
          enum:
            - replace-section
          example: replace-section
        callback_url:
          type: string
          format: uri
          description: Webhook callback URL for result notifications
          example: https://your-domain.com/callback
        input:
          type: object
          required:
            - task_id
            - audio_id
            - prompt
            - tags
            - title
            - infill_start_s
            - infill_end_s
            - full_lyrics
          description: Input parameters for section replacement
          properties:
            task_id:
              type: string
              description: |-
                Original task ID (parent task).

                Used to identify the source music for section replacement.
              example: 5c79xxxxbe8e
            audio_id:
              type: string
              description: >-
                Unique identifier of the audio track to replace.


                This ID is returned in the callback data after music generation
                completes.
              example: e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc
            prompt:
              type: string
              description: >-
                Text describing the replacement audio content.


                Describe the lyrics, melody, or musical content you want in the
                replaced section.
              example: A powerful chorus with soaring vocals
            tags:
              type: string
              description: >-
                Music style tags.


                Specify genres, moods, or styles for the replacement section
                (e.g., jazz, electronic, upbeat).
              example: pop, upbeat
            title:
              type: string
              description: |-
                Music title.

                The title for the resulting track.
              example: Summer Dreams
            infill_start_s:
              type: number
              description: >-
                Start time in seconds.


                The beginning of the section to replace. Supports up to 2
                decimal places.


                Minimum value: 0
              minimum: 0
              example: 30
            infill_end_s:
              type: number
              description: >-
                End time in seconds.


                The end of the section to replace. Supports up to 2 decimal
                places.


                Must be greater than `infill_start_s`.
              example: 60
            negative_tags:
              type: string
              description: >-
                Styles to exclude from replacement.


                Specify genres or characteristics to avoid in the generated
                section.
              example: rock, heavy metal
            full_lyrics:
              type: string
              description: >-
                Complete lyrics after modification.


                Combining both modified and unmodified lyrics for the entire
                track.
              example: Complete song lyrics including all sections
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          example: 200
          description: HTTP status code
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
              example: task-unified-1757165031-uyujaw3d
              description: Unique task identifier for status tracking
            status:
              type: string
              enum:
                - not_started
              example: not_started
              description: Initial task status
            created_time:
              type: string
              format: date-time
              example: '2025-11-12T10:30:00'
              description: ISO 8601 timestamp when the task was created
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        All API endpoints require Bearer Token authentication


        Get your API Key:


        Visit the [API Key Management
        Page](https://vidgo.ai/apis/dashboard/api-key) to get your API Key


        Add it to the request header:


        ```

        Authorization: Bearer VIDGO_API_KEY

        ```

````