**版本：202701**

# 查询专辑异步任务

**GET** `/openapi/2027-01/collections/async-task/:id`

查询由 AsyncCreateCollection / AsyncUpdateSmartCollectionRule 发起的异步任务的状态与结果。

## 请求

**Path参数**

- `id` string (required)

  由 AsyncCreateCollection / AsyncUpdateSmartCollectionRule 返回的异步任务 ID

**Query参数**

- `source_id` string

  任务关联的资源 ID（如智能专辑 UUID）。在未知异步任务 ID 时，可与 task\_type 联合作为备用查询条件
- `task_type` string

  任务类型。可选值：

  *   `create_collection`：异步创建智能专辑
  *   `update_smart_collection_rule`：异步更新智能专辑规则

## 响应

**200**

OK

**application/json**

**数据结构 | 示例**

**数据结构**

- `code` string

  错误码
- `message` string

  错误信息
- `data` object

  - `async_task` object

    异步任务详情

    - `id` string

      异步任务 ID
    - `source_id` string

      任务关联的资源 ID（如智能专辑的 UUID）
    - `task_type` string

      任务类型。可能取值：create\_collection（异步创建专辑）、update\_smart\_collection\_rule（异步更新智能专辑规则）
    - `state` string

      任务状态。可能取值：pending（排队中）、running（执行中）、succeeded（成功）、failed（失败）
    - `message` string

      可读消息，state=failed 时通常为错误描述
    - `created_at` string

      任务创建时间，ISO 8601 格式（如 2026-01-15T10:30:00Z）
    - `updated_at` string

      任务最近更新时间，ISO 8601 格式
    - `task_data` object

      任务负载，具体 schema 由 task\_type 决定。包装消息内含 @type 字段供客户端按类型解码

      - `@type` string

        The type of the serialized message.
      - `property name*` any

        任务负载，具体 schema 由 task\_type 决定。包装消息内含 @type 字段供客户端按类型解码

```json
{
  "code": "string",
  "message": "string",
  "data": {
    "async_task": {
      "id": "string",
      "source_id": "string",
      "task_type": "string",
      "state": "string",
      "message": "string",
      "created_at": "string",
      "updated_at": "string",
      "task_data": {
        "@type": "string"
      }
    }
  }
}
```
