Wan Tasks API Integration and Usage

The main function of the Wan Tasks API is to query the execution status of tasks by inputting the task ID generated by the Wan Videos Generation API.

This document will provide a detailed description of the Wan Tasks API integration, helping you easily integrate and fully utilize the powerful features of this API. With the Wan Tasks API, you can easily query the execution status of tasks from the Wan Videos Generation API.

Application Process

To use the Wan Videos Generation API, first go to the YuJun Console to obtain your API Token for future use.

If you are not logged in or registered, you will be automatically redirected to the login page inviting you to register and log in, and after completion, you will be automatically returned to the current page.

One API Token can call all services on the platform without needing to apply separately for each service. The first application will grant a free quota for a trial experience; when the quota is insufficient, you can recharge the general balance in the console.

📘 Complete Documentation: Wan Videos Generation API →

Request Example

The Wan Tasks API can be used to query the results of the Wan Videos Generation API. For how to use the Wan Videos Generation API, please refer to the documentation Wan Videos Generation API.

We will take a task ID returned by the Wan Videos Generation API as an example to demonstrate how to use this API. Suppose we have a task ID: a4bca552-d964-46a1-8ff7-fd922f916582, 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 result should be in JSON format, filled in as application/json.
  • authorization: The key to call 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

It can be seen that various language codes have been automatically generated on the right side of the page, as shown in the image:

Some code examples are as follows:

CURL

curl -X POST 'https://api.acedata.cloud/wan/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "id": "a4bca552-d964-46a1-8ff7-fd922f916582",
  "action": "retrieve"
}'

Python

import requests

url = "https://api.acedata.cloud/wan/tasks"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}",
    "content-type": "application/json"
}

payload = {
    "id": "a4bca552-d964-46a1-8ff7-fd922f916582",
    "action": "retrieve"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)

Response Example

Upon successful request, the API will return the detailed information of the video task here. For example:

{
  "_id": "6974ce81ff2676299c399252",
  "id": "a4bca552-d964-46a1-8ff7-fd922f916582",
  "api_id": "6a4ecdbf-b219-4505-8277-5ec4b1ac14f8",
  "application_id": "52933893-8e8b-4cd6-b9e5-2354eedea000",
  "created_at": 1769262721.763,
  "started_at": 1769262721.823,
  "finished_at": 1769263509.094,
  "elapsed": 787.271,
  "credential_id": "c7173d71-d234-413e-ab72-7bfa6715d12f",
  "request": {
    "action": "text2video",
    "model": "wan2.6-t2v",
    "prompt": "Astronauts shuttle from space to volcano",
    "duration": 5
  },
  "trace_id": "b9cf9569-4010-46b1-80ec-efc881126eac",
  "type": "videos",
  "user_id": "ad7afe47-cea9-4cda-980f-2ad8810e51cf",
  "job_id": "0d2042f9-ba8d-496d-8ab5-182617e28f9e",
  "response": {
    "success": true,
    "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/1d/db/20260124/da477ba2/0d2042f9-ba8d-496d-8ab5-182617e28f9e.mp4?Expires=1769349278&OSSAccessKeyId=LTAI5tKPD3TMqf2Lna1fASuh&Signature=SjBa4wRcDVx3SSYu%2Fx7BYCFQk0s%3D",
    "state": "completed",
    "task_id": "a4bca552-d964-46a1-8ff7-fd922f916582"
  }
}

The returned result contains multiple fields, the request field is the request body when the task was initiated, while the response field is 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.
  • created_at: The task creation time, Unix timestamp (seconds, float).
  • started_at: The task start execution time, Unix timestamp (seconds, float).
  • finished_at: The task completion time, Unix timestamp (seconds, float). This field is not returned if the task is not completed.
  • elapsed: The time taken for task execution, in seconds (float, rounded to 3 decimal places). This field is not returned if the task is not completed.

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

It can be seen that various language codes have been automatically generated on the right side of the page, as shown in the image:

Some code examples are as follows:

Response Example

Upon successful request, the API will return the specific details of all batch video tasks this time. For example:

{
  "items": [
    {
      "_id": "6974ce81ff2676299c399252",
      "id": "a4bca552-d964-46a1-8ff7-fd922f916582",
      "api_id": "6a4ecdbf-b219-4505-8277-5ec4b1ac14f8",
      "application_id": "52933893-8e8b-4cd6-b9e5-2354eedea000",
      "created_at": 1769262721.763,
      "started_at": 1769262721.823,
      "finished_at": 1769263509.094,
      "elapsed": 787.271,
      "credential_id": "c7173d71-d234-413e-ab72-7bfa6715d12f",
      "request": {
        "action": "text2video",
        "model": "wan2.6-t2v",
        "prompt": "Astronauts shuttle from space to volcano",
        "duration": 5
      },
      "trace_id": "b9cf9569-4010-46b1-80ec-efc881126eac",
      "type": "videos",
      "user_id": "ad7afe47-cea9-4cda-980f-2ad8810e51cf",
      "job_id": "0d2042f9-ba8d-496d-8ab5-182617e28f9e",
      "response": {
        "success": true,
        "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/1d/db/20260124/da477ba2/0d2042f9-ba8d-496d-8ab5-182617e28f9e.mp4?Expires=1769349278&OSSAccessKeyId=LTAI5tKPD3TMqf2Lna1fASuh&Signature=SjBa4wRcDVx3SSYu%2Fx7BYCFQk0s%3D",
        "state": "completed",
        "task_id": "a4bca552-d964-46a1-8ff7-fd922f916582"
      }
    },
    {
      "_id": "6974ce81ff2676299c399252",
      "id": "a4bca552-d964-46a1-8ff7-fd922f916582",
      "api_id": "6a4ecdbf-b219-4505-8277-5ec4b1ac14f8",
      "application_id": "52933893-8e8b-4cd6-b9e5-2354eedea000",
      "created_at": 1769262721.763,
      "started_at": 1769262721.823,
      "finished_at": 1769263509.094,
      "elapsed": 787.271,
      "credential_id": "c7173d71-d234-413e-ab72-7bfa6715d12f",
      "request": {
        "action": "text2video",
        "model": "wan2.6-t2v",
        "prompt": "Astronauts shuttle from space to volcano",
        "duration": 5
      },
      "trace_id": "b9cf9569-4010-46b1-80ec-efc881126eac",
      "type": "videos",
      "user_id": "ad7afe47-cea9-4cda-980f-2ad8810e51cf",
      "job_id": "0d2042f9-ba8d-496d-8ab5-182617e28f9e",
      "response": {
        "success": true,
        "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/1d/db/20260124/da477ba2/0d2042f9-ba8d-496d-8ab5-182617e28f9e.mp4?Expires=1769349278&OSSAccessKeyId=LTAI5tKPD3TMqf2Lna1fASuh&Signature=SjBa4wRcDVx3SSYu%2Fx7BYCFQk0s%3D",
        "state": "completed",
        "task_id": "a4bca552-d964-46a1-8ff7-fd922f916582"
      }
    }
  ],
  "count": 2
}

CURL

curl -X POST 'https://api.acedata.cloud/wan/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "ids": ["a4bca552-d964-46a1-8ff7-fd922f916582","a4bca552-d964-46a1-8ff7-fd922f916582"],
  "action": "retrieve_batch"
}'

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 Wan Tasks API to query the specific details of single or batch 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.