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

# Suno 任务查询

> 查询 Suno 歌曲生成任务的状态和结果

> 更新日期：2026-06-06

# Suno 任务查询

## 查询单个任务

```
GET /suno/fetch/{id}
```

### 请求示例

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.crazyrouter.com/suno/fetch/suno_task_abc123 \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.crazyrouter.com/suno/fetch/suno_task_abc123",
      headers={"Authorization": "Bearer YOUR_API_KEY"}
  )

  print(response.json())
  ```
</CodeGroup>

### 响应示例（处理中）

```json theme={null}
{
  "code": 1,
  "data": {
    "task_id": "suno_task_abc123",
    "status": "processing",
    "data": []
  }
}
```

### 响应示例（已完成）

```json theme={null}
{
  "code": 1,
  "data": {
    "task_id": "suno_task_abc123",
    "status": "complete",
    "data": [
      {
        "id": "clip_001",
        "title": "夏日海边",
        "audio_url": "https://cdn.suno.ai/audio/clip_001.mp3",
        "image_url": "https://cdn.suno.ai/image/clip_001.png",
        "duration": 120.5,
        "tags": "pop, chinese, upbeat",
        "prompt": "[Verse]\n阳光洒在海面上...",
        "status": "complete"
      },
      {
        "id": "clip_002",
        "title": "夏日海边",
        "audio_url": "https://cdn.suno.ai/audio/clip_002.mp3",
        "image_url": "https://cdn.suno.ai/image/clip_002.png",
        "duration": 118.3,
        "tags": "pop, chinese, upbeat",
        "prompt": "[Verse]\n阳光洒在海面上...",
        "status": "complete"
      }
    ]
  }
}
```

***

## 批量查询

```
POST /suno/fetch
```

一次查询多个任务。

### 请求参数

| 参数    | 类型    | 必填 | 说明       |
| ----- | ----- | -- | -------- |
| `ids` | array | 是  | 任务 ID 列表 |

### 请求示例

```bash cURL theme={null}
curl -X POST https://api.crazyrouter.com/suno/fetch \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "ids": ["suno_task_abc123", "suno_task_def456"]
  }'
```

***

## 获取 WAV 格式

部分任务完成后可获取无损 WAV 格式的音频。在响应的 `audio_url` 基础上替换扩展名即可：

```
https://cdn.suno.ai/audio/clip_001.wav
```

***

## 任务状态

| 状态           | 说明  |
| ------------ | --- |
| `submitted`  | 已提交 |
| `processing` | 生成中 |
| `complete`   | 已完成 |
| `error`      | 失败  |

***

## 完整流程示例

```python Python theme={null}
import requests
import time

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.crazyrouter.com"
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {API_KEY}"
}

# 1. 提交歌曲生成任务
resp = requests.post(f"{BASE_URL}/suno/submit/music", headers=headers, json={
    "gpt_description_prompt": "一首关于夏天的欢快中文流行歌曲",
    "mv": "chirp-v4"
})
task_id = resp.json()["result"]
print(f"任务已创建: {task_id}")

# 2. 轮询查询
while True:
    resp = requests.get(f"{BASE_URL}/suno/fetch/{task_id}", headers=headers)
    result = resp.json()["data"]

    if result["status"] == "complete":
        for clip in result["data"]:
            print(f"歌曲: {clip['title']}")
            print(f"音频: {clip['audio_url']}")
            print(f"时长: {clip['duration']}秒")
            print("---")
        break
    elif result["status"] == "error":
        print("生成失败")
        break

    time.sleep(10)
```

<Note>
  每次歌曲生成任务通常会返回 2 首变体。歌曲生成通常需要 1-3 分钟，建议轮询间隔为 10 秒。
</Note>
