Flux Tasks API Integration and Usage
The main function of the Flux Tasks API is to query a task's execution status by providing the platform task ID returned by the Flux Images Generation API or Flux Videos API.
This document provides detailed integration instructions for the Flux Tasks API, helping you easily integrate and take full advantage of its powerful features. With the Flux Tasks API, you can easily query the execution status of Flux Images Generation API tasks.
For a complete example of video submission and polling, see the Flux Videos API Integration Guide. Querying existing tasks does not incur additional generation charges.
¶ Application Process
To use the Flux Images Generation API, first visit the Ace Data Cloud Console to obtain your API Token for later use.

If you have not logged in or registered, you will be automatically redirected to the login page to register and log in, and then 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 is 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: Flux Images Generation API →
¶ Request Example
The Flux Tasks API can be used to query the results of the Flux Images Generation API. For information on how to use the Flux Images Generation API, please refer to the Flux Images Generation API documentation.
We will use a task ID returned by the Flux Images Generation API service as an example to demonstrate how to use this API. Suppose we have a task ID: 2db0168c-2373-4367-8d9a-9dc778802e8a. Next, we will demonstrate how to do so by providing a task ID.
¶ Example Task 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 for calling the API, which can be selected directly from the dropdown 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 generated automatically on the right side of the page, as shown below:

Some code examples are shown below:
¶ CURL
curl -X POST 'https://api.acedata.cloud/flux/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"id": "2c454ff3-4f8f-47f0-8147-acb29a84d1c2",
"action": "retrieve"
}'
¶ Python
import requests
url = "https://api.acedata.cloud/flux/tasks"
headers = {
"accept": "application/json",
"authorization": "Bearer {token}",
"content-type": "application/json"
}
payload = {
"id": "2c454ff3-4f8f-47f0-8147-acb29a84d1c2",
"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 image task shown here. For example:
{
"_id": "677de81d550a4144a5f4cf62",
"id": "2db0168c-2373-4367-8d9a-9dc778802e8a",
"api_id": "deefc5d7-7f22-43e9-929e-f2b6afee60b7",
"application_id": "001c2f84-2a4a-4c4d-ba3f-8a89f43b5be2",
"created_at": 1736304669.779,
"started_at": 1736304669.839,
"finished_at": 1736304679.439,
"elapsed": 9.6,
"credential_id": "b00bddd3-140f-4343-a9a2-affb312b60de",
"request": {
"action": "generate",
"size": "1024x1024",
"prompt": "a white siamese cat"
},
"trace_id": "6624929c-bb80-40c0-81e8-d96af8405d19",
"user_id": "ad7afe47-cea9-4cda-980f-2ad8810e51cf",
"response": {
"success": true,
"task_id": "2db0168c-2373-4367-8d9a-9dc778802e8a",
"trace_id": "6624929c-bb80-40c0-81e8-d96af8405d19",
"data": [
{
"prompt": "a white siamese cat",
"image_url": "https://cdn.acedata.cloud/e724d7f13d.png",
"seed": 281520112,
"timings": {
"inference": 3.193
}
}
]
}
}
The result contains multiple fields. The request field is the request body used when initiating the task, while the response field is the response body returned after the task is completed. The fields are described below.
id, the ID of this image task, used to uniquely identify the image generation task.request, the request information in the image task query.response, the response information in the image task query.created_at, the task creation time, as a Unix timestamp (seconds, floating-point).started_at, the task execution 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 duration in seconds (floating-point, rounded to 3 decimal places). This field is not returned when the task is incomplete.
¶ Batch Query Operation
This queries image 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 generated automatically 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 image tasks in this batch. For example:
{
"items": [
{
"_id": "677de81d550a4144a5f4cf62",
"id": "2db0168c-2373-4367-8d9a-9dc778802e8a",
"api_id": "deefc5d7-7f22-43e9-929e-f2b6afee60b7",
"application_id": "001c2f84-2a4a-4c4d-ba3f-8a89f43b5be2",
"created_at": 1736304669.779,
"started_at": 1736304669.839,
"finished_at": 1736304679.439,
"elapsed": 9.6,
"credential_id": "b00bddd3-140f-4343-a9a2-affb312b60de",
"request": {
"action": "generate",
"size": "1024x1024",
"prompt": "a white siamese cat"
},
"trace_id": "6624929c-bb80-40c0-81e8-d96af8405d19",
"user_id": "ad7afe47-cea9-4cda-980f-2ad8810e51cf",
"response": {
"success": true,
"task_id": "2db0168c-2373-4367-8d9a-9dc778802e8a",
"trace_id": "6624929c-bb80-40c0-81e8-d96af8405d19",
"data": [
{
"prompt": "a white siamese cat",
"image_url": "https://cdn.acedata.cloud/e724d7f13d.png",
"seed": 281520112,
"timings": {
"inference": 3.193
}
}
]
}
},
{
"_id": "677de950550a4144a5f52963",
"id": "72bdd69d-290d-4710-a6d4-60c78968865a",
"api_id": "deefc5d7-7f22-43e9-929e-f2b6afee60b7",
"application_id": "001c2f84-2a4a-4c4d-ba3f-8a89f43b5be2",
"created_at": 1736304976.278,
"started_at": 1736304976.338,
"finished_at": 1736304985.938,
"elapsed": 9.6,
"credential_id": "b00bddd3-140f-4343-a9a2-affb312b60de",
"request": {
"action": "generate",
"size": "1024x1024",
"prompt": "a white siamese cat"
},
"trace_id": "1dca4b49-d31d-42e6-83d9-7f0c56f62d31",
"user_id": "ad7afe47-cea9-4cda-980f-2ad8810e51cf",
"response": {
"success": true,
"task_id": "72bdd69d-290d-4710-a6d4-60c78968865a",
"trace_id": "1dca4b49-d31d-42e6-83d9-7f0c56f62d31",
"data": [
{
"prompt": "a white siamese cat",
"image_url": "https://cdn.acedata.cloud/e724d7f13d.png",
"seed": 1437672535,
"timings": {
"inference": 3.175
}
}
]
}
}
],
"count": 2
}
The returned result contains multiple fields, among which items contains the details of the batch image tasks. The details of each image task use the same fields as above, and the field information is as follows.
items, all the details of the batch image tasks. It is an array, and each element of the array has the same format as the result returned when querying a single task above.count, the number of image tasks queried in this batch.
¶ CURL
curl -X POST 'https://api.acedata.cloud/flux/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"ids": ["2db0168c-2373-4367-8d9a-9dc778802e8a","72bdd69d-290d-4710-a6d4-60c78968865a"],
"action": "retrieve_batch"
}'
¶ Python
import requests
url = "https://api.acedata.cloud/flux/tasks"
headers = {
"accept": "application/json",
"authorization": "Bearer {token}",
"content-type": "application/json"
}
payload = {
"ids": ["2db0168c-2373-4367-8d9a-9dc778802e8a","72bdd69d-290d-4710-a6d4-60c78968865a"],
"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 FLux Tasks API to query all the details of a single image task or a batch of image 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.
