> ## 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.

# 替换音乐片段：查询任务

> 按 `taskId` 查询任务状态和结果。`data.state` 为 `success` 时从 `data.response`（与 `data.resultJson` 相同）读取结果，为 `fail` 时 `data.failCode` / `data.failMsg` 为失败原因。建议每 10 秒左右查询一次。



## OpenAPI

````yaml /openapi/zh/suno-replace-section.json get /api/v1/jobs/recordInfo
openapi: 3.1.0
info:
  description: 重新生成歌曲中指定时间段（至少 10 秒）的内容，新片段与前后部分自然衔接；可替换已生成的歌曲或上传的音频。
  title: Suno 替换音乐片段
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Suno 替换音乐片段
paths:
  /api/v1/jobs/recordInfo:
    get:
      tags:
        - Suno 替换音乐片段
      summary: 查询任务
      description: >-
        按 `taskId` 查询任务状态和结果。`data.state` 为 `success` 时从 `data.response`（与
        `data.resultJson` 相同）读取结果，为 `fail` 时 `data.failCode` / `data.failMsg`
        为失败原因。建议每 10 秒左右查询一次。
      operationId: sunoRecordInfo
      parameters:
        - description: 任务 ID，即创建任务返回的 `data.taskId`。
          example: 7d3f0a9c41e85b2f6a1c9e04b8d27f53
          explode: false
          in: query
          name: taskId
          required: true
          schema:
            examples:
              - 7d3f0a9c41e85b2f6a1c9e04b8d27f53
            type: string
      responses:
        '200':
          content:
            application/json:
              examples:
                排队中:
                  description: 任务已创建，等待生成。
                  summary: 排队中
                  value:
                    code: 200
                    msg: success
                    data:
                      taskId: 7d3f0a9c41e85b2f6a1c9e04b8d27f53
                      model: ai-music-api/replace-section
                      state: waiting
                      param: >-
                        {"input":"{\"task_id\":\"c2a81e5f09d34b7e8f61a2d4c9b03e75\",\"audio_id\":\"f924248f-e765-48fd-9ea9-c64290225e4e\",\"prompt\":\"早安阳光，我们出发\\n一步一步，世界发亮\",\"lyrics\":\"[Chorus]\\n早安阳光，我们出发\\n一步一步，世界发亮\",\"tags\":\"欢快的原声民谣流行\",\"title\":\"早安，阳光\",\"infill_start_s\":10,\"infill_end_s\":20.5,\"full_lyrics\":\"[Verse]\\n水壶唱起小小的歌\\n晨光洒落在地板上\\n[Chorus]\\n早安阳光，我们出发\\n一步一步，世界发亮\\n[Outro]\\n早安，为今天干杯\"}","model":"ai-music-api/replace-section"}
                      resultJson: null
                      failCode: null
                      failMsg: null
                      costTime: null
                      completeTime: null
                      createTime: 1795014897000
                      updateTime: 1795014907000
                生成中:
                  description: 生成中，请稍后再查。
                  summary: 生成中
                  value:
                    code: 200
                    msg: success
                    data:
                      taskId: 7d3f0a9c41e85b2f6a1c9e04b8d27f53
                      model: ai-music-api/replace-section
                      state: generating
                      param: >-
                        {"input":"{\"task_id\":\"c2a81e5f09d34b7e8f61a2d4c9b03e75\",\"audio_id\":\"f924248f-e765-48fd-9ea9-c64290225e4e\",\"prompt\":\"早安阳光，我们出发\\n一步一步，世界发亮\",\"lyrics\":\"[Chorus]\\n早安阳光，我们出发\\n一步一步，世界发亮\",\"tags\":\"欢快的原声民谣流行\",\"title\":\"早安，阳光\",\"infill_start_s\":10,\"infill_end_s\":20.5,\"full_lyrics\":\"[Verse]\\n水壶唱起小小的歌\\n晨光洒落在地板上\\n[Chorus]\\n早安阳光，我们出发\\n一步一步，世界发亮\\n[Outro]\\n早安，为今天干杯\"}","model":"ai-music-api/replace-section"}
                      resultJson: null
                      failCode: null
                      failMsg: null
                      costTime: null
                      completeTime: null
                      createTime: 1795014897000
                      updateTime: 1795014907000
                生成成功:
                  description: '`response`（与 `resultJson` 相同）为结果，链接均为 DreamTo 下载地址。'
                  summary: 生成成功
                  value:
                    code: 200
                    msg: success
                    data:
                      taskId: 7d3f0a9c41e85b2f6a1c9e04b8d27f53
                      model: ai-music-api/replace-section
                      state: success
                      param: >-
                        {"input":"{\"task_id\":\"c2a81e5f09d34b7e8f61a2d4c9b03e75\",\"audio_id\":\"f924248f-e765-48fd-9ea9-c64290225e4e\",\"prompt\":\"早安阳光，我们出发\\n一步一步，世界发亮\",\"lyrics\":\"[Chorus]\\n早安阳光，我们出发\\n一步一步，世界发亮\",\"tags\":\"欢快的原声民谣流行\",\"title\":\"早安，阳光\",\"infill_start_s\":10,\"infill_end_s\":20.5,\"full_lyrics\":\"[Verse]\\n水壶唱起小小的歌\\n晨光洒落在地板上\\n[Chorus]\\n早安阳光，我们出发\\n一步一步，世界发亮\\n[Outro]\\n早安，为今天干杯\"}","model":"ai-music-api/replace-section"}
                      resultJson: >-
                        {"code":200,"data":[{"audio_url":"https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/c43e125bbbdcafc1d387f/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t","createTime":1795015940224,"duration":41.12,"id":"1150f859-c087-408b-9866-b07863e75ce7","image_url":"https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/4ba7f3ce592ddbce92b41/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t","model_name":"chirp-hawk","prompt":"[Verse]\nKettle
                        starts its little song\nFirst light slips across the
                        floor\nCoffee warms my hands awake\nAnd I'm ready for
                        the day\n\n[Chorus]\nGood morning, sunshine, here we
                        go\nOne bright step and the whole world glows\nA little
                        warmth, a little cheer\nThe best part of the morning's
                        here\n\n[Outro]\nGood morning, coffee, cheers to
                        today!","stream_audio_url":"https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/2f034639e8ad0540457c3/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t","tags":"folk-pop,
                        acoustic","title":"Good Morning,
                        Sunshine"},{"audio_url":"https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/cecb105a41a06b6f8ce3e/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t","createTime":1795015940224,"duration":41.12,"id":"7190052a-d671-4f70-a949-b26c4873c561","image_url":"https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/e2de1e355b9b2956604d3/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t","model_name":"chirp-hawk","prompt":"[Verse]\nKettle
                        starts its little song\nFirst light slips across the
                        floor\nCoffee warms my hands awake\nAnd I'm ready for
                        the day\n\n[Chorus]\nGood morning, sunshine, here we
                        go\nOne bright step and the whole world glows\nA little
                        warmth, a little cheer\nThe best part of the morning's
                        here\n\n[Outro]\nGood morning, coffee, cheers to
                        today!","stream_audio_url":"https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/2457e4995b7820a787e56/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t","tags":"folk-pop,
                        acoustic","title":"Good Morning,
                        Sunshine"}],"msg":"success","task_id":"7d3f0a9c41e85b2f6a1c9e04b8d27f53"}
                      failCode: null
                      failMsg: null
                      costTime: 50
                      completeTime: 1795015940224
                      createTime: 1795014897000
                      updateTime: 1795014939000
                      response:
                        code: 200
                        data:
                          - audio_url: >-
                              https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/c43e125bbbdcafc1d387f/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t
                            createTime: 1795015940224
                            duration: 41.12
                            id: 1150f859-c087-408b-9866-b07863e75ce7
                            image_url: >-
                              https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/4ba7f3ce592ddbce92b41/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t
                            model_name: chirp-hawk
                            prompt: |-
                              [Verse]
                              Kettle starts its little song
                              First light slips across the floor
                              Coffee warms my hands awake
                              And I'm ready for the day

                              [Chorus]
                              Good morning, sunshine, here we go
                              One bright step and the whole world glows
                              A little warmth, a little cheer
                              The best part of the morning's here

                              [Outro]
                              Good morning, coffee, cheers to today!
                            stream_audio_url: >-
                              https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/2f034639e8ad0540457c3/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t
                            tags: folk-pop, acoustic
                            title: Good Morning, Sunshine
                          - audio_url: >-
                              https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/cecb105a41a06b6f8ce3e/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t
                            createTime: 1795015940224
                            duration: 41.12
                            id: 7190052a-d671-4f70-a949-b26c4873c561
                            image_url: >-
                              https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/e2de1e355b9b2956604d3/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t
                            model_name: chirp-hawk
                            prompt: |-
                              [Verse]
                              Kettle starts its little song
                              First light slips across the floor
                              Coffee warms my hands awake
                              And I'm ready for the day

                              [Chorus]
                              Good morning, sunshine, here we go
                              One bright step and the whole world glows
                              A little warmth, a little cheer
                              The best part of the morning's here

                              [Outro]
                              Good morning, coffee, cheers to today!
                            stream_audio_url: >-
                              https://api.dreamto.ai/v1/tasks/7d3f0a9c41e85b2f6a1c9e04b8d27f53/artifacts/2457e4995b7820a787e56/content?access=Xq3vR8sK1mN6pT2wY9bC4dF7gH0jL5zA8eU1iO3rS6t
                            tags: folk-pop, acoustic
                            title: Good Morning, Sunshine
                        msg: success
                        task_id: 7d3f0a9c41e85b2f6a1c9e04b8d27f53
                生成失败:
                  description: '`failCode` / `failMsg` 为失败原因，不扣费。'
                  summary: 生成失败
                  value:
                    code: 200
                    msg: success
                    data:
                      taskId: 7d3f0a9c41e85b2f6a1c9e04b8d27f53
                      model: ai-music-api/replace-section
                      state: fail
                      param: >-
                        {"input":"{\"task_id\":\"c2a81e5f09d34b7e8f61a2d4c9b03e75\",\"audio_id\":\"f924248f-e765-48fd-9ea9-c64290225e4e\",\"prompt\":\"早安阳光，我们出发\\n一步一步，世界发亮\",\"lyrics\":\"[Chorus]\\n早安阳光，我们出发\\n一步一步，世界发亮\",\"tags\":\"欢快的原声民谣流行\",\"title\":\"早安，阳光\",\"infill_start_s\":10,\"infill_end_s\":20.5,\"full_lyrics\":\"[Verse]\\n水壶唱起小小的歌\\n晨光洒落在地板上\\n[Chorus]\\n早安阳光，我们出发\\n一步一步，世界发亮\\n[Outro]\\n早安，为今天干杯\"}","model":"ai-music-api/replace-section"}
                      resultJson: ''
                      failCode: '400'
                      failMsg: Audio generation failed
                      costTime: 0
                      completeTime: 1795014939000
                      createTime: 1795014897000
                      updateTime: 1795014939000
                任务不存在（422）:
                  description: 任务 ID 不存在、不属于当前账号或已过期。
                  summary: 任务不存在（422）
                  value:
                    code: 422
                    msg: recordInfo is null
                    data: null
              schema:
                $ref: '#/components/schemas/SunoRecordInfoResponse'
          description: >-
            HTTP 状态码始终为 200。`code` 为 `200` 时 `data` 为任务信息（任务本身是否成功看
            `data.state`）；其他 `code` 为错误，`data` 为 `null`。
          headers:
            X-Request-Id:
              description: 本次请求的 ID，排查问题时请提供。
              schema:
                type: string
components:
  schemas:
    SunoRecordInfoResponse:
      additionalProperties: false
      description: 查询任务的响应。HTTP 状态码始终为 200。
      properties:
        code:
          description: |-
            结果代码：
            - `200`：查询成功（任务本身是否成功看 `data.state`）
            - `401`：API Key 缺失或无效
            - `405`：请求方法错误
            - `422`：`taskId` 缺失、不存在、属于其他账号或已过期（`msg` 为 `recordInfo is null`）
            - `429`：请求过于频繁
            - `500`：服务器错误，可稍后重试
          format: int64
          type: integer
        msg:
          description: 结果说明：成功时为 `success`，错误时为英文原因。
          type: string
        data:
          $ref: '#/components/schemas/SunoTaskRecord'
          description: 任务信息；错误时为 `null`。
      required:
        - code
        - msg
        - data
      type: object
    SunoTaskRecord:
      additionalProperties: false
      description: 任务信息。
      properties:
        taskId:
          description: 任务 ID。
          type: string
        model:
          description: 创建任务时的接口名称。
          type: string
        state:
          description: |-
            任务状态；`success` 和 `fail` 为终态。

            **可选值：**
            - `waiting`：已创建，等待开始
            - `queuing`：排队中
            - `generating`：生成中
            - `success`：成功（终态），结果在 `response`
            - `fail`：失败（终态），原因在 `failCode` / `failMsg`，不扣费
          enum:
            - waiting
            - queuing
            - generating
            - success
            - fail
          type: string
        param:
          description: >-
            创建任务时的请求，JSON 字符串，包含 `model`、`callBackUrl`（如有）和 `input`；其中 `input`
            也是 JSON 字符串，需要再解析一次。
          type: string
        resultJson:
          description: 结果的 JSON 字符串，内容与 `response` 相同；任务结束前为 `null`，失败时为空串。
          type:
            - string
            - 'null'
        failCode:
          description: 失败代码（数字字符串，如 `"500"`）；未失败时为 `null`。
          type:
            - string
            - 'null'
        failMsg:
          description: 失败原因（英文）；未失败时为 `null`。
          type:
            - string
            - 'null'
        costTime:
          description: 生成耗时（秒）；任务结束前为 `null`。
          format: int64
          type:
            - integer
            - 'null'
        completeTime:
          description: 完成时间，Unix 毫秒时间戳；任务结束前为 `null`。
          format: int64
          type:
            - integer
            - 'null'
        createTime:
          description: 创建时间，Unix 毫秒时间戳。
          format: int64
          type: integer
        updateTime:
          description: 最后更新时间，Unix 毫秒时间戳。
          format: int64
          type: integer
        response:
          $ref: '#/components/schemas/SunoTaskResultListSunoReplaceSectionTrack'
          description: 解析后的结果，仅任务成功时返回；其中的文件链接均为 DreamTo 下载地址。
      required:
        - taskId
        - model
        - state
        - param
        - resultJson
        - failCode
        - failMsg
        - costTime
        - completeTime
        - createTime
        - updateTime
      type: object
    SunoTaskResultListSunoReplaceSectionTrack:
      additionalProperties: false
      description: 任务结果。
      properties:
        code:
          description: 结果代码，成功时为 `200`。
          format: int64
          type: integer
        msg:
          description: 结果说明，成功时为 `success`。
          type: string
        task_id:
          description: 任务 ID（与 `taskId` 相同）。
          type: string
        data:
          description: 替换片段后的完整歌曲，通常为 2 首。
          items:
            $ref: '#/components/schemas/SunoReplaceSectionTrack'
          type: array
      required:
        - code
        - msg
        - task_id
        - data
      type: object
    SunoReplaceSectionTrack:
      additionalProperties: false
      description: 一首替换片段后的完整歌曲。
      properties:
        id:
          description: 新歌曲的 ID，可用作续写、翻唱、分轨等接口的 `audio_id`。
          type: string
        audio_url:
          description: 歌曲音频（MP3）的下载地址。
          type: string
        stream_audio_url:
          description: 流式播放地址。
          type: string
        image_url:
          description: 封面图片的下载地址。
          type: string
        prompt:
          description: 整首歌的歌词。
          type: string
        model_name:
          description: 实际使用的模型名称。
          type: string
        title:
          description: 歌名。
          type: string
        tags:
          description: 风格标签。
          type: string
        createTime:
          description: 创建时间，Unix 毫秒时间戳。
          format: int64
          type: integer
        duration:
          description: 时长（秒）。
          format: double
          type: number
        source_audio_url:
          description: 原始音频地址（如有）。
          type: string
        source_image_url:
          description: 原始封面地址（如有）。
          type: string
        source_stream_audio_url:
          description: 原始流式播放地址（如有）。
          type: string
      required:
        - id
        - audio_url
        - stream_audio_url
        - image_url
        - prompt
        - model_name
        - title
        - tags
        - createTime
        - duration
      type: object
  securitySchemes:
    bearerAuth:
      description: 'DreamTo 控制台创建的 API Key，格式 `Authorization: Bearer <API Key>`。'
      scheme: bearer
      type: http

````

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