Hailuo Tasks API Integration and Usage
The main function of the Hailuo Tasks API is to query the execution status of a task by entering the task ID generated by the Hailuo Videos Generation API.
This document provides detailed integration instructions for the Hailuo Tasks API, helping you easily integrate and take full advantage of its powerful features. With the Hailuo Tasks API, you can easily query the execution status of Hailuo Videos Generation API tasks.
¶ Application Process
To use the Hailuo Videos Generation API, first go to the Ace Data Cloud Console to obtain your API Token for later use.

If you have not yet logged in or registered, you will be automatically redirected to the login page to register and log in. Once completed, you will be automatically returned to the current page.
The API Key for a general application can be used for services enabled for the account; the Key for a dedicated application can be used within that application's service scope. Please check the Key's permissions, validity period, and limits, and confirm that the application balance is sufficient to pay for this request. Available trial credits are subject to what is shown in your account. If the balance is insufficient, click the "Recharge" button.
📘 Full documentation: Hailuo Videos Generation API →
¶ Request Example
The Hailuo Tasks API can be used to query the results of the Hailuo Videos Generation API. For information on how to use the Hailuo Videos Generation API, please refer to the Hailuo Videos Generation API documentation.
We will use a task ID returned by the Hailuo Videos Generation API service as an example to demonstrate how to use this API. Suppose we have a task ID: 58cc618b-9639-4ee7-add2-d2fcf260d9a3. Next, we will demonstrate how to do so by passing in a task ID.
¶ Task Example Image

¶ Set the Request Headers and Request Body
Request Headers include:
accept: Specifies that the response should be received in JSON format; enterapplication/jsonhere.authorization: The key used to call the API, which can be selected directly from the drop-down list after applying.
Request Body includes:
id: The submitted task ID.action: The operation to perform on the task.
Set them as shown below:

¶ Code Examples
You can see that code in various languages has already been automatically generated on the right side of the page, as shown below:

Some code examples are shown below:
¶ CURL
curl -X POST 'https://api.acedata.cloud/hailuo/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"id": "58cc618b-9639-4ee7-add2-d2fcf260d9a3",
"action": "retrieve"
}'
¶ Python
import requests
url = "https://api.acedata.cloud/hailuo/tasks"
headers = {
"accept": "application/json",
"authorization": "Bearer {token}",
"content-type": "application/json"
}
payload = {
"id": "58cc618b-9639-4ee7-add2-d2fcf260d9a3",
"action": "retrieve"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
¶ Response Example
After a successful request, the API will return the details of the video task. For example:
{
"_id": "67866dff550a4144a5867aa7",
"id": "58cc618b-9639-4ee7-add2-d2fcf260d9a3",
"api_id": "d5af91f6-a7ec-4015-b0a5-d25051158470",
"application_id": "2f9f4d93-9193-4c49-a1a5-eddf0ff38abb",
"created_at": 1736863231.588,
"started_at": 1736863231.648,
"finished_at": 1736863300.748,
"elapsed": 69.1,
"credential_id": "f634e655-012e-432e-92a8-a87e4a80d636",
"request": {
"action": "generate",
"prompt": "Internal heat"
},
"trace_id": "0c1f9f13-0aef-4d9a-a9d2-1d27055ff190",
"user_id": "ad7afe47-cea9-4cda-980f-2ad8810e51cf",
"response": {
"success": true,
"task_id": "58cc618b-9639-4ee7-add2-d2fcf260d9a3",
"trace_id": "0c1f9f13-0aef-4d9a-a9d2-1d27055ff190",
"data": [
{
"id": "2a1tbgnjdxrg80cmcmes19s33r",
"model": "minimax-t2v",
"prompt": "Internal heat",
"first_image_url": null,
"video_url": "https://platform.cdn.acedata.cloud/czjl/tjU3QYKgU96IJFgpL0eMfBFhmy0qXz9Y05P2IBhShCYaDCFUA/tmp5uligw3a.output.mp4",
"state": "succeeded"
}
]
}
}
The result contains multiple fields. The request field is the request body used when the task was initiated, while the response field is the response body returned after the task is completed. The fields are described below.
id, the ID of the generated video task, used to uniquely identify this video generation task.request, the request information in the video task query.response, the response information in the video task query.created_at, the task creation time, as a Unix timestamp (seconds, floating-point).started_at, the task start time, as a Unix timestamp (seconds, floating-point).finished_at, the task completion time, as a Unix timestamp (seconds, floating-point). This field is not returned when the task is incomplete.elapsed, the task execution time in seconds (floating-point, rounded to 3 decimal places). This field is not returned when the task is incomplete.
¶ Batch Query Operation
This is used to query video task details for multiple task IDs. Unlike the above, you need to select retrieve_batch for action.
Request Body includes:
ids: An array of submitted task IDs.action: The operation to perform on the tasks.
Set them as shown below:

¶ Code Examples
You can see that code in various languages has already been automatically generated on the right side of the page, as shown below:

Some code examples are shown below:
¶ Response Example
After a successful request, the API will return the specific details of all video tasks in this batch. For example:
{
"items": [
{
"_id": "67866fad550a4144a587053c",
"id": "09d4a93e-d5c8-4778-bdf2-711773d71c59",
"api_id": "d5af91f6-a7ec-4015-b0a5-d25051158470",
"application_id": "2f9f4d93-9193-4c49-a1a5-eddf0ff38abb",
"created_at": 1736863661.511,
"started_at": 1736863661.571,
"finished_at": 1736863730.671,
"elapsed": 69.1,
"credential_id": "f634e655-012e-432e-92a8-a87e4a80d636",
"request": {
"action": "generate",
"prompt": "Internal heat"
},
"trace_id": "0edc94c6-4938-4bff-bb16-20364c254e40",
"user_id": "ad7afe47-cea9-4cda-980f-2ad8810e51cf",
"response": {
"success": true,
"task_id": "09d4a93e-d5c8-4778-bdf2-711773d71c59",
"trace_id": "0edc94c6-4938-4bff-bb16-20364c254e40",
"data": [
{
"id": "24zdgea0s1rge0cmcmjbsfj2m8",
"model": "minimax-t2v",
"prompt": "Internal heat",
"first_image_url": null,
"video_url": "https://platform.cdn.acedata.cloud/czjl/6cTYBRBDVJIQANzG7GaPwPblbeIiFe4yUDcVoMkkXttqJCFUA/tmpm4ke45c5.output.mp4",
"state": "succeeded"
}
]
}
},
{
"_id": "67866dff550a4144a5867aa7",
"id": "58cc618b-9639-4ee7-add2-d2fcf260d9a3",
"api_id": "d5af91f6-a7ec-4015-b0a5-d25051158470",
"application_id": "2f9f4d93-9193-4c49-a1a5-eddf0ff38abb",
"created_at": 1736863231.588,
"started_at": 1736863231.648,
"finished_at": 1736863300.748,
"elapsed": 69.1,
"credential_id": "f634e655-012e-432e-92a8-a87e4a80d636",
"request": {
"action": "generate",
"prompt": "Internal heat"
},
"trace_id": "0c1f9f13-0aef-4d9a-a9d2-1d27055ff190",
"user_id": "ad7afe47-cea9-4cda-980f-2ad8810e51cf",
"response": {
"success": true,
"task_id": "58cc618b-9639-4ee7-add2-d2fcf260d9a3",
"trace_id": "0c1f9f13-0aef-4d9a-a9d2-1d27055ff190",
"data": [
{
"id": "2a1tbgnjdxrg80cmcmes19s33r",
"model": "minimax-t2v",
"prompt": "Internal heat",
"first_image_url": null,
"video_url": "https://platform.cdn.acedata.cloud/czjl/tjU3QYKgU96IJFgpL0eMfBFhmy0qXz9Y05P2IBhShCYaDCFUA/tmp5uligw3a.output.mp4",
"state": "succeeded"
}
]
}
}
],
"count": 2
}
The response contains multiple fields, among which items contains the specific details of the batch video tasks. The details of each video task have the same fields as above, and the fields are described below.
items, all the specific details of the batch video tasks. It is an array, and each element has the same format as the response for querying a single task above.count, the number of video tasks queried in this batch.
¶ CURL
curl -X POST 'https://api.acedata.cloud/hailuo/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"ids": ["09d4a93e-d5c8-4778-bdf2-711773d71c59","58cc618b-9639-4ee7-add2-d2fcf260d9a3"],
"action": "retrieve_batch"
}'
¶ Python
import requests
url = "https://api.acedata.cloud/hailuo/tasks"
headers = {
"accept": "application/json",
"authorization": "Bearer {token}",
"content-type": "application/json"
}
payload = {
"ids": ["09d4a93e-d5c8-4778-bdf2-711773d71c59","58cc618b-9639-4ee7-add2-d2fcf260d9a3"],
"action": "retrieve_batch"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
¶ Error Handling
When calling the API, if an error occurs, the API will return the corresponding error code and message. For example:
400 token_mismatched: Bad request, possibly due to missing or invalid parameters.400 api_not_implemented: Bad request, possibly due to missing or invalid parameters.401 invalid_token: Unauthorized, invalid or missing authorization token.429 too_many_requests: Too many requests, you have exceeded the rate limit.500 api_error: Internal server error, something went wrong on the server.
¶ Error Response Example
{
"success": false,
"error": {
"code": "api_error",
"message": "fetch failed"
},
"trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}
¶ Conclusion
Through this document, you have learned how to use the Hailuo Tasks API to query all the specific details of a single video task or a batch of video tasks. We hope this document helps you better integrate and use the API. If you have any questions, please feel free to contact our technical support team.
