SeeDream Tasks API Integration and Usage

The main function of the SeeDream Tasks API is to query the execution status of a task by entering the task ID generated by the SeeDream Images Generation API.

This document provides detailed instructions for integrating the SeeDream Tasks API, helping you easily integrate and take full advantage of its powerful features. With the SeeDream Tasks API, you can easily query the execution status of SeeDream Images Generation API tasks.

Application Process

To use the SeeDream Images Generation API, first go to 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. Once completed, you will be 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 can be 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 displayed in the account. If the balance is insufficient, click the "Recharge" button.

📘 Full documentation: SeeDream Images Generation API →

Request Example

The SeeDream Tasks API can be used to query the results of the SeeDream Images Generation API. For information on how to use the SeeDream Images Generation API, please refer to the SeeDream Images Generation API documentation.

We will use a task ID returned by the SeeDream Images Generation API service as an example to demonstrate how to use this API. Suppose we have a task ID: 20068983-0cc9-4c6a-aeb6-9c6a3c668be0. Next, we will demonstrate how to do so by passing in 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. Enter application/json here.
  • authorization: The key used to call the API. After applying for it, you can select it directly from the dropdown menu.

Request Body includes:

  • id: The submitted task ID.
  • action: The operation to perform on the task.

Set them as shown below:

Code Example

You can see that code in various languages has already been automatically generated on the right side of the page, as shown below:

Some code examples are shown below:

CURL

curl -X POST 'https://api.acedata.cloud/seedream/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "id": "a6e0d456-189b-4c78-9232-2fe72166ab39",
  "action": "retrieve"
}'

Response Example

After a successful request, the API will return the details of the task. For example:

{
  "success": true,
  "task_id": "84d1544a-9043-4dde-a98b-e889dacd75f6",
  "trace_id": "176acf03-7ca7-4fc6-85db-e3724d4f59eb",
  "data": [
    {
      "prompt": "a white siamese cat",
      "size": "2048x2048",
      "image_url": "https://platform.cdn.acedata.cloud/seedream/6e5f9085-cc4a-4801-b77b-31550129ff19.jpg"
    }
  ]
}

The returned result contains several fields, described below:

  • success, the status of the video generation task.
  • task_id, the video generation task ID.
  • trace_id, the video generation trace ID.
  • data, the list of results from the image generation task.
    • image_url, the link to the image generated by the task.
    • prompt, the prompt.
    • size: The pixel dimensions of the generated image.

Batch Query Operations

This is used to query the details of multiple tasks by their IDs. Unlike the above, action needs to be set to retrieve_batch.

Request Body includes:

  • ids: An array of submitted task IDs.
  • action: The operation to perform on the tasks.

Set them as shown below:

Code Example

Some code examples are shown below:

Response Example

After a successful request, the API will return the specific details of all tasks in the batch. For example:

{
  "items": [
    {
      "_id": "69498b9bff2676299c5cb7a6",
      "id": "84d1544a-9043-4dde-a98b-e889dacd75f6",
      "api_id": "86ad30f3-0bc8-4b9b-b019-b9fa5b05672e",
      "application_id": "11e25072-de6d-4bd6-81e7-77ee0055499a",
      "created_at": 1766427547.107,
      "started_at": 1766427547.167,
      "finished_at": 1766427560.667,
      "elapsed": 13.5,
      "credential_id": "50892af9-597f-426e-a455-bc1739de95b0",
      "request": {
        "action": "generate",
        "model": "doubao-seedream-4-0-250828",
        "prompt": "a white siamese cat"
      },
      "trace_id": "176acf03-7ca7-4fc6-85db-e3724d4f59eb",
      "type": "images",
      "user_id": "b60a9491-1eba-4ab8-a93f-12c0fd81dab4",
      "response": {
        "success": true,
        "task_id": "84d1544a-9043-4dde-a98b-e889dacd75f6",
        "trace_id": "176acf03-7ca7-4fc6-85db-e3724d4f59eb",
        "data": [
          {
            "prompt": "a white siamese cat",
            "size": "2048x2048",
            "image_url": "https://platform.cdn.acedata.cloud/seedream/6e5f9085-cc4a-4801-b77b-31550129ff19.jpg"
          }
        ]
      }
    },
    {
      "_id": "69498b9bff2676299c5cb7a6",
      "id": "84d1544a-9043-4dde-a98b-e889dacd75f6",
      "api_id": "86ad30f3-0bc8-4b9b-b019-b9fa5b05672e",
      "application_id": "11e25072-de6d-4bd6-81e7-77ee0055499a",
      "created_at": 1766427547.107,
      "started_at": 1766427547.167,
      "finished_at": 1766427560.667,
      "elapsed": 13.5,
      "credential_id": "50892af9-597f-426e-a455-bc1739de95b0",
      "request": {
        "action": "generate",
        "model": "doubao-seedream-4-0-250828",
        "prompt": "a white siamese cat"
      },
      "trace_id": "176acf03-7ca7-4fc6-85db-e3724d4f59eb",
      "type": "images",
      "user_id": "b60a9491-1eba-4ab8-a93f-12c0fd81dab4",
      "response": {
        "success": true,
        "task_id": "84d1544a-9043-4dde-a98b-e889dacd75f6",
        "trace_id": "176acf03-7ca7-4fc6-85db-e3724d4f59eb",
        "data": [
          {
            "prompt": "a white siamese cat",
            "size": "2048x2048",
            "image_url": "https://platform.cdn.acedata.cloud/seedream/6e5f9085-cc4a-4801-b77b-31550129ff19.jpg"
          }
        ]
      }
    }
  ],
  "count": 2
}

The returned result contains multiple fields, among which items contains the details of the batch tasks. The details of each task have the same fields as described above, and the fields are as follows.

  • items, all details of the batch 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 tasks queried in this batch.

Each task object in the batch result also contains the following timing fields.

  • created_at, the task creation time, as a Unix timestamp (seconds, floating-point).
  • started_at, the time the task started execution, 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 time in seconds (floating-point, rounded to 3 decimal places). This field is not returned when the task is incomplete.

CURL

curl -X POST 'https://api.acedata.cloud/seedance/tasks' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
  "ids": ["84d1544a-9043-4dde-a98b-e889dacd75f6","84d1544a-9043-4dde-a98b-e889dacd75f6"],
  "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 SeeDream Tasks API to query all the details of a single task or a batch of tasks. We hope this document will help you integrate and use the API more effectively. If you have any questions, please feel free to contact our technical support team.