> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dreamto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 查询任务

> 查询任务状态与结果。视频生成通常需要数分钟，建议每 15 秒查询一次；`task_status` 为 `SUCCEEDED` 时从 `output.video_url` 下载视频。任务 Id 24 小时内有效，不存在或已过期的任务返回 `UNKNOWN`。



## OpenAPI

````yaml /openapi/zh/wan-3-0.json get /api/v1/tasks/{task_id}
openapi: 3.1.0
info:
  description: >-
    万相 Wan 3.0 视频生成：创建文生视频、图生视频（首帧 /
    首尾帧）、全能参考生视频、视频编辑与延长任务，并查询任务结果。请求与响应和阿里云百炼官方 DashScope 协议一致。
  title: 万相 Wan 3.0 视频生成 API
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Wan 3.0
paths:
  /api/v1/tasks/{task_id}:
    get:
      tags:
        - Wan 3.0
      summary: 查询任务
      description: >-
        查询任务状态与结果。视频生成通常需要数分钟，建议每 15 秒查询一次；`task_status` 为 `SUCCEEDED` 时从
        `output.video_url` 下载视频。任务 Id 24 小时内有效，不存在或已过期的任务返回 `UNKNOWN`。
      operationId: wanQueryTask
      parameters:
        - description: 创建任务时返回的 `task_id`。
          example: 0385dc79-5ff8-4d82-bcb6-bc5ae0ed7a4f
          in: path
          name: task_id
          required: true
          schema:
            examples:
              - 0385dc79-5ff8-4d82-bcb6-bc5ae0ed7a4f
            type: string
      responses:
        '200':
          content:
            application/json:
              examples:
                排队中:
                  summary: 排队中
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    model: wan3.0-video
                    output:
                      task_id: 0385dc79-5ff8-4d82-bcb6-bc5ae0ed7a4f
                      task_status: PENDING
                      submit_time: '2026-11-17 20:22:46.125'
                生成中:
                  summary: 生成中
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    model: wan3.0-video
                    output:
                      task_id: 0385dc79-5ff8-4d82-bcb6-bc5ae0ed7a4f
                      task_status: RUNNING
                      submit_time: '2026-11-17 20:22:46.125'
                      scheduled_time: '2026-11-17 20:22:46.230'
                成功:
                  summary: 成功
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    model: wan3.0-video
                    output:
                      task_id: 0385dc79-5ff8-4d82-bcb6-bc5ae0ed7a4f
                      task_status: SUCCEEDED
                      submit_time: '2026-11-17 20:22:46.125'
                      scheduled_time: '2026-11-17 20:22:46.230'
                      end_time: '2026-11-17 20:23:44.674'
                      video_url: >-
                        https://api.dreamto.ai/api/v1/video-files/wvf_3f9a1c2b7d4e5f60718293a4c5d6e7f8
                      orig_prompt: 清晨的雨后街道，一只红色纸船顺着积水漂流，特写镜头，柔和晨光。
                    usage:
                      video_count: 1
                      duration: 5
                      SR: 720
                      output_video_duration: 5
                      input_video_duration: 0
                      fps: 30
                      ratio: '16:9'
                失败:
                  summary: 失败
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    model: wan3.0-video
                    output:
                      task_id: 0385dc79-5ff8-4d82-bcb6-bc5ae0ed7a4f
                      task_status: FAILED
                      submit_time: '2026-11-17 20:22:46.125'
                      scheduled_time: '2026-11-17 20:22:46.230'
                      end_time: '2026-11-17 20:22:51.581'
                      code: InvalidParameter
                      message: >-
                        Failed to download
                        https://your-cdn.example.com/first-frame.jpg
                任务不存在:
                  summary: 任务不存在
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    output:
                      task_id: 0385dc79-5ff8-4d82-bcb6-bc5ae0ed7a4f
                      task_status: UNKNOWN
              schema:
                $ref: '#/components/schemas/WanVideoTaskResponse'
          description: 任务详情；任务不存在时 `task_status` 为 `UNKNOWN`。
          headers:
            X-Request-Id:
              description: 请求 Id，联系支持时请提供。
              schema:
                type: string
        '401':
          content:
            application/json:
              examples:
                example:
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    code: InvalidApiKey
                    message: Invalid API-key provided.
              schema:
                $ref: '#/components/schemas/WanVideoErrorResponse'
          description: 缺少或无效的 API Key（`InvalidApiKey`）。
        '429':
          content:
            application/json:
              examples:
                example:
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    code: Throttling.RateQuota
                    message: Requests rate limit exceeded, please try again later.
              schema:
                $ref: '#/components/schemas/WanVideoErrorResponse'
          description: 触发限流，稍后重试（`Throttling.RateQuota`）。
        '500':
          content:
            application/json:
              examples:
                example:
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    code: InternalError
                    message: >-
                      An internal error has occured, please try again later or
                      contact service support.
              schema:
                $ref: '#/components/schemas/WanVideoErrorResponse'
          description: 服务端错误，稍后重试（`InternalError`）。
components:
  schemas:
    WanVideoTaskResponse:
      additionalProperties: false
      description: 查询任务的响应。
      properties:
        request_id:
          description: 请求 Id。
          type: string
        model:
          description: 任务使用的模型；任务不存在时省略。
          type: string
        output:
          $ref: '#/components/schemas/WanVideoTaskOutput'
          description: 任务状态与结果。
        usage:
          $ref: '#/components/schemas/WanVideoTaskUsage'
          description: 用量，仅任务成功时返回。
      required:
        - request_id
        - output
      type: object
    WanVideoErrorResponse:
      additionalProperties: false
      description: 错误响应。
      properties:
        request_id:
          description: 请求 Id，联系支持时请提供。
          type: string
        code:
          description: 错误码，如 `InvalidParameter`、`InvalidApiKey`。
          type: string
        message:
          description: 错误信息（英文）。
          type: string
      required:
        - request_id
        - code
        - message
      type: object
    WanVideoTaskOutput:
      additionalProperties: false
      description: 任务状态与结果。
      properties:
        task_id:
          description: 任务 Id。
          type: string
        task_status:
          description: |-
            任务状态。

            **可选值：**
            - `PENDING`：排队中。
            - `RUNNING`：生成中。
            - `SUCCEEDED`：成功，从 `video_url` 下载视频。
            - `FAILED`：失败，从 `code` / `message` 读取原因，不扣费。
            - `CANCELED`：已取消，不扣费。
            - `UNKNOWN`：任务不存在、不属于当前账号，或已超过 24 小时查询有效期。
          enum:
            - PENDING
            - RUNNING
            - SUCCEEDED
            - FAILED
            - CANCELED
            - UNKNOWN
          type: string
        submit_time:
          description: 提交时间（UTC+8，`YYYY-MM-DD HH:mm:ss.SSS`）。
          type: string
        scheduled_time:
          description: 开始执行时间（UTC+8）。
          type: string
        end_time:
          description: 结束时间（UTC+8），任务结束后返回。
          type: string
        video_url:
          description: 生成的视频（MP4，H.264），任务成功时返回。链接为 DreamTo 下载地址，自任务创建起 24 小时内有效，请及时下载保存。
          type: string
        orig_prompt:
          description: 原始提示词。
          type: string
        code:
          description: 错误码，任务失败时返回。
          type: string
        message:
          description: 错误信息，任务失败时返回。
          type: string
      required:
        - task_id
        - task_status
      type: object
    WanVideoTaskUsage:
      additionalProperties: false
      description: 用量。
      properties:
        video_count:
          description: 生成的视频数量，固定为 1。
          format: int64
          type: integer
        duration:
          description: 计费时长（秒）：输出时长；有输入视频时为输入与输出时长之和。
          format: double
          type: number
        SR:
          description: 输出分辨率档位（如 `720`）。
          format: int64
          type: integer
        output_video_duration:
          description: 输出视频时长（秒）。
          format: double
          type: number
        input_video_duration:
          description: 输入视频时长（秒），无视频输入时为 `0.0`。
          format: double
          type: number
        fps:
          description: 帧率，默认 30。
          format: int64
          type: integer
        ratio:
          description: 输出视频宽高比。
          type: string
      required:
        - video_count
        - duration
        - SR
        - output_video_duration
        - input_video_duration
      type: object
  securitySchemes:
    bearerAuth:
      description: '在请求头 `Authorization: Bearer <API Key>` 中携带 DreamTo API Key。'
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.