Skip to main content
The main function of the Hailuo Tasks API is to query the execution status of tasks by inputting the task ID generated by the Hailuo Videos Generation API. This document will provide detailed integration instructions for the Hailuo Tasks API, helping you easily integrate and fully utilize the powerful features of this API. With the Hailuo Tasks API, you can easily query the execution status of tasks from the Hailuo Videos Generation API.

Application Process

To use the Hailuo Tasks API, you first need to apply for the corresponding service on the application page Hailuo Videos Generation API, and then copy the task ID from the Hailuo Videos Generation API, as shown in the image below:

Finally, go to the Tasks API page Hailuo Tasks API to apply for the corresponding service. After entering the page, click the “Acquire” button, as shown in the image below: Application Page If you are not logged in or registered, you will be automatically redirected to the login page inviting you to register and log in. After logging in or registering, you will be automatically returned to the current page. There is a free quota available for first-time applicants, allowing you to use this API for free.

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 document Hailuo Videos Generation API. We will take a task ID returned by the Hailuo Videos Generation API as an example to demonstrate how to use this API. Suppose we have a task ID: 58cc618b-9639-4ee7-add2-d2fcf260d9a3, and we will demonstrate how to pass in a task ID.

Task Example Image

Setting Request Headers and Request Body

Request Headers include:
  • accept: Specifies that the response should be in JSON format, set to application/json.
  • authorization: The API key for calling the API, which can be selected directly after application.
Request Body includes:
  • id: The uploaded task ID.
  • action: The operation method for the task.
Set as shown in the image below:

Code Example

You can see that various language codes have been automatically generated on the right side of the page, as shown in the image below:

Some code examples are as follows:

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

Upon a successful request, the API will return the details of the video task here. 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,
  "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://file.aigpai.com/czjl/tjU3QYKgU96IJFgpL0eMfBFhmy0qXz9Y05P2IBhShCYaDCFUA/tmp5uligw3a.output.mp4",
        "state": "succeeded"
      }
    ]
  }
}
The returned result contains multiple fields, with the request field being the request body when the task was initiated, and the response field being the response body returned after the task is completed. The field descriptions are as follows.
  • id: The ID of the video task generated, used to uniquely identify this video generation task.
  • request: The request information in the video task.
  • response: The return information in the video task.

Batch Query Operation

This is for querying the details of multiple task IDs, and unlike the above, the action needs to be selected as retrieve_batch. Request Body includes:
  • ids: An array of uploaded task IDs.
  • action: The operation method for the task.
Set as shown in the image below:

Code Example

You can see that various language codes have been automatically generated on the right side of the page, as shown in the image below:

Some code examples are as follows:

Response Example

Upon a successful request, the API will return the specific details of all batch video tasks this time. 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,
      "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://file.aigpai.com/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,
      "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://file.aigpai.com/czjl/tjU3QYKgU96IJFgpL0eMfBFhmy0qXz9Y05P2IBhShCYaDCFUA/tmp5uligw3a.output.mp4",
            "state": "succeeded"
          }
        ]
      }
    }
  ],
  "count": 2
}

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 specific detail information of single or batch video tasks. We hope this document can help you better integrate and use the API. If you have any questions, please feel free to contact our technical support team.