Skip to main content
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 the Midjourney Imagine API, first go to the Ace Data Cloud 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 to invite 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: 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 how to use the Midjourney Imagine API, please refer to the documentation Midjourney Imagine API. For how to use Midjourney Describe, 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 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.
  • ids: An array of task IDs for batch queries.
  • action: The operation method for the task, supporting retrieve (single query) and retrieve_batch (batch query).
Set as shown in the figure 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:

CURL

Python

Response Example

After a successful request, the API will return the detailed information of the image task here. For example:
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. If type = imagine, its result is consistent with the request and return of the Midjourney Imagine API; if type = describe, its 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 here, 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.
  • created_at: The task creation time, Unix timestamp (seconds, floating point).
  • started_at: The task start execution time, Unix timestamp (seconds, floating point).
  • finished_at: The task completion time, Unix timestamp (seconds, floating point). This field is not returned if the task is not completed.
  • elapsed: The time taken for task execution, in seconds (floating point, 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: Array of uploaded task IDs.
  • action: The method of operation on the task.
Set as shown in the figure 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:
The returned result contains multiple fields, among which items includes the specific details of the 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 the 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 image tasks in this batch query.

CURL

Python

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

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.