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

# 查询音乐生成任务

> 根据任务 ID 查询音乐生成的进度和结果

## 功能说明

查询之前创建的音乐生成任务状态。该接口返回任务级状态信息，以及任务成功后生成的 2 首歌曲结果。

## 请求方式

`GET /v1/music/tasks/{task_id}`

## 调用示例

<CodeGroup>
  ```python Python theme={null}
  import requests

  task_id = "task_123456789"
  url = f"https://api.qhaigc.net/v1/music/tasks/{task_id}"
  headers = {
      "Authorization": "Bearer sk-your-api-key-here"
  }

  response = requests.get(url, headers=headers)
  print(response.json())
  ```

  ```bash cURL theme={null}
  curl https://api.qhaigc.net/v1/music/tasks/task_123456789 \
    -H "Authorization: Bearer sk-your-api-key-here"
  ```
</CodeGroup>

## 返回结果

成功查询且任务已完成时的结果：

<CodeGroup>
  ```json 响应示例 theme={null}
  {
    "code": "success",
    "message": "",
    "data": {
      "task_id": "750ced71bcdde0f6b7677c967722b888",
      "action": "GENERATIONS",
      "status": "SUCCESS",
      "fail_reason": "",
      "submit_time": 1773486571,
      "start_time": 0,
      "finish_time": 1773486652,
      "progress": "100%",
      "data": [
        {
          "id": "6ea663c2-0e79-4aad-8c97-3c344cde3d42",
          "tags": "pop, Bright, uptempo J-Pop groove at 150 BPM, female vocals, j-pop",
          "title": "春天转圈圈",
          "prompt": "[Verse 1]\\n闹钟还在打喷嚏...",
          "audioUrl": "https://tempfile.aiquickdraw.com/r/4676fa10852c46feac6cd00c7bb86d59.mp3",
          "duration": 180.4,
          "imageUrl": "https://musicfile.removeai.ai/NmVhNjYzYzItMGU3OS00YWFkLThjOTctM2MzNDRjZGUzZDQy.jpeg",
          "modelName": "chirp-bluejay",
          "createTime": 1773486651435,
          "sourceAudioUrl": "https://cdn1.suno.ai/6ea663c2-0e79-4aad-8c97-3c344cde3d42.mp3",
          "sourceImageUrl": "https://cdn2.suno.ai/image_6ea663c2-0e79-4aad-8c97-3c344cde3d42.jpeg",
          "streamAudioUrl": "https://musicfile.removeai.ai/NmVhNjYzYzItMGU3OS00YWFkLThjOTctM2MzNDRjZGUzZDQy",
          "sourceStreamAudioUrl": "https://cdn1.suno.ai/6ea663c2-0e79-4aad-8c97-3c344cde3d42.mp3"
        },
        {
          "id": "0b5ff5be-5209-460d-b346-cc2fc186a240",
          "tags": "pop, Bright, uptempo J-Pop groove at 150 BPM, female vocals, j-pop",
          "title": "春天转圈圈",
          "prompt": "[Verse 1]\\n闹钟还在打喷嚏...",
          "audioUrl": "https://tempfile.aiquickdraw.com/r/ea9409e9726141a686bb6a44409ed647.mp3",
          "duration": 180.36,
          "imageUrl": "https://musicfile.removeai.ai/MGI1ZmY1YmUtNTIwOS00NjBkLWIzNDYtY2MyZmMxODZhMjQw.jpeg",
          "modelName": "chirp-bluejay",
          "createTime": 1773486651435,
          "sourceAudioUrl": "https://cdn1.suno.ai/0b5ff5be-5209-460d-b346-cc2fc186a240.mp3",
          "sourceImageUrl": "https://cdn2.suno.ai/image_0b5ff5be-5209-460d-b346-cc2fc186a240.jpeg",
          "streamAudioUrl": "https://musicfile.removeai.ai/MGI1ZmY1YmUtNTIwOS00NjBkLWIzNDYtY2MyZmMxODZhMjQw",
          "sourceStreamAudioUrl": "https://cdn1.suno.ai/0b5ff5be-5209-460d-b346-cc2fc186a240.mp3"
        }
      ]
    }
  }
  ```
</CodeGroup>

## 相关接口

* [创建音乐生成任务](/docs/api-reference/music/generate)


## OpenAPI

````yaml GET /v1/music/tasks/{task_id}
openapi: 3.1.0
info:
  title: 启航 AI API
  version: 1.0.0
  description: 启航 AI API 文档，支持绘图、语音生成、视频生成、音乐生成等多种 AIGC 接口。
servers:
  - url: https://api.qhaigc.net
    description: 生产服务器
security:
  - bearerAuth: []
paths:
  /v1/music/tasks/{task_id}:
    get:
      tags:
        - 音乐生成
      summary: 查询音乐生成任务
      description: 根据任务 ID 查询音乐生成的进度和结果
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: success
                  message:
                    type: string
                    example: ''
                  data:
                    type: object
                    properties:
                      task_id:
                        type: string
                      action:
                        type: string
                        example: GENERATIONS
                      status:
                        type: string
                        example: SUCCESS
                      fail_reason:
                        type: string
                      submit_time:
                        type: integer
                      start_time:
                        type: integer
                      finish_time:
                        type: integer
                      progress:
                        type: string
                        example: 100%
                      data:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            tags:
                              type: string
                            title:
                              type: string
                            prompt:
                              type: string
                            audioUrl:
                              type: string
                            duration:
                              type: number
                            imageUrl:
                              type: string
                            modelName:
                              type: string
                            createTime:
                              type: integer
                            sourceAudioUrl:
                              type: string
                            sourceImageUrl:
                              type: string
                            streamAudioUrl:
                              type: string
                            sourceStreamAudioUrl:
                              type: string
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````