Skip to content

单个查询任务

GET  v1/suno/fetch/{task_id}

请求参数

Authorization

在 Header 添加参数 Authorization,其值为在 Bearer 之后拼接 Token。

Authorization: Bearer ******************

Path 参数

字段名类型必填说明
task_idstring必需任务id

返回响应

200 成功

Content-Type: application/json

响应参数

参数路径类型必填说明
codestring必需接口状态码。表示本次 HTTP 请求是否成功(例如 "0" 或 "200" 代表成功)。
messagestring必需接口提示信息。对状态码的文字描述(例如 "Success")。
dataobject必需任务元数据。包含任务的生命周期信息,用于前端展示进度条或状态。
└─ task_idstring必需任务唯一标识。用于后续查询任务状态的关键 ID。
└─ notify_hookstring必需回调地址。服务器在任务完成后会向该地址推送结果。
└─ actionstring必需操作类型。描述当前任务的类型(例如 "generate_music", "extend_audio")。
└─ statusstring必需任务状态。例如 pending (排队中), running (处理中), success (完成), failed (失败)。
└─ fail_reasonstring必需失败原因。如果任务失败,这里会记录具体的错误信息;成功时可能为空。
└─ submit_timeinteger必需提交时间。任务创建时的 Unix 时间戳。
└─ start_timeinteger必需开始处理时间。任务实际开始运行时的 Unix 时间戳。
└─ finish_timeinteger必需完成时间。任务结束时的 Unix 时间戳。
└─ progressstring必需进度描述。通常用于展示百分比(如 "50%")或当前步骤的文字描述。
└─ dataobject必需业务结果数据。这是真正的“payload”,包含任务完成后生成的具体内容。
└─ idstring必需结果ID。生成内容的唯一标识(例如生成的音频 Clip ID)。
└─ textstring必需文本内容。可能是生成的歌词、描述或转录文本。
└─ titlestring必需标题。生成内容的标题。
└─ statusstring必需结果状态。具体内容的状态标记。

响应示例

{
    "code": "success",
    "message": "",
    "data": {
        "task_id": "f4a94d75-087b-4bb1-bd45-53ba293faf96",
        "notify_hook": "",
        "action": "LYRICS",
        "status": "SUCCESS",
        "fail_reason": "",
        "submit_time": 1716192124,
        "start_time": 1716192124,
        "finish_time": 1716192124,
        "progress": "100%",
        "data": {
            "id": "f4a94d75-087b-4bb1-bd45-53ba293faf96",
            "text": "[Verse]\nDancing in the neon light\nWith the rhythm\nFeeling so right\nMiku's here to steal the show\nWatch her dance\nFeel the techno glow\n\nShe's got moves like no one else\nIn this digital carousel\nWith her voice\nShe mesmerizes\nEvery beat\nEvery sound maximizes\n\n[Verse 2]\nIn her virtual world\nShe's the queen\nWith energy like you've never seen\nShe'll take you on a cosmic ride\nWith her dance moves\nShe can't hide",
            "title": "Electric Fantasy",
            "status": "complete"
        }
    }
}

示例代码

python
import http.client
import json

conn = http.client.HTTPSConnection("nxaiapp.com")
payload = json.dumps({})
headers = {
   'Authorization': 'Bearer <token>',
   'Content-Type': 'application/json'
}
conn.request("GET", "/v1/suno/fetch/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))