Skip to content

Asynchronous tasks ​

MoonNexAI video, music, digital human and some image APIs run as asynchronous tasks. Save task_id after creation, then poll the status or wait for a webhook.

Create a task ​

bash
curl https://moonnexai.com/v1/tasks \
  -H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "suno-music-v5.5",
    "prompt": "A warm pop song about sunrise.",
    "title": "Morning Light"
  }'

Query a task ​

bash
curl https://moonnexai.com/v1/tasks/task_xxx \
  -H "Authorization: Bearer <MOONNEXAI_API_KEY>"

Handle status ​

StatusMeaning
pending / submittedCreated or submitted.
runningProcessing.
succeededCompleted; the result can be read.
failedFailed; inspect fail_reason or error.
cancelledCancelled.

Some models return uppercase states such as SUBMITTED, QUEUED, IN_PROGRESS, SUCCESS and FAILURE. Your application can normalize equivalent states.

Recommendations ​

  • Always save the task_id from the creation response.
  • Check status and error before reading a media URL on the frontend or server. A URL alone does not establish success.
  • Failed tasks usually include a safe fail_reason that can be shown to the user.
  • Use webhooks for long tasks where supported and retain polling.

Common endpoints ​

CapabilityCreateQuery
MusicPOST /v1/tasksGET /v1/tasks/{task_id}
Digital human audioPOST /v1/tasksGET /v1/tasks/{task_id}
Digital human videoPOST /v1/tasksGET /v1/tasks/{task_id}
VideoPOST /v1/videosGET /v1/videos/{task_id}
Asynchronous imagesPOST /v1/images/generations/asyncGET /v1/images/tasks/{task_id}