ACE Music Task Query API Integration Guide

The ACE Music Tasks API is used to query song, reference audio upload, cover, fusion, and lyrics generation tasks, and can also be used to view your creation history by page. After importing MIDI, images, or videos, use the original task ID to query progress. Asset details and paginated history are retrieved through the Assets API. This guide explains how to obtain an API Token, query tasks, determine completion status, and retrieve audio and lyrics results.

Task queries are free, and you can query your own results even with a zero balance; a valid Token and permission to access the Tasks API are still required.

Application Process

  1. Open the Ace Data Cloud Console. If you are not logged in, please register or log in first.
  2. Select and copy the key in the API Key section of General Applications; if you do not have a key, click Create API Key. API Token and API Key in this guide refer to the same type of API credential.
  3. You can also manage keys in Credential Management. When using an ACE Music-specific application or a key with API restrictions, confirm that access to the Tasks API is allowed; creating songs or lyrics also requires permission to access the corresponding creation API.
  4. Replace YOUR_API_TOKEN in the examples with the copied Token and send it in the Authorization: Bearer YOUR_API_TOKEN request header.

If you also need to create paid tasks, first check the application balance and key usage limit; if the balance is insufficient, click the “Recharge” button. Querying existing tasks does not require a recharge. Store the Token on the server side and do not place it on public web pages or in code repositories.

Complete API parameters and online testing: ACE Music Tasks API.

Query a Single Task

First submit a creation request through the Songs API or Lyrics API, and save the returned task_id. Then send a query to POST https://api.acedata.cloud/acemusic/tasks:

curl --request POST 'https://api.acedata.cloud/acemusic/tasks' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "action": "retrieve",
    "id": "YOUR_TASK_ID"
  }'

The id here is the task ID task_id returned by the creation request. The track ID response.data[*].id used for covers or fusion cannot replace the task ID.

Response Example

The following is an excerpt from the response of an actual song task, with fields such as lyrics, style, cover, and timestamps omitted.

{
  "id": "ae17781e-b4cd-4ad9-869a-34b8cf96b057",
  "type": "audios",
  "state": "succeeded",
  "status": "succeeded",
  "trace_id": "3102971e-7f6a-473c-8255-ba1e8eace89e",
  "response": {
    "success": true,
    "task_id": "ae17781e-b4cd-4ad9-869a-34b8cf96b057",
    "trace_id": "3102971e-7f6a-473c-8255-ba1e8eace89e",
    "status": "succeeded",
    "data": [
      {
        "id": "3966103b-b0e3-4799-aa6d-b90dfc3e30ee",
        "model": "acemusic-v1.1",
        "title": "末班车的温热",
        "state": "succeeded",
        "duration": 182,
        "audio_url": "https://cdn.acedata2.cloud/acemusic/ae17781e-b4cd-4ad9-869a-34b8cf96b057-3966103b-b0e3-4799-aa6d-b90dfc3e30ee.mp3"
      },
      {
        "id": "51b08e57-a990-4aaf-9418-fe3750a833f1",
        "model": "acemusic-v1.1",
        "title": "末班车的温热",
        "state": "succeeded",
        "duration": 174,
        "audio_url": "https://cdn.acedata2.cloud/acemusic/ae17781e-b4cd-4ad9-869a-34b8cf96b057-51b08e57-a990-4aaf-9418-fe3750a833f1.mp3"
      }
    ]
  }
}

Returned Fields

Field Description
id Platform task ID, corresponding to the task_id returned upon submission.
type audios for songs or MP3 imports, lyrics for lyrics, and assets tasks retrieved by ID correspond to reference asset imports.
state / status Current task status; see the status table below for specific meanings.
request Public creation parameters for the task, such as action, model, and prompt.
response Creation result; the final result may not be available while the task is incomplete.
response.success Whether creation succeeded. It may be false during processing and should be evaluated together with the task status.
response.data The track list for a song task, the title and body list for a lyrics task, or the asset object for a successful asset import.
response.error Error information when creation fails, including a public code and message.
trace_id Request trace ID; provide it together with the task ID when troubleshooting.
created_at / started_at / finished_at Creation, start, and completion times, as Unix timestamps in seconds; there is no completion time while the task is incomplete.
elapsed Time taken after the task is completed, in seconds.

HTTP 200 indicates that the query request succeeded. To determine whether the song has been delivered, you must also check the task status and the track's state and audio_url.

Batch Query

Set action to retrieve_batch and use ids to query 1–100 tasks at once:

curl --request POST 'https://api.acedata.cloud/acemusic/tasks' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "action": "retrieve_batch",
    "ids": ["YOUR_FIRST_TASK_ID", "YOUR_SECOND_TASK_ID"]
  }'

In the result, items is the list of task records, and count is the number of matches. Each record has the same format as a single-task query. Tasks that do not exist or that the current account is not authorized to access will not appear in the list; compare the returned records' id values with the original request.

View Creation History

Set action to list to view the current account's tasks by page. The following example queries the first page of 20 song or reference audio tasks:

curl --request POST 'https://api.acedata.cloud/acemusic/tasks' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "action": "list",
    "type": "audios",
    "page": 1,
    "page_size": 20
  }'

Historical results also use items and count. Change type to lyrics to query lyric history; omit type to list song and lyric operations. For asset history, call POST /acemusic/assets, using action=retrieve and omitting id.

Request Parameters

Parameter Type Usage Description
action string All queries, required retrieve, retrieve_batch, or list.
id string retrieve, required A single platform task ID.
ids array retrieve_batch, required 1–100 platform task IDs.
type string list, optional audios or lyrics. Song generation, uploads, covers, and fusion all belong to audios.
page integer list, optional Page number, starting at 1; defaults to 1.
page_size integer list, optional 1–100 items per page; defaults to 20.
limit / offset integer list, optional An alternative pagination method; limit is 1–100, and offset starts at 0, up to 10,000.
created_at_min / created_at_max number list, optional Inclusive lower and upper bounds for creation time, using non-negative Unix timestamps in seconds.

When paginating, choose either page / page_size or limit / offset; do not mix them. The offset calculated from the page number must not exceed 10,000 either.

Task States and Result Handling

State Meaning Recommended handling
created The task has been created. Save the original task ID and continue querying.
submitting The creation request is being submitted. Continue querying.
processing Processing is in progress. Continue querying; partial results do not mean the entire batch is complete.
storing Audio delivery is being prepared. Wait for an available audio URL.
submission_unknown Acceptance of the creation request is pending confirmation. Retain the original task ID and continue querying or contact support; do not submit the same creation request again.
succeeded The task completed successfully. Read the results and stop polling.
partial_failed Some tracks ultimately failed. Retain the completed tracks, stop polling, and check the errors.
failed The task ultimately failed. Stop polling and read the error information.

For type=audios:

  • When generation, a cover, or fusion succeeds completely, response.data contains two candidates; when a reference audio upload succeeds, it contains one.
  • Each track's id can be used for subsequent covers or fusion; use audio_url for playback and downloads, and see duration for the actual duration in seconds.
  • Partially failed tasks still retain completed tracks; a missing cover image does not affect playback of available audio, and tracks without an audio URL have not yet been delivered.

For type=lyrics, after success, response.data[*].title is the title, and response.data[*].text is the editable lyrics. When integrating with song custom mode, copy text to the lyric field of the song request; see the Lyrics Guide for details.

Python Polling Example

The following example only queries an existing task and does not create a new paid task. First install requests and configure the token in the server-side environment variable ACEDATACLOUD_API_TOKEN, then replace the task ID.

import os
import time

import requests

url = "https://api.acedata.cloud/acemusic/tasks"
headers = {
    "Authorization": f"Bearer {os.environ['ACEDATACLOUD_API_TOKEN']}",
    "Accept": "application/json",
}
task_id = "YOUR_TASK_ID"
terminal_states = {"succeeded", "partial_failed", "failed"}

for attempt in range(30):
    response = requests.post(
        url,
        headers=headers,
        json={"action": "retrieve", "id": task_id},
        timeout=30,
    )
    response.raise_for_status()
    task = response.json()
    state = task.get("state") or task.get("status")
    print("任务状态:", state)

    if state in terminal_states:
        result = task.get("response") or {}
        print("创作结果:", result.get("data", []))
        if state != "succeeded":
            print("错误信息:", result.get("error"))
        break

    time.sleep(min(5 + attempt, 15))
else:
    print("暂未完成,请保存此任务 ID,稍后继续查询:", task_id)

Start polling at intervals of a few seconds and gradually back off. After reaching the local wait limit, retain the original task ID and continue querying later. Interface refreshes, network interruptions, or failed queries should not trigger automatic regeneration or re-uploading.

Common Errors and Fees

HTTP Status Code Recommended handling
400 Check the task ID, action, pagination parameters, and whether the two pagination methods have been mixed.
401 / 403 Check whether the token is valid and whether the application and key have task API permissions.
404 No record accessible to the current account was found for the single-task query; check whether a track ID was used by mistake or the account was changed.
429 Reduce the query frequency and retry with backoff.
500 / 503 Retain the task ID and Trace ID, and retry the query later or contact support.

The query API does not allow access to others' works using another user ID. Song creation, uploads, and lyric creation are billed separately; querying existing tasks is free. No generation fee is charged when a generation, cover, or fusion task ultimately fails or partially fails; no corresponding creation fee is charged when an upload or lyric task ultimately fails. For specific pricing, see the Song Guide and the Lyrics Guide.