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

# Replace music section: Create task

> Creates a Suno task: `model` picks the endpoint, the parameters go in `input`, and the optional `callBackUrl` receives a completion callback. On success `data.taskId` is returned and the task runs asynchronously; poll the query endpoint for the result. Every response has HTTP status 200; check `code`.



## OpenAPI

````yaml /openapi/en/suno-replace-section.json post /api/v1/jobs/createTask
openapi: 3.1.0
info:
  description: >-
    Regenerate a chosen time range (at least 10 seconds) of a song so that it
    blends with the parts around it; works on a generated song or an uploaded
    audio file.
  title: Suno Replace music section
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Suno Replace music section
paths:
  /api/v1/jobs/createTask:
    post:
      tags:
        - Suno Replace music section
      summary: Create task
      description: >-
        Creates a Suno task: `model` picks the endpoint, the parameters go in
        `input`, and the optional `callBackUrl` receives a completion callback.
        On success `data.taskId` is returned and the task runs asynchronously;
        poll the query endpoint for the result. Every response has HTTP status
        200; check `code`.
      operationId: sunoCreateTask
      requestBody:
        content:
          application/json:
            examples:
              Replace the chorus of a generated song:
                description: >-
                  `task_id` + `audio_id` name the song; rewrite the chorus from
                  10 to 20.5 seconds.
                summary: Replace the chorus of a generated song
                value:
                  model: ai-music-api/replace-section
                  input:
                    task_id: c2a81e5f09d34b7e8f61a2d4c9b03e75
                    audio_id: f924248f-e765-48fd-9ea9-c64290225e4e
                    prompt: |-
                      Good morning, sunshine, here we go
                      One bright step and the whole world glows
                    lyrics: |-
                      [Chorus]
                      Good morning, sunshine, here we go
                      One bright step and the whole world glows
                    tags: cheerful acoustic folk-pop
                    title: Good Morning, Sunshine
                    infill_start_s: 10
                    infill_end_s: 20.5
                    full_lyrics: |-
                      [Verse]
                      Kettle starts its little song
                      First light slips across the floor
                      [Chorus]
                      Good morning, sunshine, here we go
                      One bright step and the whole world glows
                      [Outro]
                      Good morning, cheers to today!
              All parameters:
                description: >-
                  Styles to avoid, a male voice, style adherence, variety and a
                  Persona, with a completion callback.
                summary: All parameters
                value:
                  model: ai-music-api/replace-section
                  callBackUrl: https://your-domain.com/api/callback
                  input:
                    task_id: c2a81e5f09d34b7e8f61a2d4c9b03e75
                    audio_id: f924248f-e765-48fd-9ea9-c64290225e4e
                    prompt: A calm and relaxing piano passage
                    lyrics: |-
                      [Chorus]
                      Modified lyrics for this section
                    tags: Jazz
                    title: Relaxing Piano
                    negative_tags: Rock
                    infill_start_s: 10.5
                    infill_end_s: 20.75
                    full_lyrics: |-
                      [Verse 1]
                      Original lyrics here
                      [Chorus]
                      Modified lyrics for this section
                      [Verse 2]
                      More original lyrics
                    vocal_gender: m
                    style_weight: 0.65
                    weirdness_constraint: 0.65
                    audio_weight: 0.65
                    variety: 1
                    persona_id: persona_123
                    persona_model: style_persona
              Replace a section of uploaded audio:
                description: >-
                  `upload_url` + `model` name your own audio; regenerate the
                  bridge from 30 to 45 seconds.
                summary: Replace a section of uploaded audio
                value:
                  model: ai-music-api/replace-section
                  input:
                    upload_url: https://example.com/audio.mp3
                    model: V6
                    prompt: The bridge turns to stronger drums and electric guitar
                    tags: pop rock
                    title: My Song
                    infill_start_s: 30
                    infill_end_s: 45
                    full_lyrics: |-
                      [Verse]
                      Original verse
                      [Bridge]
                      New bridge lyrics
                      [Chorus]
                      Original chorus
            schema:
              $ref: >-
                #/components/schemas/SunoCreateTaskRequestSunoReplaceSectionInput
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                Created:
                  description: '`data.taskId` is the task ID.'
                  summary: Created
                  value:
                    code: 200
                    msg: success
                    data:
                      taskId: 7d3f0a9c41e85b2f6a1c9e04b8d27f53
                Invalid request (422):
                  description: The request is invalid; no task is created or charged.
                  summary: Invalid request (422)
                  value:
                    code: 422
                    msg: >-
                      input.infill_end_s - input.infill_start_s must be at least
                      10 seconds.
                    data: null
                Unusable source task (422):
                  description: >-
                    `task_id` is unknown, belongs to another account or does not
                    meet the condition in `msg`; no task is created or charged.
                  summary: Unusable source task (422)
                  value:
                    code: 422
                    msg: >-
                      input.task_id must be a succeeded task of this account
                      created in the last 14 days.
                    data: null
                Unauthorized (401):
                  description: Missing or invalid API Key.
                  summary: Unauthorized (401)
                  value:
                    code: 401
                    msg: >-
                      Unauthorized - Authentication credentials are missing or
                      invalid
                    data: null
                Insufficient balance (402):
                  description: The balance does not cover the task.
                  summary: Insufficient balance (402)
                  value:
                    code: 402
                    msg: >-
                      Insufficient Credits - Account does not have enough
                      credits to perform the operation
                    data: null
                Rate limited (429):
                  description: Rate limit exceeded; retry later.
                  summary: Rate limited (429)
                  value:
                    code: 429
                    msg: >-
                      Rate Limited - Request limit has been exceeded for this
                      resource
                    data: null
                Server error (500):
                  description: >-
                    The service is temporarily unavailable; retry later. Not
                    charged.
                  summary: Server error (500)
                  value:
                    code: 500
                    msg: >-
                      Server Error - An unexpected error occurred while
                      processing the request
                    data: null
              schema:
                $ref: '#/components/schemas/SunoCreateTaskResponse'
          description: >-
            Always HTTP 200. With `code` `200` the task was created and
            `data.taskId` is its ID; any other `code` is an error with the
            reason in `msg` and `data` `null`.
          headers:
            X-Request-Id:
              description: ID of this request; include it when reporting issues.
              schema:
                type: string
components:
  schemas:
    SunoCreateTaskRequestSunoReplaceSectionInput:
      additionalProperties: false
      description: Request body of createTask.
      properties:
        model:
          default: ai-music-api/replace-section
          description: |-
            Endpoint name; it decides the fields of `input`.

            **Allowed values:**
            - `ai-music-api/replace-section`: Suno Replace music section
          enum:
            - ai-music-api/replace-section
          type: string
        callBackUrl:
          description: >-
            Optional URL that receives a callback when the task finishes
            (success or failure); it must be a public `http` / `https` URL.
            Recommended in production; you can also just poll the query
            endpoint. See Task callback for the body and signature.
          type: string
        input:
          $ref: '#/components/schemas/SunoReplaceSectionInput'
          description: Task parameters; the fields depend on `model`.
      required:
        - model
        - input
      type: object
    SunoCreateTaskResponse:
      additionalProperties: false
      description: Response of createTask; always HTTP 200.
      properties:
        code:
          description: >-
            Result code:

            - `200`: success

            - `401`: missing or invalid API Key

            - `402`: insufficient balance

            - `404`: the model does not exist or is not enabled

            - `405`: wrong HTTP method

            - `422`: invalid request, with the reason in `msg`; no task is
            created or charged

            - `429`: too many requests; retry later

            - `455`: service under maintenance

            - `500`: server error; retry later

            - `501`: generation failed

            - `505`: feature disabled
          format: int64
          type: integer
        msg:
          description: 'Message: `success`, or the English reason of an error.'
          type: string
        data:
          $ref: '#/components/schemas/SunoCreateTaskData'
          description: The task on success; `null` on error.
      required:
        - code
        - msg
        - data
      type: object
    SunoReplaceSectionInput:
      additionalProperties: false
      description: >-
        Parameters of `ai-music-api/replace-section`. Use one song source
        (`task_id` + `audio_id`, or `upload_url` + `model`); `prompt`, `tags`,
        `title`, `infill_start_s`, `infill_end_s` and `full_lyrics` are
        required.
      properties:
        task_id:
          description: >-
            Required for a generated song; cannot be combined with `upload_url`
            or `model`. Required source task ID: a Suno task of this account
            that succeeded on DreamTo within the last 14 days (the `data.taskId`
            returned by createTask). An unknown task, a task of another account,
            one that has not succeeded, is older than 14 days or is not a usable
            kind of task returns `code: 422`; no task is created or charged.
          type: string
        audio_id:
          description: >-
            Required for a generated song: the song whose section is replaced.
            Required ID of one track of the source task: `response.data[].id` of
            its result.
          type: string
        upload_url:
          description: >-
            Required for an uploaded audio file: a public `http` / `https` audio
            URL; cannot be combined with `task_id` or `audio_id`.
          type: string
        model:
          description: >-
            Required for an uploaded audio file (only together with
            `upload_url`). Required Suno model version: `V6`, `V6_MINI` or
            `V6_WILD`. The discontinued V4–V5_5 are no longer supported.


            **Allowed values:**

            - `V6`: Suno V6: greater musical expression, more natural vocals and
            richer detail

            - `V6_MINI`: Suno V6 Mini: lightweight and fast, balancing quality
            and speed

            - `V6_WILD`: Suno V6 Wild: pushes creative boundaries for bolder,
            more distinctive expression
          enum:
            - V6
            - V6_MINI
            - V6_WILD
          type: string
        prompt:
          description: >-
            Required: the new lyrics or description of the replaced section,
            from which the model regenerates it.
          type: string
        lyrics:
          description: >-
            Optional lyrics of the replaced section, up to 5,000 characters;
            mark sections with `[Chorus]` and so on.
          maxLength: 5000
          type: string
        tags:
          description: >-
            Required music style tags of the replaced section, such as `Jazz` or
            `Electronic`.
          type: string
        title:
          description: Required song title.
          type: string
        negative_tags:
          description: >-
            Optional music styles to keep out of the replaced section, such as
            `Rock`.
          type: string
        infill_start_s:
          description: >-
            Required start of the replaced range in seconds, `>= 0` with at most
            2 decimals; must be less than `infill_end_s` and at least 10 seconds
            before it.
          format: double
          minimum: 0
          multipleOf: 0.01
          type: number
        infill_end_s:
          description: >-
            Required end of the replaced range in seconds, `>= 0` with at most 2
            decimals; must be greater than `infill_start_s` and at least 10
            seconds after it. The range must not exceed 50% of the original
            song.
          format: double
          minimum: 0
          multipleOf: 0.01
          type: number
        full_lyrics:
          description: >-
            Required complete lyrics of the whole song after the replacement:
            the unchanged parts together with the changed part.
          type: string
        vocal_gender:
          description: >-
            Optional vocal gender preference. It only raises the likelihood of
            that gender and is not guaranteed.


            **Allowed values:**

            - `m`: Male voice

            - `f`: Female voice
          enum:
            - m
            - f
          type: string
        style_weight:
          description: >-
            Optional strength of adherence to the style in `tags`, `0`–`1` with
            at most 2 decimal places.
          format: double
          maximum: 1
          minimum: 0
          multipleOf: 0.01
          type: number
        weirdness_constraint:
          description: >-
            Optional creative / experimental deviation, `0`–`1` with at most 2
            decimal places; higher is bolder.
          format: double
          maximum: 1
          minimum: 0
          multipleOf: 0.01
          type: number
        audio_weight:
          description: >-
            Optional relative weight of the audio features, `0`–`1` with at most
            2 decimal places.
          format: double
          maximum: 1
          minimum: 0
          multipleOf: 0.01
          type: number
        variety:
          default: 1
          description: >-
            Optional variety of the results, an integer from `0` to `4`, default
            `1`: `0` off (exact style), `1` normal (balanced), `2` high
            (distinct styles), `3` extra (bold exploration), `4` max (results
            may differ a lot).
          format: double
          maximum: 4
          minimum: 0
          multipleOf: 1
          type: number
        persona_id:
          description: >-
            Optional Persona ID or Voice ID: the music takes on that Persona's
            style or that custom voice. Create a Persona with Generate Persona
            and a voice with the custom-voice endpoints. With `persona_model:
            voice_persona` it must be a ready custom voice of this account (the
            task ID of a succeeded validation-phrase task), otherwise `code:
            422` is returned; with `style_persona` it is used as is.
          type: string
        persona_model:
          description: >-
            Optional type of `persona_id`.


            **Allowed values:**

            - `style_persona`: Style Persona: takes on the Persona's overall
            musical style

            - `voice_persona`: Voice Persona: takes on the voice of the Persona
            or custom voice
          enum:
            - style_persona
            - voice_persona
          type: string
      required:
        - prompt
        - tags
        - title
        - infill_start_s
        - infill_end_s
        - full_lyrics
      type: object
    SunoCreateTaskData:
      additionalProperties: false
      description: The created task.
      properties:
        taskId:
          description: >-
            Task ID (32 hex digits), used to query the task and as the `task_id`
            of follow-up endpoints.
          type: string
      required:
        - taskId
      type: object
  securitySchemes:
    bearerAuth:
      description: >-
        API Key created in the DreamTo console, sent as `Authorization: Bearer
        <API Key>`.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.