Integration and Use of Midjourney Tasks API
The main function of the Midjourney Tasks API is to query the execution status of tasks by inputting the task ID generated by the Midjourney Imagine API or Midjourney Describe API.
This document will provide detailed integration instructions for the Midjourney Tasks API, helping you easily integrate and fully utilize the powerful features of this API. With the Midjourney Tasks API, you can easily query the execution status of tasks from the Midjourney Imagine API or Midjourney Describe API.
¶ Application Process
To use Midjourney Imagine API, first open the Ace Data Cloud Console and copy your API Token.

If you are not logged in, you will be redirected to sign in and brought back to this page automatically.
A single API Token works across every service on the platform — no need to subscribe per service. New accounts receive free starter credit; when it runs low you can top up your shared balance in the console.
📘 Full documentation: Midjourney Imagine API →
¶ Request Example
The Midjourney Tasks API can be used to query the results of both the Midjourney Imagine API and the Midjourney Describe API. For information on how to use the Midjourney Imagine API, please refer to the documentation Midjourney Imagine API. For information on how to use the Midjourney Describe API, please refer to Midjourney Describe API.
We will take a task ID returned by the Midjourney Imagine API as an example to demonstrate how to use this API. Suppose we have a task ID: 7489df4c-ef03-4de0-b598-e9a590793434, 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 toapplication/json.authorization: The key to call the API, which can be selected directly after application.
Request Body includes:
id: The uploaded task ID.ids: An array of task IDs for batch queries.action: The operation method for the task, supportingretrieve(single query) andretrieve_batch(batch query).
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/midjourney/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"id": "7489df4c-ef03-4de0-b598-e9a590793434",
"action": "retrieve"
}'
¶ Python
import requests
url = "https://api.acedata.cloud/midjourney/tasks"
headers = {
"accept": "application/json",
"authorization": "Bearer {token}",
"content-type": "application/json"
}
payload = {
"id": "7489df4c-ef03-4de0-b598-e9a590793434",
"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 image task. For example:
{
"_id": "668aae3f550a4144a540803b",
"id": "7489df4c-ef03-4de0-b598-e9a590793434",
"application_id": "9dec7b2a-1cad-41ff-8536-d4ddaf2525d4",
"created_at": 1720364607.967,
"credential_id": "68253cc8-505d-47f4-97ad-0050a62e4975",
"request": {
"mode": "fast",
"prompt": "A cat sitting on a table",
"action": "generate"
},
"type": "imagine",
"hold": false,
"image_id": "1259525319472185344",
"job_id": "da317da6-f500-48e6-bf32-dd48b3e6f84f",
"response": {
"image_url": "https://platform.cdn.acedata.cloud/midjourney/7489df4c-ef03-4de0-b598-e9a590793434.png?imageMogr2/thumbnail/!50p",
"image_width": 1024,
"image_height": 1024,
"actions": [
"upscale1",
"upscale2",
"upscale3",
"upscale4",
"reroll",
"variation1",
"variation2",
"variation3",
"variation4"
],
"raw_image_url": "https://platform.cdn.acedata.cloud/midjourney/7489df4c-ef03-4de0-b598-e9a590793434.png",
"raw_image_width": 2048,
"raw_image_height": 2048,
"progress": 100,
"image_id": "1259525319472185344",
"task_id": "7489df4c-ef03-4de0-b598-e9a590793434",
"success": true,
"job_id": "da317da6-f500-48e6-bf32-dd48b3e6f84f",
"hold": false
},
"duration": 29.437000036239624,
"finished_at": 1720364637.404
}
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. If type = imagine, the result is consistent with the request and return of the Midjourney Imagine API; if type = describe, the result is consistent with the request and return of the Midjourney Describe API. The field descriptions are as follows.
id: The ID of the image generation task, used to uniquely identify this image generation task.type: If type = imagine, it represents the result of the Midjourney Imagine API; if type = describe, it represents the result of the Midjourney Describe API.job_id: The ID of the image query task generated this time, used to uniquely identify this image query task.image_id: The unique identifier of the image task being queried, which needs to be passed when performing transformation operations on the image next time.request: The request information in the image query task.response: The return information in the image query 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
It can be seen that various language codes have been automatically generated on the right side of the page, as shown in the figure:

Some code examples are as follows:
¶ Response Example
After a successful request, the API will return the specific details of all batch image tasks. For example:
{
"items": [
{
"_id": "668aae3f550a4144a540803b",
"id": "7489df4c-ef03-4de0-b598-e9a590793434",
"application_id": "9dec7b2a-1cad-41ff-8536-d4ddaf2525d4",
"created_at": 1720364607.967,
"credential_id": "68253cc8-505d-47f4-97ad-0050a62e4975",
"request": {
"mode": "fast",
"prompt": "A cat sitting on a table",
"action": "generate"
},
"type": "imagine",
"hold": false,
"image_id": "1259525319472185344",
"job_id": "da317da6-f500-48e6-bf32-dd48b3e6f84f",
"response": {
"image_url": "https://platform.cdn.acedata.cloud/midjourney/7489df4c-ef03-4de0-b598-e9a590793434.png?imageMogr2/thumbnail/!50p",
"image_width": 1024,
"image_height": 1024,
"actions": [
"upscale1",
"upscale2",
"upscale3",
"upscale4",
"reroll",
"variation1",
"variation2",
"variation3",
"variation4"
],
"raw_image_url": "https://platform.cdn.acedata.cloud/midjourney/7489df4c-ef03-4de0-b598-e9a590793434.png",
"raw_image_width": 2048,
"raw_image_height": 2048,
"progress": 100,
"image_id": "1259525319472185344",
"task_id": "7489df4c-ef03-4de0-b598-e9a590793434",
"success": true,
"job_id": "da317da6-f500-48e6-bf32-dd48b3e6f84f",
"hold": false
},
"duration": 29.437000036239624,
"finished_at": 1720364637.404
},
{
"_id": "668b41d6550a4144a551d996",
"id": "807f62de-c63e-4add-8345-7f0ae6dd18e7",
"application_id": "9dec7b2a-1cad-41ff-8536-d4ddaf2525d4",
"created_at": 1720402390.341,
"credential_id": "6fd3e1d5-4bd6-47e8-8872-fab89a183b53",
"request": {
"mode": "fast",
"prompt": "A beautiful girl",
"action": "generate"
},
"type": "imagine",
"hold": false,
"image_id": "1259683790612070400",
"job_id": "ede5c805-e231-498c-8f74-3aa76d5d6d12",
"response": {
"image_url": "https://platform.cdn.acedata.cloud/midjourney/807f62de-c63e-4add-8345-7f0ae6dd18e7.png?imageMogr2/thumbnail/!50p",
"image_width": 1024,
"image_height": 1024,
"actions": [
"upscale1",
"upscale2",
"upscale3",
"upscale4",
"reroll",
"variation1",
"variation2",
"variation3",
"variation4"
],
"raw_image_url": "https://platform.cdn.acedata.cloud/midjourney/807f62de-c63e-4add-8345-7f0ae6dd18e7.png",
"raw_image_width": 2048,
"raw_image_height": 2048,
"progress": 100,
"image_id": "1259683790612070400",
"task_id": "807f62de-c63e-4add-8345-7f0ae6dd18e7",
"success": true,
"job_id": "ede5c805-e231-498c-8f74-3aa76d5d6d12",
"hold": false
},
"duration": 29.471999883651733,
"finished_at": 1720402419.813
}
],
"count": 2
}
The returned result contains multiple fields, among which items include the specific details of batch image tasks. The specific information of each image task is the same as the fields mentioned above, and the field information is as follows.
items, all specific details of batch image tasks. It is an array, and each element of the array has the same format as the return result of querying a single task above.count, the number of batch image tasks queried here.
¶ CURL
curl -X POST 'https://api.acedata.cloud/midjourney/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"action": "retrieve_batch",
"id": "",
"ids": ["7489df4c-ef03-4de0-b598-e9a590793434","807f62de-c63e-4add-8345-7f0ae6dd18e7"]
}'
¶ Python
import requests
url = "https://api.acedata.cloud/midjourney/tasks"
headers = {
"accept": "application/json",
"authorization": "Bearer {token}",
"content-type": "application/json"
}
payload = {
"action": "retrieve_batch",
"id": "",
"ids": ["7489df4c-ef03-4de0-b598-e9a590793434","807f62de-c63e-4add-8345-7f0ae6dd18e7"]
}
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 Midjourney Tasks API to query the specific details of single or batch image 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.
