Query task
General task query API is used to read music, digital human, video and other asynchronous tasks. The status is judged first, and then the result or cause of failure is read.
http
GET /v1/tasks/{task_id}bash
curl https://moonnexai.com/v1/tasks/task_xxx \
-H "Authorization: Bearer <MOONNEXAI_API_KEY>"Success response
json
{
"id": "task_xxx",
"task_id": "task_xxx",
"status": "succeeded",
"progress": "100%",
"result": {
"audio_url": "https://example.com/result.mp3"
}
}Failed response
json
{
"id": "task_xxx",
"task_id": "task_xxx",
"status": "failed",
"progress": "100%",
"fail_reason": "The request parameters are invalid.",
"error": {
"message": "The request parameters are invalid."
}
}Query Recommendations
- Saves the
task_idreturned when creating task. - Do not infer success from a URL field alone; check
statusfirst. - Show
fail_reasonorerror.messageas a priority infailed/FAILUREstatus. - Failed task usually does not need to continue polling.