All Products
Search
Document Center

:Asynchronous result query API

Last Updated:Sep 09, 2026

All asynchronous APIs use the same API, /rest/ai/task/queryTaskResult, to query results. After you submit an asynchronous task, you receive a TaskId. Use this API to poll the task status until the Status is COMPLETED or FAILED.

API

POST /rest/ai/task/queryTaskResult

All asynchronous SKUs (such as product material optimization, intelligent image generation, document translation, size chart extraction, and package dimension and weight verification) use this API to poll for results. We recommend a polling interval of at least 5 seconds.

Request parameters

Parameter

Type

Required

Description

TaskId

String

Yes

The task ID returned by the asynchronous task submission API. Example: b67f6089-085a-9402-93c6-bac0561b3a06.

Request example

{
    "TaskId": "b67f6089-085a-9402-93c6-bac0561b3a06"
}

Response parameters

Parameter

Type

Description

Code

String

The response code. A value of "success" indicates a successful request.

Data

Object

The object containing the result data.

Data.Status

String

The status of the task. Valid values are: QUEUED (The task is queued for processing), IN_PROGRESS (The task is processing), COMPLETED (The task is complete), and FAILED (The task failed).

Data.TaskId

String

Matches the task ID provided in the request.

Data.Result

String (JSON)

The task result, returned as a JSON string. You must parse this string (for example, with JSON.parse) before using it. If the task status is FAILED, this field contains the reason for the failure. The structure of business-specific fields varies by SKU. For details, see the documentation for the specific SKU.

Data.UsageMap

String / Object

Contains usage data. The key in this object varies by SKU. Examples include ProcessedImageCount for image-based services, ProcessedDocumentPageCount for document-based services, and ProcessingCount for services billed per request.

RequestId

String

A unique identifier for the API request. Provide this request ID to technical support for troubleshooting.

Success

Boolean

Indicates whether the request was successful. true indicates success, and false indicates failure.

Message

String

The response message. If the request is successful, the value is "Success". If the request fails, this field returns an error description, for example, "The parameters contain sensitive information. Please try other inputs."

Response examples

Success example (image services)

{
  "Data": {
    "Status": "COMPLETED",
    "UsageMap": {
      "ProcessedImageCount": "1"
    },
    "TaskId": "933fa07c-89a7-9607-a1be-37feaacb0e13",
    "Result": "{\"message\": {\"Https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/.../0a914347.png\": {\"SizeChart\": [{\"Size\": {\"value\": \"S\"}, \"Waist\": {\"unit\": \"CM\", \"value\": 58}}, {\"Size\": {\"value\": \"M\"}, \"Waist\": {\"unit\": \"CM\", \"value\": 59}}], \"SizeChartAttributes\": [\"Size\", \"SkirtLength\", \"WaistStretched\", \"RecommendedWeight\"], \"IntersectionAttributes\": [\"Size\", \"Waist\"]}}}"
  },
  "RequestId": "FCF68492-7CEB-1469-9AC9-0149A1F4416E",
  "Message": "Success",
  "Code": "success",
  "Success": true
}

Success example (document services)

{
  "Data": {
    "Status": "COMPLETED",
    "UsageMap": {
      "ProcessedDocumentPageCount": "1"
    },
    "TaskId": "cd98a77e-dfb0-98e0-ba62-615657e8359d",
    "Result": "{\"url\": \"https://aidge-bailian-oss.oss-cn-beijing.aliyuncs.com/.../translated_en.pdf?...\"}"
  },
  "RequestId": "6478F009-C44F-1FAB-BEF4-928E5DAD55B8",
  "Message": "Success",
  "Code": "success",
  "Success": true
}

Failure example

{
  "Data": {
    "Status": "FAILED",
    "TaskId": "7bcd2010-dd79-9b89-9d7f-8c256bf69456",
    "Result": "\"usageMap parse error\""
  },
  "RequestId": "9923C1E4-BACD-1C93-A642-0D4921D374C2",
  "Message": "Success",
  "Code": "success",
  "Success": true
}

Notes

  • A successful API response does not guarantee a successful task: Even if the task itself fails (i.e., Data.Status is FAILED), the API still returns Code: "success" and Success: true. You must check the Data.Status field to determine the task's outcome.

  • Result must be parsed: The Data.Result field is a JSON string, not a native JSON object. You must parse it (for example, using JSON.parse) to access its contents.

  • Polling interval: A polling interval of 5 seconds or more is recommended. While this query API has no rate limit, the submission APIs have rate limits that vary by SKU. For details, see Rate limits.

  • Troubleshooting: If a task fails, check the Data.Result field for the failure reason and provide the RequestId to support. For a complete list of error codes, see Error codes.